2008-Feb-12 UPDATE Tim Hanson sideskate@gmail.com

================================================================================
+eeschema
        * commiting my changes to allow multiple instances of a given schematic file within 
a hierarchy:
        ** internally, m_currentScreen has been replaced with m_currentSheet,
                which is a list or 'path' of screens.  The path of screens is used to 
generate
                a series of timestamps, which is converted to flat component reference via 
a look-up
                table in the schematic files.
        ** this means that m_currentScreen is no longer used -- use GetScreen().
        ** GetScreen is virtual, as some of the dialogs keep around a WinEDA_BaseScreen 
pointer.
        ** all sub-sheets in a given schematic must have different names to generate a 
meaningful netlist.
This commit is contained in:
lifekidyeaa 2008-02-12 21:12:46 +00:00
parent 27bd742a8a
commit c5cd85027b
153 changed files with 3492 additions and 2735 deletions

View File

@ -11,6 +11,7 @@
# #
# CMAKE_VERBOSE_MAKEFILE ON/OFF (OPTIONAL) # CMAKE_VERBOSE_MAKEFILE ON/OFF (OPTIONAL)
# Turns ON/OFF verbose build messages. # Turns ON/OFF verbose build messages.
# you can also pass VERBOSE=1 to make for the same effect.
# #
# CMAKE_INSTALL_PREFIX (OPTIONAL) # CMAKE_INSTALL_PREFIX (OPTIONAL)
# #

View File

@ -6,6 +6,19 @@ Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Feb-12 UPDATE Tim Hanson sideskate@gmail.com
================================================================================
+eeschema
* commiting my changes to allow multiple instances of a given schematic file within a hierarchy:
** internally, m_currentScreen has been replaced with m_currentSheet,
which is a list or 'path' of screens. The path of screens is used to generate
a series of timestamps, which is converted to flat component reference via a look-up
table in the schematic files.
** this means that m_currentScreen is no longer used -- use GetScreen().
** GetScreen is virtual, as some of the dialogs keep around a WinEDA_BaseScreen pointer.
** all sub-sheets in a given schematic must have different names to generate a meaningful netlist.
=======
2008-Feb-12 UPDATE Igor Plyatov <plyatov@mail.ru> 2008-Feb-12 UPDATE Igor Plyatov <plyatov@mail.ru>
================================================================================ ================================================================================
+eeschema +eeschema
@ -13,7 +26,6 @@ email address.
+all +all
Russian translation update. Russian translation update.
2008-Feb-11 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Feb-11 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+pcbnew +pcbnew

View File

@ -49,7 +49,7 @@ BASE_SCREEN::~BASE_SCREEN()
void BASE_SCREEN::InitDatas() void BASE_SCREEN::InitDatas()
/*******************************/ /*******************************/
{ {
m_SheetNumber = m_NumberOfSheet = 1; /* gestion hierarchie: Root: SheetNumber = 1 */ m_ScreenNumber = m_NumberOfScreen = 1; /* gestion hierarchie: Root: ScreenNumber = 1 */
m_Zoom = 32; m_Zoom = 32;
m_Grid = wxSize( 50, 50 ); /* pas de la grille */ m_Grid = wxSize( 50, 50 ); /* pas de la grille */
m_UserGrid = g_UserGrid; /* pas de la grille "utilisateur" */ m_UserGrid = g_UserGrid; /* pas de la grille "utilisateur" */
@ -63,18 +63,18 @@ void BASE_SCREEN::InitDatas()
{ {
case SCHEMATIC_FRAME: case SCHEMATIC_FRAME:
m_Center = FALSE; m_Center = FALSE;
m_CurrentSheet = &g_Sheet_A4; m_CurrentSheetDesc = &g_Sheet_A4;
break; break;
default: default:
case CVPCB_DISPLAY_FRAME: case CVPCB_DISPLAY_FRAME:
case MODULE_EDITOR_FRAME: case MODULE_EDITOR_FRAME:
case PCB_FRAME: case PCB_FRAME:
m_CurrentSheet = &g_Sheet_A4; m_CurrentSheetDesc = &g_Sheet_A4;
break; break;
case GERBER_FRAME: case GERBER_FRAME:
m_CurrentSheet = &g_Sheet_GERBER; m_CurrentSheetDesc = &g_Sheet_GERBER;
break; break;
} }
@ -158,15 +158,15 @@ wxSize BASE_SCREEN::ReturnPageSize()
{ {
default: default:
case SCHEMATIC_FRAME: case SCHEMATIC_FRAME:
PageSize = m_CurrentSheet->m_Size; PageSize = m_CurrentSheetDesc->m_Size;
break; break;
case GERBER_FRAME: case GERBER_FRAME:
case CVPCB_DISPLAY_FRAME: case CVPCB_DISPLAY_FRAME:
case MODULE_EDITOR_FRAME: case MODULE_EDITOR_FRAME:
case PCB_FRAME: case PCB_FRAME:
PageSize.x = m_CurrentSheet->m_Size.x * (PCB_INTERNAL_UNIT / 1000); PageSize.x = m_CurrentSheetDesc->m_Size.x * (PCB_INTERNAL_UNIT / 1000);
PageSize.y = m_CurrentSheet->m_Size.y * (PCB_INTERNAL_UNIT / 1000); PageSize.y = m_CurrentSheetDesc->m_Size.y * (PCB_INTERNAL_UNIT / 1000);
break; break;
} }

View File

@ -186,7 +186,9 @@ std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
void EDA_BaseStruct::Show( int nestLevel, std::ostream& os ) void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
{ {
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n"; wxString s = GetClass();
s = s + wxT(" ");
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">\n";
/* /*
EDA_BaseStruct* kid = m_Son; EDA_BaseStruct* kid = m_Son;
@ -195,9 +197,9 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
kid->Show( nestLevel+1, os ); kid->Show( nestLevel+1, os );
} }
*/ */
NestedSpace( nestLevel+1, os ) << "Need ::Show() override, shown class is using EDA_BaseStruct::Show()\n"; NestedSpace( nestLevel+1, os ) << "Need ::Show() override\n";
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n";
} }

View File

@ -122,6 +122,9 @@ void WinEDA_BasicFrame::PrintMsg(const wxString & text)
/******************************************************/ /******************************************************/
{ {
SetStatusText(text); SetStatusText(text);
#ifdef DEBUG
printf("%s\n", (const char*)text.mb_str() );
#endif
} }
/*************************************************************************/ /*************************************************************************/

View File

@ -80,7 +80,7 @@ void PlotWorkSheet(int format_plot, BASE_SCREEN * screen)
*/ */
{ {
#define WSTEXTSIZE 50 // Text size in mils #define WSTEXTSIZE 50 // Text size in mils
Ki_PageDescr * Sheet = screen->m_CurrentSheet; Ki_PageDescr * Sheet = screen->m_CurrentSheetDesc;
int ii, jj, xg , yg, ipas, gxpas, gypas; int ii, jj, xg , yg, ipas, gxpas, gypas;
wxSize PageSize; wxSize PageSize;
wxPoint pos, ref; wxPoint pos, ref;
@ -234,11 +234,11 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
break; break;
case WS_SIZESHEET: case WS_SIZESHEET:
msg += screen->m_CurrentSheet->m_Name; msg += screen->m_CurrentSheetDesc->m_Name;
break; break;
case WS_IDENTSHEET: case WS_IDENTSHEET:
msg << screen->m_SheetNumber << wxT("/") << screen->m_NumberOfSheet; msg << screen->m_ScreenNumber << wxT("/") << screen->m_NumberOfScreen;
break; break;
case WS_COMPANY_NAME: case WS_COMPANY_NAME:

View File

@ -40,7 +40,7 @@ void WinEDA_DrawFrame::CopyToClipboard(wxCommandEvent& event)
if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD ) if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
{ {
if (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE) if (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE)
DrawPanel->SetCursor(wxCursor(DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor) ); DrawPanel->SetCursor(wxCursor(DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor) );
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )

View File

@ -505,7 +505,7 @@ void SetRealLibraryPath( const wxString& shortlibname )
* Sinon g_UserLibDirBuffer = /usr/share/kicad/shortlibname/ * Sinon g_UserLibDirBuffer = /usr/share/kicad/shortlibname/
* *
* Remarque: * Remarque:
* Les \ sont remplacés par / (a la mode Unix) * Les \ sont remplac<EFBFBD>s par / (a la mode Unix)
*/ */
{ {
bool PathFound = FALSE; bool PathFound = FALSE;
@ -545,7 +545,7 @@ wxString ReturnKicadDatasPath()
* Sinon retourne /usr/share/kicad/ * Sinon retourne /usr/share/kicad/
* *
* Remarque: * Remarque:
* Les \ sont remplacés par / (a la mode Unix) * Les \ sont remplac<EFBFBD>s par / (a la mode Unix)
*/ */
{ {
bool PathFound = FALSE; bool PathFound = FALSE;

View File

@ -21,7 +21,7 @@ void WinEDA_DrawFrame::TraceWorkSheet(wxDC * DC, BASE_SCREEN * screen, int line_
{ {
if ( ! m_Draw_Sheet_Ref ) return; if ( ! m_Draw_Sheet_Ref ) return;
Ki_PageDescr * Sheet = screen->m_CurrentSheet; Ki_PageDescr * Sheet = screen->m_CurrentSheetDesc;
int ii, jj, xg , yg, ipas, gxpas, gypas; int ii, jj, xg , yg, ipas, gxpas, gypas;
wxPoint pos; wxPoint pos;
int refx, refy,Color; int refx, refy,Color;
@ -179,10 +179,8 @@ int width = line_width;
case WS_IDENTSHEET: case WS_IDENTSHEET:
if(WsItem->m_Legende) msg = WsItem->m_Legende; if(WsItem->m_Legende) msg = WsItem->m_Legende;
msg << screen->m_SheetNumber << wxT("/") <<
screen->m_NumberOfSheet;
DrawGraphicText(DrawPanel, DC, pos, Color, DrawGraphicText(DrawPanel, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size, GetScreenDesc(), TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width);
break; break;
@ -273,3 +271,12 @@ int width = line_width;
} }
} }
} }
/*********************************************************************/
wxString WinEDA_DrawFrame::GetScreenDesc()
/*********************************************************************/
{
wxString msg;
msg << GetScreen()->m_ScreenNumber << wxT("/") <<
GetScreen()->m_NumberOfScreen;
return msg;
}

View File

@ -12,7 +12,7 @@ SET(EESCHEMA_SRCS
block_libedit.cpp block_libedit.cpp
busentry.cpp busentry.cpp
bus-wire-junction.cpp bus-wire-junction.cpp
class_hierarchy_sheet.cpp class_drawsheet.cpp
class_screen.cpp class_screen.cpp
class_text-label.cpp class_text-label.cpp
cleanup.cpp cleanup.cpp

View File

@ -35,7 +35,7 @@ void EDA_SchComponentStruct::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
Affiche_1_Parametre( frame, 1, _( "Ref" ), Affiche_1_Parametre( frame, 1, _( "Ref" ),
m_Field[REFERENCE].m_Text, DARKCYAN ); GetRef(((WinEDA_SchematicFrame*)frame)->GetSheet()), DARKCYAN );
if( Entry && Entry->m_Options == ENTRY_POWER ) if( Entry && Entry->m_Options == ENTRY_POWER )
msg = _( "Pwr Symb" ); msg = _( "Pwr Symb" );

View File

@ -12,7 +12,7 @@ static bool SortByPosition = true;
#include "protos.h" #include "protos.h"
/* Local Functions*/ /* Local Functions*/
static int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumSheet ); static int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet );
static int AnnotTriComposant( const void* o1, const void* o2 ); static int AnnotTriComposant( const void* o1, const void* o2 );
static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp );
static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp );
@ -34,17 +34,17 @@ void ReAnnotatePowerSymbolsOnly( void )
* PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation * PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation
*/ */
{ {
/* Build the screen list */ /* Build the screen list (screen, not sheet) */
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
/* Update the sheet number, sheet count and date */ /* Update the screen number, sheet count and date */
ScreenList.UpdateSheetNumberAndDate(); //ScreenList.UpdateScreenNumberAndDate();
SCH_SCREEN* screen; DrawSheetList* sheet;
int CmpNumber = 1; int CmpNumber = 1;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext())
{ {
EDA_BaseStruct* DrawList = screen->EEDrawList; EDA_BaseStruct* DrawList = sheet->LastDrawList();
for( ; DrawList != NULL; DrawList = DrawList->Pnext ) for( ; DrawList != NULL; DrawList = DrawList->Pnext )
{ {
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
@ -54,15 +54,31 @@ void ReAnnotatePowerSymbolsOnly( void )
FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( (Entry == NULL) || (Entry->m_Options != ENTRY_POWER) ) if( (Entry == NULL) || (Entry->m_Options != ENTRY_POWER) )
continue; continue;
DrawLibItem->ClearAnnotation(); //DrawLibItem->ClearAnnotation(sheet); this clears all annotation :(
DrawLibItem->m_RefIdNumber = CmpNumber; wxString refstr = DrawLibItem->m_PrefixString;
DrawLibItem->m_Field[REFERENCE].m_Text.RemoveLast(); // Remove the '?' //str will be "C?" or so after the ClearAnnotation call.
DrawLibItem->m_Field[REFERENCE].m_Text << wxT( "0" ) << CmpNumber; while(refstr.Last() == '?')
refstr.RemoveLast();
if(!refstr.StartsWith(wxT("#")))
refstr = wxT("#") + refstr;
refstr << wxT( "0" ) << CmpNumber;
DrawLibItem->SetRef(sheet, refstr);
CmpNumber++; CmpNumber++;
} }
} }
} }
/***********************************************************************/
CmpListStruct* AllocateCmpListStrct(int numcomponents )
/***********************************************************************/
{
int ii = numcomponents * sizeof(CmpListStruct);
CmpListStruct* list = (CmpListStruct*) MyZMalloc( ii );
//fill this memory with zeros.
char* cptr = (char*)list;
for(int i=0; i<ii; i++)
*cptr++ = 0;
return list;
}
/***********************************************************************/ /***********************************************************************/
void InstallAnnotateFrame( WinEDA_SchematicFrame* parent, wxPoint& pos ) void InstallAnnotateFrame( WinEDA_SchematicFrame* parent, wxPoint& pos )
@ -84,12 +100,12 @@ void WinEDA_AnnotateFrame::AnnotateComponents( wxCommandEvent& event )
/******************************************************************/ /******************************************************************/
/** Function WinEDA_AnnotateFrame::AnnotateComponents /** Function WinEDA_AnnotateFrame::AnnotateComponents
* Compute the annotation of the components for the whole projeect, or the current sheet only. * Compute the annotation of the components for the whole project, or the current sheet only.
* All the components or the new ones only will be annotated. * All the components or the new ones only will be annotated.
*/ */
{ {
int NbSheet, ii, NbOfCmp; int ii, NbOfCmp;
SCH_SCREEN* screen; DrawSheetList* sheet;
CmpListStruct* BaseListeCmp; CmpListStruct* BaseListeCmp;
wxBusyCursor dummy; wxBusyCursor dummy;
@ -104,47 +120,36 @@ void WinEDA_AnnotateFrame::AnnotateComponents( wxCommandEvent& event )
return; return;
/* Build the screen list */ /* Build the sheet list */
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( g_RootSheet );
NbSheet = ScreenList.GetCount(); /* Update the sheet number */
ii = 0;
/* Update the sheet number, sheet count and date */
ScreenSch->SetModify();
ScreenList.UpdateSheetNumberAndDate();
/* First pass: Component counting */ /* First pass: Component counting */
screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen; sheet = m_Parent->GetSheet();
if( AnnotProject == true ) if( AnnotProject == true ){
{
NbOfCmp = 0; NbOfCmp = 0;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ NbOfCmp += ListeComposants( NULL, sheet );
NbOfCmp += ListeComposants( NULL, screen, screen->m_SheetNumber );
}
} }
else else
NbOfCmp = ListeComposants( NULL, screen, screen->m_SheetNumber ); NbOfCmp = ListeComposants( NULL, sheet );
if( NbOfCmp == 0 ) if( NbOfCmp == 0 )
return; return;
ii = sizeof(CmpListStruct) * NbOfCmp; BaseListeCmp = AllocateCmpListStrct(NbOfCmp);
BaseListeCmp = (CmpListStruct*) MyZMalloc( ii );
/* Second pass : Int data tables */ /* Second pass : Int data tables */
screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen;
if( AnnotProject == true ) if( AnnotProject == true )
{ {
ii = 0; ii = 0;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ ii += ListeComposants( BaseListeCmp + ii, sheet);
ii += ListeComposants( BaseListeCmp + ii,
screen, screen->m_SheetNumber );
}
} }
else else
ii = ListeComposants( BaseListeCmp, screen, screen->m_SheetNumber ); ii = ListeComposants( BaseListeCmp, sheet);
if( ii != NbOfCmp ) if( ii != NbOfCmp )
DisplayError( this, wxT( "Internal error in AnnotateComponents()" ) ); DisplayError( this, wxT( "Internal error in AnnotateComponents()" ) );
@ -177,33 +182,23 @@ void WinEDA_AnnotateFrame::DeleteAnnotation( wxCommandEvent& event )
* Update sheet number and number of sheets * Update sheet number and number of sheets
*/ */
{ {
int NbSheet; DrawSheetStruct* sheet;
SCH_SCREEN* screen; //EDA_SchComponentStruct* DrawLibItem;
EDA_SchComponentStruct* DrawLibItem;
if( !IsOK( this, _( "Previous Annotation will be deleted. Continue ?" ) ) ) if( !IsOK( this, _( "Previous Annotation will be deleted. Continue ?" ) ) ){
{ m_Abort = true;
m_Abort = true; return; return;
} }
AnnotProject = (m_AnnotProjetCtrl->GetSelection() == 0) ? true : FALSE; AnnotProject = (m_AnnotProjetCtrl->GetSelection() == 0) ? true : FALSE;
m_Abort = FALSE; m_Abort = FALSE;
/* Build the screen list */
EDA_ScreenList ScreenList( NULL );
NbSheet = ScreenList.GetCount();
/* Update the sheet number, sheet count and date */
ScreenList.UpdateSheetNumberAndDate();
ScreenSch->SetModify();
if( AnnotProject == true ) if( AnnotProject == true )
screen = ScreenList.GetFirst(); sheet = g_RootSheet;
else else
screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen; sheet = m_Parent->GetSheet()->Last();
sheet->DeleteAnnotation( AnnotProject );
/*
for( ; screen != NULL; screen = ScreenList.GetNext() ) for( ; screen != NULL; screen = ScreenList.GetNext() )
{ {
EDA_BaseStruct* DrawList = screen->EEDrawList; EDA_BaseStruct* DrawList = screen->EEDrawList;
@ -219,26 +214,26 @@ void WinEDA_AnnotateFrame::DeleteAnnotation( wxCommandEvent& event )
if( !AnnotProject ) if( !AnnotProject )
break; break;
} }
*/
g_RootSheet->m_s->SetModify();
m_Parent->DrawPanel->Refresh( true ); m_Parent->DrawPanel->Refresh( true );
EndModal( 0 ); //EndModal( 0 );
} }
/************************************************************************************/ /************************************************************************************/
int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumSheet ) int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet)
/***********************************************************************************/ /***********************************************************************************/
/* if BaseListeCmp == NULL : Components counting /* if BaseListeCmp == NULL : count components
* else update data table BaseListeCmp * else update data table BaseListeCmp
*/ */
{ {
int NbrCmp = 0; int NbrCmp = 0;
EDA_BaseStruct* DrawList = screen->EEDrawList; EDA_BaseStruct* DrawList = sheet->LastDrawList();
EDA_SchComponentStruct* DrawLibItem; EDA_SchComponentStruct* DrawLibItem;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
DrawList = screen->EEDrawList;
for( ; DrawList; DrawList = DrawList->Pnext ) for( ; DrawList; DrawList = DrawList->Pnext )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
@ -248,6 +243,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumShe
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
@ -266,16 +262,16 @@ int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumShe
BaseListeCmp[NbrCmp].m_NbParts = Entry->m_UnitCount; BaseListeCmp[NbrCmp].m_NbParts = Entry->m_UnitCount;
BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->m_Multi; BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->m_Multi;
BaseListeCmp[NbrCmp].m_PartsLocked = Entry->m_UnitSelectionLocked; BaseListeCmp[NbrCmp].m_PartsLocked = Entry->m_UnitSelectionLocked;
BaseListeCmp[NbrCmp].m_Sheet = NumSheet; BaseListeCmp[NbrCmp].m_SheetList = *sheet;
BaseListeCmp[NbrCmp].m_IsNew = FALSE; BaseListeCmp[NbrCmp].m_IsNew = FALSE;
BaseListeCmp[NbrCmp].m_Pos = DrawLibItem->m_Pos; BaseListeCmp[NbrCmp].m_Pos = DrawLibItem->m_Pos;
BaseListeCmp[NbrCmp].m_TimeStamp = DrawLibItem->m_TimeStamp; BaseListeCmp[NbrCmp].m_TimeStamp = DrawLibItem->m_TimeStamp;
if( DrawLibItem->m_Field[REFERENCE].m_Text.IsEmpty() ) if( DrawLibItem->GetRef(sheet).IsEmpty() )
DrawLibItem->m_Field[REFERENCE].m_Text = wxT( "DefRef?" ); DrawLibItem->SetRef( sheet, wxT( "DefRef?" ) );
strncpy( BaseListeCmp[NbrCmp].m_TextRef, strncpy( BaseListeCmp[NbrCmp].m_TextRef,
CONV_TO_UTF8( DrawLibItem->m_Field[REFERENCE].m_Text ), 32 ); CONV_TO_UTF8(DrawLibItem->GetRef(sheet)), 32 );
BaseListeCmp[NbrCmp].m_NumRef = -1; BaseListeCmp[NbrCmp].m_NumRef = -1;
@ -326,7 +322,7 @@ int AnnotTriComposant( const void* o1, const void* o2 )
if( SortByPosition == true ) if( SortByPosition == true )
{ {
if( ii == 0 ) if( ii == 0 )
ii = Objet1->m_Sheet - Objet2->m_Sheet; ii = Objet1->m_SheetList.Cmp(Objet2->m_SheetList);
if( ii == 0 ) if( ii == 0 )
ii = Objet1->m_Pos.x - Objet2->m_Pos.x; ii = Objet1->m_Pos.x - Objet2->m_Pos.x;
if( ii == 0 ) if( ii == 0 )
@ -339,7 +335,7 @@ int AnnotTriComposant( const void* o1, const void* o2 )
if( ii == 0 ) if( ii == 0 )
ii = Objet1->m_Unit - Objet2->m_Unit; ii = Objet1->m_Unit - Objet2->m_Unit;
if( ii == 0 ) if( ii == 0 )
ii = Objet1->m_Sheet - Objet2->m_Sheet; ii = Objet1->m_SheetList.Cmp(Objet2->m_SheetList);
if( ii == 0 ) if( ii == 0 )
ii = Objet1->m_Pos.x - Objet2->m_Pos.x; ii = Objet1->m_Pos.x - Objet2->m_Pos.x;
if( ii == 0 ) if( ii == 0 )
@ -375,11 +371,8 @@ static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp )
else else
sprintf( Text + strlen( Text ), "%d", BaseListeCmp[ii].m_NumRef ); sprintf( Text + strlen( Text ), "%d", BaseListeCmp[ii].m_NumRef );
DrawLibItem->m_Field[REFERENCE].m_Text = CONV_FROM_UTF8( Text ); DrawLibItem->SetRef(&(BaseListeCmp[ii].m_SheetList), CONV_FROM_UTF8( Text ) );
DrawLibItem->m_Multi = BaseListeCmp[ii].m_Unit; DrawLibItem->m_Multi = BaseListeCmp[ii].m_Unit;
DrawLibItem->m_RefIdNumber = BaseListeCmp[ii].m_NumRef;
if( DrawLibItem->m_RefIdNumber < 0 )
DrawLibItem->m_RefIdNumber = 0;
} }
} }
@ -432,6 +425,9 @@ void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp )
break; break;
} }
} }
/*printf("BreakReference(): %s number found: %d\n",
BaseListeCmp[ii].m_TextRef,
BaseListeCmp[ii].m_NumRef); */
} }
} }
@ -618,33 +614,26 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
* false = search in whole hierarchy (usual search). * false = search in whole hierarchy (usual search).
*/ */
{ {
int NbSheet, ii, NumSheet = 1, error, NbOfCmp; int ii, error, NbOfCmp;
SCH_SCREEN* screen; DrawSheetList* sheet;
CmpListStruct* ListeCmp = NULL; CmpListStruct* ListeCmp = NULL;
wxString Buff; wxString Buff;
wxString msg, cmpref; wxString msg, cmpref;
/* build the screen list */ /* build the screen list */
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
NbSheet = ScreenList.GetCount(); g_RootSheet->m_s->SetModify();
ii = 0;
/* Update the sheet number, sheet count and date */
ScreenSch->SetModify();
ScreenList.UpdateSheetNumberAndDate();
/* first pass : count composents */ /* first pass : count composents */
screen = (SCH_SCREEN*) frame->m_CurrentScreen; if( !OneSheetOnly ){
if( !OneSheetOnly )
{
NbOfCmp = 0; NbOfCmp = 0;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ NbOfCmp += ListeComposants( NULL, sheet );
NbOfCmp += ListeComposants( NULL, screen, NumSheet );
}
} }
else else
NbOfCmp = ListeComposants( NULL, screen, NumSheet ); NbOfCmp = ListeComposants( NULL, frame->GetSheet() );
if( NbOfCmp == 0 ) if( NbOfCmp == 0 )
{ {
@ -654,23 +643,18 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
/* Second pass : create the list of components */ /* Second pass : create the list of components */
ii = sizeof(CmpListStruct) * NbOfCmp; ListeCmp = AllocateCmpListStrct(NbOfCmp);
ListeCmp = (CmpListStruct*) MyZMalloc( ii );
if( OneSheetOnly == 0 ) printf("CheckAnnotate() listing all components:\n");
{ if( !OneSheetOnly ){
ii = 0; ii = 0;
screen = ScreenSch; for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) ii += ListeComposants( ListeCmp + ii, sheet );
{
ii += ListeComposants( ListeCmp + ii, screen, NumSheet );
}
} }
else else
{ ListeComposants( ListeCmp, frame->GetSheet() );
screen = (SCH_SCREEN*) frame->m_CurrentScreen;
ListeComposants( ListeCmp, screen, NumSheet ); printf("CheckAnnotate() done:\n");
}
qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotTriComposant ); qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotTriComposant );
@ -782,7 +766,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
error++; error++;
} }
/* Error if values are différent between units, for the same reference */ /* Error if values are diff<EFBFBD>rent between units, for the same reference */
if( stricmp( ListeCmp[ii].m_TextValue, ListeCmp[ii + 1].m_TextValue ) != 0 ) if( stricmp( ListeCmp[ii].m_TextValue, ListeCmp[ii + 1].m_TextValue ) != 0 )
{ {
wxString nextcmpref, cmpvalue, nextcmpvalue; wxString nextcmpref, cmpvalue, nextcmpvalue;

View File

@ -201,7 +201,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
* retourne : * retourne :
* 0 si aucun composant selectionne * 0 si aucun composant selectionne
* 1 sinon * 1 sinon
* -1 si commande terminée et composants trouvés (block delete, block save) * -1 si commande termin<EFBFBD>e et composants trouv<EFBFBD>s (block delete, block save)
*/ */
{ {
int ii = 0; int ii = 0;
@ -232,18 +232,18 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
break; break;
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
BreakSegmentOnJunction( GetScreen() ); BreakSegmentOnJunction( (SCH_SCREEN*)GetScreen() );
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
block->m_BlockDrawStruct = block->m_BlockDrawStruct =
PickStruct( GetScreen()->BlockLocate, GetScreen()->EEDrawList, SEARCHALL ); PickStruct( GetScreen()->BlockLocate, GetScreen(), SEARCHALL );
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
ii = 1; ii = 1;
CollectStructsToDrag( GetScreen() ); CollectStructsToDrag( (SCH_SCREEN*)GetScreen() );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
@ -260,7 +260,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
block->m_BlockDrawStruct = block->m_BlockDrawStruct =
PickStruct( GetScreen()->BlockLocate, PickStruct( GetScreen()->BlockLocate,
GetScreen()->EEDrawList, SEARCHALL ); GetScreen(), SEARCHALL );
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE ); DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
@ -275,7 +275,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE: /* Save */
block->m_BlockDrawStruct = block->m_BlockDrawStruct =
PickStruct( GetScreen()->BlockLocate, PickStruct( GetScreen()->BlockLocate,
GetScreen()->EEDrawList, SEARCHALL ); GetScreen(), SEARCHALL );
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE ); DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
@ -379,14 +379,14 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
} }
block->m_BlockDrawStruct = NULL; block->m_BlockDrawStruct = NULL;
} }
BreakSegmentOnJunction( GetScreen() ); BreakSegmentOnJunction( (SCH_SCREEN*)GetScreen() );
block->m_BlockDrawStruct = block->m_BlockDrawStruct =
PickStruct( GetScreen()->BlockLocate, PickStruct( GetScreen()->BlockLocate,
GetScreen()->EEDrawList, SEARCHALL ); GetScreen(), SEARCHALL );
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
ii = 1; ii = 1;
CollectStructsToDrag( GetScreen() ); CollectStructsToDrag( (SCH_SCREEN*)GetScreen() );
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
block->m_State = STATE_BLOCK_MOVE; block->m_State = STATE_BLOCK_MOVE;
@ -685,10 +685,10 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
DrawText->m_Pos.x = px.x; DrawText->m_Pos.x = px.x;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
// Text is not really mirrored: Orientation is changed // Text is not really mirrored: Orientation is changed
DrawText = (DrawGlobalLabelStruct*) DrawStruct; DrawText = (DrawLabelStruct*) DrawStruct;
if( DrawText->m_Orient == 0 ) /* horizontal text */ if( DrawText->m_Orient == 0 ) /* horizontal text */
DrawText->m_Orient = 2; DrawText->m_Orient = 2;
else if( DrawText->m_Orient == 2 ) /* invert horizontal text*/ else if( DrawText->m_Orient == 2 ) /* invert horizontal text*/
@ -831,14 +831,14 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
{ {
//DuplicateStruct calls GenCopy, which should handle
//m_s and m_sRefCount properly.
DrawSheetStruct* sheet = (DrawSheetStruct*) Struct; DrawSheetStruct* sheet = (DrawSheetStruct*) Struct;
sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetTimeStamp();
sheet->m_UndoList = NULL; //sheet->m_s->m_UndoList = NULL;
sheet->m_RedoList = NULL; //sheet->m_s->m_RedoList = NULL;
sheet->EEDrawList = NULL; //keep m_s pointer & associated.
sheet->m_Son = NULL; //sheet->m_Son = NULL; m_son is involved in undo and redo.
sheet->m_SheetName.Printf( wxT( "%8.8lX" ), sheet->m_TimeStamp );
sheet->m_FileName = sheet->m_SheetName + wxT( ".sch" );
break; break;
} }
@ -871,6 +871,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
case DRAW_PICK_ITEM_STRUCT_TYPE: case DRAW_PICK_ITEM_STRUCT_TYPE:
case DRAW_MARKER_STRUCT_TYPE: case DRAW_MARKER_STRUCT_TYPE:
@ -882,12 +883,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
{ {
DrawSheetStruct* sheet = (DrawSheetStruct*) NewDrawStruct; DrawSheetStruct* sheet = (DrawSheetStruct*) NewDrawStruct;
sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetTimeStamp();
sheet->m_UndoList = NULL;
sheet->m_RedoList = NULL;
sheet->EEDrawList = NULL;
sheet->m_Son = NULL; sheet->m_Son = NULL;
sheet->m_SheetName.Printf( wxT( "%8.8lX" ), sheet->m_TimeStamp );
sheet->m_FileName = sheet->m_SheetName + wxT( ".sch" );
break; break;
} }
@ -964,6 +960,11 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); RedrawOneStruct( panel, DC, DrawStruct, g_XorMode );
/* Unlink the structure */ /* Unlink the structure */
DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link
if(DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE){
SAFE_DELETE(DrawStruct);
//no undo/redo for this (for now), it is on both the EEDrawList and m_SubSheet arrays,
//hence the undo logic would have to be extended for this.
}else
frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); frame->SaveCopyInUndoList( DrawStruct, IS_DELETED );
} }
} }
@ -1117,6 +1118,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct )
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
@ -1219,9 +1221,10 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector )
DrawLabel->m_Pos += move_vector; DrawLabel->m_Pos += move_vector;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
#define DrawGlobalLabel ( (DrawGlobalLabelStruct*) DrawStruct ) #define DrawGHLabel ( (DrawLabelStruct*) DrawStruct )
DrawGlobalLabel->m_Pos += move_vector; DrawGHLabel->m_Pos += move_vector;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
@ -1310,6 +1313,10 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
NewDrawStruct = ( (DrawLabelStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (DrawLabelStruct*) DrawStruct )->GenCopy();
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
NewDrawStruct = ( (DrawHierLabelStruct*) DrawStruct )->GenCopy();
break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
NewDrawStruct = ( (DrawGlobalLabelStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (DrawGlobalLabelStruct*) DrawStruct )->GenCopy();
break; break;
@ -1577,9 +1584,10 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
Struct->m_Flags |= SELECTED; Struct->m_Flags |= SELECTED;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) Struct ) #define STRUCT ( (DrawLabelStruct*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
break; /* Already in list */ break; /* Already in list */
if( STRUCT->m_Pos != position ) if( STRUCT->m_Pos != position )

View File

@ -140,8 +140,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
if( !newsegment ) /* first point : Create first wire ou bus */ if( !newsegment ) /* first point : Create first wire ou bus */
{ {
s_ConnexionStartPoint = cursorpos; s_ConnexionStartPoint = cursorpos;
s_OldWiresList = GetScreen()->ExtractWires( TRUE ); s_OldWiresList = ((SCH_SCREEN*)GetScreen())->ExtractWires( TRUE );
GetScreen()->SchematicCleanUp( NULL ); ((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL );
switch( type ) switch( type )
{ {
@ -191,8 +191,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
/* Creation du segment suivant ou fin de tracé si point sur pin, jonction ...*/ /* Creation du segment suivant ou fin de trac<EFBFBD> si point sur pin, jonction ...*/
if( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->m_Layer ) ) if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->m_Layer ) )
{ {
EndSegment( DC ); return; EndSegment( DC ); return;
} }
@ -299,7 +299,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
alt_end_point = lastsegment->m_Start; alt_end_point = lastsegment->m_Start;
} }
GetScreen()->SchematicCleanUp( NULL ); ((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL );
/* clear flags and find last segment entered, for repeat function */ /* clear flags and find last segment entered, for repeat function */
segment = (EDA_DrawLineStruct*) GetScreen()->EEDrawList; segment = (EDA_DrawLineStruct*) GetScreen()->EEDrawList;
@ -519,7 +519,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
Segment_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */ Segment_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */
} }
EraseStruct( GetScreen()->GetCurItem(), GetScreen() ); EraseStruct( GetScreen()->GetCurItem(), (SCH_SCREEN*)GetScreen() );
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
} }
@ -662,6 +662,16 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (DrawHierLabelStruct*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
/*** Increment du numero de label ***/
IncrementLabelMember( STRUCT->m_Text );
break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) g_ItemToRepeat ) #define STRUCT ( (DrawGlobalLabelStruct*) g_ItemToRepeat )
@ -695,9 +705,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
// Create the duplicate component, position = mouse cursor // Create the duplicate component, position = mouse cursor
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
new_pos.x = m_CurrentScreen->m_Curseur.x - STRUCT->m_Pos.x; new_pos.x = GetScreen()->m_Curseur.x - STRUCT->m_Pos.x;
new_pos.y = m_CurrentScreen->m_Curseur.y - STRUCT->m_Pos.y; new_pos.y = GetScreen()->m_Curseur.y - STRUCT->m_Pos.y;
STRUCT->m_Pos = m_CurrentScreen->m_Curseur; STRUCT->m_Pos = GetScreen()->m_Curseur;
STRUCT->m_Flags = IS_NEW; STRUCT->m_Flags = IS_NEW;
STRUCT->m_TimeStamp = GetTimeStamp(); STRUCT->m_TimeStamp = GetTimeStamp();
for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
@ -770,10 +780,10 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
* - type WIRE, si il y a * - type WIRE, si il y a
* - une jonction * - une jonction
* - ou une pin * - ou une pin
* - ou une extrémité unique de fil * - ou une extr<EFBFBD>mit<EFBFBD> unique de fil
* *
* - type BUS, si il y a * - type BUS, si il y a
* - ou une extrémité unique de BUS * - ou une extr<EFBFBD>mit<EFBFBD> unique de BUS
*/ */
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;
@ -785,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
switch( layer ) switch( layer )
{ {
case LAYER_BUS: case LAYER_BUS:
item = PickStruct( pos, screen->EEDrawList, BUSITEM ); item = PickStruct( pos, screen, BUSITEM );
if( item ) if( item )
return TRUE; return TRUE;
pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList ); pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList );
@ -798,13 +808,13 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
break; break;
case LAYER_NOTES: case LAYER_NOTES:
item = PickStruct( pos, screen->EEDrawList, DRAWITEM ); item = PickStruct( pos, screen, DRAWITEM );
if( item ) if( item )
return TRUE; return TRUE;
break; break;
case LAYER_WIRE: case LAYER_WIRE:
item = PickStruct( pos, screen->EEDrawList, RACCORDITEM | JUNCTIONITEM ); item = PickStruct( pos, screen, RACCORDITEM | JUNCTIONITEM );
if( item ) if( item )
return TRUE; return TRUE;
@ -820,17 +830,17 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
return TRUE; return TRUE;
} }
item = PickStruct( pos, screen->EEDrawList, WIREITEM ); item = PickStruct( pos, screen, WIREITEM );
if( item ) if( item )
return TRUE; return TRUE;
item = PickStruct( pos, screen->EEDrawList, LABELITEM ); item = PickStruct( pos, screen, LABELITEM );
if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE) if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE)
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x ) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x )
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) ) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) )
return TRUE; return TRUE;
pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList ); pinsheet = LocateAnyPinSheet( pos, screen );
if( pinsheet && !IsBusLabel( pinsheet->m_Text ) ) if( pinsheet && !IsBusLabel( pinsheet->m_Text ) )
{ {
itempos = pinsheet->m_Pos; itempos = pinsheet->m_Pos;
@ -861,14 +871,14 @@ bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos )
* - a pin is on location pos * - a pin is on location pos
*/ */
{ {
if( PickStruct( pos, frame->GetScreen()->EEDrawList, JUNCTIONITEM ) ) if( PickStruct( pos, frame->GetScreen(), JUNCTIONITEM ) )
return FALSE; return FALSE;
if( PickStruct( pos, frame->GetScreen()->EEDrawList, WIREITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) ) if( PickStruct( pos, frame->GetScreen(), WIREITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) )
{ {
if( PickStruct( pos, frame->GetScreen()->EEDrawList, WIREITEM | WIRE_BUS_ENDPOINTS_ONLY ) ) if( PickStruct( pos, frame->GetScreen(), WIREITEM | WIRE_BUS_ENDPOINTS_ONLY ) )
return TRUE; return TRUE;
if( frame->LocatePinEnd( frame->GetScreen()->EEDrawList, pos ) ) if( frame->LocatePinEnd( frame->GetScreen(), pos ) )
return TRUE; return TRUE;
} }

View File

@ -0,0 +1,625 @@
/////////////////////////////////////////////////////////////////////////////
// Name: DrawSheet.cpp
// Purpose: member functions for DrawSheetStruct and DrawSheetLabelStruct
// header = class_screen.h
// Author: jean-pierre Charras
// Modified by:
// Created: 08/02/2006 18:37:02
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "protos.h"
/***********************************************************/
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
EDA_BaseStruct( DRAW_SHEET_STRUCT_TYPE )
/***********************************************************/
{
m_Label = NULL;
m_NbLabel = 0;
m_Layer = LAYER_SHEET;
m_Pos = pos;
m_SheetNameSize = m_FileNameSize = 60;
m_s = NULL;
m_SheetName = wxT("Root");
m_FileName = wxT(" ");
}
/**************************************/
DrawSheetStruct::~DrawSheetStruct()
/**************************************/
{
DrawSheetLabelStruct* label = m_Label, * next_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;
}
}
/***********************************************/
DrawSheetStruct* DrawSheetStruct::GenCopy()
/***********************************************/
/* creates a copy of a sheet
* The linked data itself (EEDrawList) is not duplicated
*/
{
DrawSheetStruct* newitem = new DrawSheetStruct( m_Pos );
newitem->m_Size = m_Size;
newitem->m_Parent = m_Parent;
newitem->m_TimeStamp = GetTimeStamp();
newitem->m_FileName = m_FileName;
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;
if( label )
{
Slabel = newitem->m_Label = label->GenCopy();
Slabel->m_Parent = newitem;
label = (DrawSheetLabelStruct*) label->Pnext;
}
while( label )
{
Slabel->Pnext = label->GenCopy();
Slabel = (DrawSheetLabelStruct*) Slabel->Pnext;
Slabel->m_Parent = newitem;
label = (DrawSheetLabelStruct*) label->Pnext;
}
/* don't copy screen data - just reference it. */
newitem->m_s = m_s;
if(m_s)
m_s->m_RefCount++;
return newitem;
}
/**********************************************************/
void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
/**********************************************************/
/* Used if undo / redo command:
* swap data between this and copyitem
*/
{
EXCHG( m_Pos, copyitem->m_Pos );
EXCHG( m_Size, copyitem->m_Size );
EXCHG( m_SheetName, copyitem->m_SheetName );
EXCHG( m_SheetNameSize, copyitem->m_SheetNameSize );
EXCHG( m_FileNameSize, copyitem->m_FileNameSize );
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;
}
}
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
*/
{
DrawSheetLabelStruct* Pinsheet, * NextPinsheet;
if( !IsOK( frame, _( "Ok to cleanup this sheet" ) ) )
return;
Pinsheet = m_Label;
while( Pinsheet )
{
/* Search Glabel 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;
}
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 )
/**************************************************************************************/
/* Draw the hierarchical sheet shape */
{
DrawSheetLabelStruct* SheetLabelStruct;
int txtcolor;
wxString Text;
int color;
wxPoint pos = m_Pos + offset;
int LineWidth = g_DrawMinimunLineWidth;
if( Color >= 0 )
color = Color;
else
color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
GRRect( &panel->m_ClipBox, DC, pos.x, pos.y,
pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color );
/* Draw text : SheetName */
if( Color > 0 )
txtcolor = Color;
else
txtcolor = ReturnLayerColor( LAYER_SHEETNAME );
Text = wxT( "Sheet: " ) + m_SheetName;
DrawGraphicText( panel, DC,
wxPoint( pos.x, pos.y - 8 ), txtcolor,
Text, TEXT_ORIENT_HORIZ, wxSize( m_SheetNameSize, m_SheetNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
/* Draw text : FileName */
if( Color >= 0 )
txtcolor = Color;
else
txtcolor = ReturnLayerColor( LAYER_SHEETFILENAME );
Text = wxT( "File: " ) + m_FileName;
DrawGraphicText( panel, DC,
wxPoint( pos.x, pos.y + m_Size.y + 4 ),
txtcolor,
Text, TEXT_ORIENT_HORIZ, wxSize( m_FileNameSize, m_FileNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, LineWidth );
/* Draw text : SheetLabel */
SheetLabelStruct = m_Label;
while( SheetLabelStruct != NULL )
{
SheetLabelStruct->Draw( panel, DC, offset, DrawMode, Color );
SheetLabelStruct = (DrawSheetLabelStruct*) (SheetLabelStruct->Pnext);
}
}
/**************************************************************************************/
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;
}
/*******************************************************************************/
bool DrawSheetStruct::Load(WinEDA_SchematicFrame* frame)
/*******************************************************************************/
{
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);
if(!frame->LoadOneEEFile(m_s, m_FileName))
return false;
m_s->m_RefCount++;
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;
}
/*******************************************************************************/
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;
}
/************************/
/* DrawSheetLabelStruct */
/************************/
/*******************************************************************/
DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent,
const wxPoint& pos, const wxString& text ) :
EDA_BaseStruct( DRAW_SHEETLABEL_STRUCT_TYPE ),
EDA_TextStruct( text )
/*******************************************************************/
{
m_Layer = LAYER_SHEETLABEL;
m_Parent = parent;
m_Pos = pos;
m_Edge = 0;
m_Shape = NET_INPUT;
m_IsDangling = TRUE;
}
/***********************************************************/
DrawSheetLabelStruct* DrawSheetLabelStruct::GenCopy()
/***********************************************************/
{
DrawSheetLabelStruct* newitem =
new DrawSheetLabelStruct( (DrawSheetStruct*) m_Parent, m_Pos, m_Text );
newitem->m_Edge = m_Edge;
newitem->m_Shape = m_Shape;
return newitem;
}
/********************************************************************************************/
void DrawSheetLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
/********************************************************************************************/
/* Routine de dessin des Labels type hierarchie */
{
int side, txtcolor;
int posx, tposx, posy, size2;
wxSize size;
int NbSegm, coord[20];
int LineWidth = g_DrawMinimunLineWidth;
if( Color >= 0 )
txtcolor = Color;
else
txtcolor = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
posx = m_Pos.x + offset.x; posy = m_Pos.y + offset.y; size = m_Size;
if( !m_Text.IsEmpty() )
{
if( m_Edge )
{
tposx = posx - size.x;
side = GR_TEXT_HJUSTIFY_RIGHT;
}
else
{
tposx = posx + size.x + (size.x / 8);
side = GR_TEXT_HJUSTIFY_LEFT;
}
DrawGraphicText( panel, DC, wxPoint( tposx, posy ), txtcolor,
m_Text, TEXT_ORIENT_HORIZ, size,
side, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
}
/* dessin du symbole de connexion */
if( m_Edge )
{
size.x = -size.x;
size.y = -size.y;
}
coord[0] = posx; coord[1] = posy; size2 = size.x / 2;
NbSegm = 0;
switch( m_Shape )
{
case 0: /* input |> */
coord[2] = posx; coord[3] = posy - size2;
coord[4] = posx + size2; coord[5] = posy - size2;
coord[6] = posx + size.x; coord[7] = posy;
coord[8] = posx + size2; coord[9] = posy + size2;
coord[10] = posx; coord[11] = posy + size2;
coord[12] = coord[0]; coord[13] = coord[1];
NbSegm = 7;
break;
case 1: /* output <| */
coord[2] = posx + size2; coord[3] = posy - size2;
coord[4] = posx + size.x; coord[5] = posy - size2;
coord[6] = posx + size.x; coord[7] = posy + size2;
coord[8] = posx + size2; coord[9] = posy + size2;
coord[10] = coord[0]; coord[11] = coord[1];
NbSegm = 6;
break;
case 2: /* bidi <> */
case 3: /* TriSt <> */
coord[2] = posx + size2; coord[3] = posy - size2;
coord[4] = posx + size.x; coord[5] = posy;
coord[6] = posx + size2; coord[7] = posy + size2;
coord[8] = coord[0]; coord[9] = coord[1];
NbSegm = 5;
break;
default: /* unsp []*/
coord[2] = posx; coord[3] = posy - size2;
coord[4] = posx + size.x; coord[5] = posy - size2;
coord[6] = posx + size.x; coord[7] = posy + size2;
coord[8] = posx; coord[9] = posy + size2;
coord[10] = coord[0]; coord[11] = coord[1];
NbSegm = 6;
break;
}
int FillShape = FALSE;
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;
}
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;
}
SCH_SCREEN* DrawSheetList::LastScreen(){
if(m_numSheets)
return m_sheets[m_numSheets-1]->m_s;
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;
}
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;
}
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;
}
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){
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;
}

View File

@ -1,328 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sheet.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 08/02/2006 18:37:02
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "protos.h"
/***********************************************************/
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
SCH_SCREEN( SCHEMATIC_FRAME, DRAW_SHEET_STRUCT_TYPE )
/***********************************************************/
{
m_Label = NULL;
m_NbLabel = 0;
m_Layer = LAYER_SHEET;
m_Pos = pos;
m_SheetNameSize = m_FileNameSize = 60;
}
/**************************************/
DrawSheetStruct::~DrawSheetStruct()
/**************************************/
{
DrawSheetLabelStruct* label = m_Label, * next_label;
while( label )
{
next_label = (DrawSheetLabelStruct*) label->Pnext;
delete label;
label = next_label;
}
}
/***********************************************/
DrawSheetStruct* DrawSheetStruct::GenCopy()
/***********************************************/
/* creates a copy of a sheet
* The linked data itself (EEDrawList) is not duplicated
*/
{
DrawSheetStruct* newitem = new DrawSheetStruct( m_Pos );
DrawSheetLabelStruct* Slabel = NULL, * label = m_Label;
newitem->m_Size = m_Size;
newitem->m_Parent = m_Parent;
newitem->m_TimeStamp = GetTimeStamp();
newitem->m_FileName = m_FileName;
newitem->m_FileNameSize = m_FileNameSize;
newitem->m_SheetName = m_SheetName;
newitem->m_SheetNameSize = m_SheetNameSize;
if( label )
{
Slabel = newitem->m_Label = label->GenCopy();
Slabel->m_Parent = newitem;
label = (DrawSheetLabelStruct*) label->Pnext;
}
while( label )
{
Slabel->Pnext = label->GenCopy();
Slabel = (DrawSheetLabelStruct*) Slabel->Pnext;
Slabel->m_Parent = newitem;
label = (DrawSheetLabelStruct*) label->Pnext;
}
/* copy screen data */
newitem->m_DrawOrg = m_DrawOrg;
newitem->m_Curseur = m_Curseur;
newitem->m_MousePosition = m_MousePosition;
newitem->m_MousePositionInPixels = m_MousePositionInPixels;
newitem->m_O_Curseur = m_O_Curseur;
newitem->m_ScrollbarPos = m_ScrollbarPos;
newitem->m_ScrollbarNumber = m_ScrollbarNumber;
newitem->m_StartVisu = m_StartVisu;
newitem->m_FirstRedraw = m_FirstRedraw;
newitem->EEDrawList = EEDrawList; /* Object list (main data) for schematic */
newitem->m_UndoList = m_UndoList; /* Object list for the undo command (old data) */
newitem->m_RedoList = m_RedoList; /* Object list for the redo command (old data) */
newitem->m_CurrentSheet = m_CurrentSheet;
newitem->m_SheetNumber = m_SheetNumber;
newitem->m_NumberOfSheet = m_NumberOfSheet;
newitem->m_FileName = m_FileName;
newitem->m_Title = m_Title;
newitem->m_Date = m_Date;
newitem->m_Revision = m_Revision;
newitem->m_Company = m_Company;
newitem->m_Commentaire1 = m_Commentaire1;
newitem->m_Commentaire2 = m_Commentaire2;
newitem->m_Commentaire3 = m_Commentaire3;
newitem->m_Commentaire4 = m_Commentaire4;
return newitem;
}
/**********************************************************/
void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
/**********************************************************/
/* Used if undo / redo command:
* swap data between this and copyitem
*/
{
EXCHG( m_Pos, copyitem->m_Pos );
EXCHG( m_Size, copyitem->m_Size );
EXCHG( m_SheetName, copyitem->m_SheetName );
EXCHG( m_SheetNameSize, copyitem->m_SheetNameSize );
EXCHG( m_FileNameSize, copyitem->m_FileNameSize );
EXCHG( m_Label, copyitem->m_Label );
EXCHG( m_NbLabel, copyitem->m_NbLabel );
}
/**************************************************************************************/
void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
/**************************************************************************************/
/* Draw the hierarchical sheet shape */
{
DrawSheetLabelStruct* SheetLabelStruct;
int txtcolor;
wxString Text;
int color;
wxPoint pos = m_Pos + offset;
int LineWidth = g_DrawMinimunLineWidth;
if( Color >= 0 )
color = Color;
else
color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
GRRect( &panel->m_ClipBox, DC, pos.x, pos.y,
pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color );
/* Draw text : SheetName */
if( Color > 0 )
txtcolor = Color;
else
txtcolor = ReturnLayerColor( LAYER_SHEETNAME );
Text = wxT( "Sheet: " ) + m_SheetName;
DrawGraphicText( panel, DC,
wxPoint( pos.x, pos.y - 8 ), txtcolor,
Text, TEXT_ORIENT_HORIZ, wxSize( m_SheetNameSize, m_SheetNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
/* Draw text : FileName */
if( Color >= 0 )
txtcolor = Color;
else
txtcolor = ReturnLayerColor( LAYER_SHEETFILENAME );
Text = wxT( "File: " ) + m_FileName;
DrawGraphicText( panel, DC,
wxPoint( pos.x, pos.y + m_Size.y + 4 ),
txtcolor,
Text, TEXT_ORIENT_HORIZ, wxSize( m_FileNameSize, m_FileNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, LineWidth );
/* Draw text : SheetLabel */
SheetLabelStruct = m_Label;
while( SheetLabelStruct != NULL )
{
SheetLabelStruct->Draw( panel, DC, offset, DrawMode, Color );
SheetLabelStruct = (DrawSheetLabelStruct*) (SheetLabelStruct->Pnext);
}
}
/************************/
/* DrawSheetLabelStruct */
/************************/
/*******************************************************************/
DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent,
const wxPoint& pos, const wxString& text ) :
EDA_BaseStruct( DRAW_SHEETLABEL_STRUCT_TYPE ),
EDA_TextStruct( text )
/*******************************************************************/
{
m_Layer = LAYER_SHEETLABEL;
m_Parent = parent;
m_Pos = pos;
m_Edge = 0;
m_Shape = NET_INPUT;
m_IsDangling = TRUE;
}
/***********************************************************/
DrawSheetLabelStruct* DrawSheetLabelStruct::GenCopy()
/***********************************************************/
{
DrawSheetLabelStruct* newitem =
new DrawSheetLabelStruct( (DrawSheetStruct*) m_Parent, m_Pos, m_Text );
newitem->m_Edge = m_Edge;
newitem->m_Shape = m_Shape;
return newitem;
}
/********************************************************************************************/
void DrawSheetLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
/********************************************************************************************/
/* Routine de dessin des Labels type hierarchie */
{
int side, txtcolor;
int posx, tposx, posy, size2;
wxSize size;
int NbSegm, coord[20];
int LineWidth = g_DrawMinimunLineWidth;
if( Color >= 0 )
txtcolor = Color;
else
txtcolor = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
posx = m_Pos.x + offset.x; posy = m_Pos.y + offset.y; size = m_Size;
if( !m_Text.IsEmpty() )
{
if( m_Edge )
{
tposx = posx - size.x;
side = GR_TEXT_HJUSTIFY_RIGHT;
}
else
{
tposx = posx + size.x + (size.x / 8);
side = GR_TEXT_HJUSTIFY_LEFT;
}
DrawGraphicText( panel, DC, wxPoint( tposx, posy ), txtcolor,
m_Text, TEXT_ORIENT_HORIZ, size,
side, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
}
/* dessin du symbole de connexion */
if( m_Edge )
{
size.x = -size.x;
size.y = -size.y;
}
coord[0] = posx; coord[1] = posy; size2 = size.x / 2;
NbSegm = 0;
switch( m_Shape )
{
case 0: /* input |> */
coord[2] = posx; coord[3] = posy - size2;
coord[4] = posx + size2; coord[5] = posy - size2;
coord[6] = posx + size.x; coord[7] = posy;
coord[8] = posx + size2; coord[9] = posy + size2;
coord[10] = posx; coord[11] = posy + size2;
coord[12] = coord[0]; coord[13] = coord[1];
NbSegm = 7;
break;
case 1: /* output <| */
coord[2] = posx + size2; coord[3] = posy - size2;
coord[4] = posx + size.x; coord[5] = posy - size2;
coord[6] = posx + size.x; coord[7] = posy + size2;
coord[8] = posx + size2; coord[9] = posy + size2;
coord[10] = coord[0]; coord[11] = coord[1];
NbSegm = 6;
break;
case 2: /* bidi <> */
case 3: /* TriSt <> */
coord[2] = posx + size2; coord[3] = posy - size2;
coord[4] = posx + size.x; coord[5] = posy;
coord[6] = posx + size2; coord[7] = posy + size2;
coord[8] = coord[0]; coord[9] = coord[1];
NbSegm = 5;
break;
default: /* unsp []*/
coord[2] = posx; coord[3] = posy - size2;
coord[4] = posx + size.x; coord[5] = posy - size2;
coord[6] = posx + size.x; coord[7] = posy + size2;
coord[8] = posx; coord[9] = posy + size2;
coord[10] = coord[0]; coord[11] = coord[1];
NbSegm = 6;
break;
}
int FillShape = FALSE;
GRPoly( &panel->m_ClipBox, DC, NbSegm, coord, FillShape, LineWidth, txtcolor, txtcolor ); /* Poly Non rempli */
}

View File

@ -1,7 +1,3 @@
/**********************************************************/
/* EECLASS.CPP */
/* fonctions relatives aux classes definies dans EESCHEMA */
/**********************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -24,6 +20,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
@ -54,8 +51,9 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
{ {
if( m_Flags & IS_NEW ) if( m_Flags & IS_NEW )
{ {
Pnext = frame->m_CurrentScreen->EEDrawList; SCH_SCREEN* screen = (SCH_SCREEN*)frame->GetScreen();
frame->m_CurrentScreen->EEDrawList = this; if(!screen->CheckIfOnDrawList(this)) //don't want a loop!
screen->AddToDrawList(this);
g_ItemToRepeat = this; g_ItemToRepeat = this;
if( frame->m_Ident == SCHEMATIC_FRAME ) if( frame->m_Ident == SCHEMATIC_FRAME )
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_NEW ); ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_NEW );
@ -91,6 +89,9 @@ SCH_SCREEN::SCH_SCREEN( int screentype, KICAD_T aType ) :
SetZoomList( table_zoom ); SetZoomList( table_zoom );
SetGridList( g_GridList ); SetGridList( g_GridList );
m_UndoRedoCountMax = 10; m_UndoRedoCountMax = 10;
m_RefCount = 0;
m_ScreenNumber = 1;
m_NumberOfScreen = 1;
} }
@ -116,8 +117,9 @@ void SCH_SCREEN::FreeDrawList()
{ {
DrawStruct = EEDrawList; DrawStruct = EEDrawList;
EEDrawList = EEDrawList->Pnext; EEDrawList = EEDrawList->Pnext;
delete DrawStruct; SAFE_DELETE(DrawStruct);
} }
EEDrawList = NULL;
} }
@ -134,7 +136,7 @@ void SCH_SCREEN::RemoveFromDrawList( EDA_BaseStruct* DrawStruct )
else else
{ {
EDA_BaseStruct* DrawList = EEDrawList; EDA_BaseStruct* DrawList = EEDrawList;
while( DrawList->Pnext ) while( DrawList && DrawList->Pnext )
{ {
if( DrawList->Pnext == DrawStruct ) if( DrawList->Pnext == DrawStruct )
{ {
@ -145,181 +147,169 @@ 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;
}
/**************************************************************/
void SCH_SCREEN::AddToDrawList( EDA_BaseStruct* st )
/**************************************************************/
{ //simple function to add to the head of the drawlist.
st->Pnext = EEDrawList;
EEDrawList = st;
}
/*********************************************************************/ /*********************************************************************/
/* Class EDA_ScreenList to handle the list of screens in a hierarchy */ /* Class EDA_ScreenList to handle the list of screens in a hierarchy */
/*********************************************************************/ /*********************************************************************/
EDA_ScreenList::EDA_ScreenList( EDA_BaseStruct* DrawStruct )
/* create the list of screens (i.e hierarchycal sheets) found in DrawStruct
* if DrawStruct == NULL: start from root sheet and the root screen is included in list
*/
{
m_Count = 0;
m_List = NULL;
m_Index = 0;
/* Count the number of screens */
BuildScreenList( NULL, DrawStruct, &m_Count );
if( m_Count > NB_MAX_SHEET )
{
wxString msg;
msg.Printf( wxT( "ReturnScreenList: Error: screen count > %d" ), NB_MAX_SHEET );
DisplayError( NULL, msg );
}
m_List = (SCH_SCREEN**) MyZMalloc( sizeof(SCH_SCREEN *) * (m_Count + 2) );
/* Fill the list */
BuildScreenList( m_List, DrawStruct, &m_Count );
}
/*****************************************/
EDA_ScreenList::~EDA_ScreenList()
/*****************************************/
{
if( m_List )
free( m_List );
m_List = NULL;
}
/*****************************************/ /*****************************************/
SCH_SCREEN* EDA_ScreenList::GetFirst() SCH_SCREEN* EDA_ScreenList::GetFirst()
/*****************************************/ /*****************************************/
{ {
m_Index = 0; m_Index = 0;
if( m_List ) if(m_List.GetCount() > 0)
return *m_List; return m_List[0];
else
return NULL; return NULL;
} }
/*****************************************/ /*****************************************/
SCH_SCREEN* EDA_ScreenList::GetNext() SCH_SCREEN* EDA_ScreenList::GetNext()
/*****************************************/ /*****************************************/
{ {
if( m_Index < m_Count ) if( m_Index < m_List.GetCount() )
m_Index++; m_Index++;
return GetScreen(m_Index);
if( (m_Index < m_Count) && m_List )
{
return m_List[m_Index];
}
else
return NULL;
} }
/************************************************/ /************************************************/
SCH_SCREEN* EDA_ScreenList::GetScreen( int index ) SCH_SCREEN* EDA_ScreenList::GetScreen( unsigned int index )
/************************************************/ /************************************************/
/* return the m_List[index] item /* return the m_List[index] item
*/ */
{ {
SCH_SCREEN* screen = NULL; if( index < m_List.GetCount() )
return m_List[index];
if( (index >= 0) && index < m_Count ) return NULL;
screen = m_List[index];
return screen;
} }
/************************************************/
void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen )
/**************************************************/ /************************************************/
void EDA_ScreenList::UpdateSheetNumberAndDate() {
/**************************************************/ if(testscreen == NULL) return;
for(unsigned int i=0; i< m_List.GetCount(); i++){
/* Update the sheet number, the sheet count and the date for all sheets in list 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());
#endif
}
/************************************************/
void EDA_ScreenList::UpdateScreenNumberAndDate( )
/************************************************/
{ {
int SheetNumber = 1;
SCH_SCREEN* screen; SCH_SCREEN* screen;
wxString sheet_date = GenDate();
for( screen = GetFirst(); screen != NULL; screen = GetNext() ) wxString date = GenDate();
{ for(int i=0; i<(int)m_List.GetCount(); i++){
screen->m_SheetNumber = SheetNumber++; /* Update the sheet number */ screen = m_List[i];
screen->m_NumberOfSheet = m_Count; /* Update the number of sheets */ screen->m_ScreenNumber = i;
screen->m_Date = sheet_date; /* Update the sheet date */ screen->m_NumberOfScreen = m_List.GetCount();
screen->m_Date = date;
} }
} }
/************************************************************************/ /************************************************************************/
SCH_SCREEN** EDA_ScreenList::BuildScreenList( SCH_SCREEN** ScreenList, void EDA_ScreenList::BuildScreenList(EDA_BaseStruct* s)
EDA_BaseStruct* DrawStruct, int* Count )
/************************************************************************/ /************************************************************************/
{
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;
}
}
}
/*********************************************************************/
/* Class EDA_SheetList to handle the list of Sheets in a hierarchy */
/*********************************************************************/
/* Count the Hierachical sheet number (ScreenList == NULL ) /*****************************************/
* or fill the screen pointer buffer (ScreenList != NULL ) DrawSheetList* EDA_SheetList::GetFirst()
* If DrawStruct = NULL, search starts from Root screen, and puts root screen in list /*****************************************/
* Recursive function ! {
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);
}
/************************************************/
DrawSheetList* EDA_SheetList::GetSheet(int index )
/************************************************/
/* return the m_List[index] item
*/ */
{ {
bool HasSubhierarchy = FALSE; if( index < m_count )
EDA_BaseStruct* CurrStruct; return &(m_List[index]);
return NULL;
if( *Count > NB_MAX_SHEET ) }
{
return ScreenList; /************************************************************************/
} void EDA_SheetList::BuildSheetList(DrawSheetStruct* sheet)
/************************************************************************/
/* Read the current list and put Screen pointers in list */ {
if( DrawStruct == NULL ) if(m_List == NULL){
{ int count = sheet->CountSheets();
DrawStruct = ScreenSch->EEDrawList; m_count = count;
if( ScreenList ) m_index = 0;
{ if(m_List) free(m_List); m_List = NULL;
*ScreenList = ScreenSch; count *= sizeof(DrawSheetList);
ScreenList++; m_List = (DrawSheetList*)MyZMalloc(count);
} memset((void*)m_List, 0, count);
else m_currList.Clear();
(*Count)++; }
} m_currList.Push(sheet);
m_List[m_index] = m_currList;
CurrStruct = DrawStruct; m_index++;
while( CurrStruct ) if(sheet->m_s != NULL){
{ EDA_BaseStruct* strct = m_currList.LastDrawList();
if( CurrStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) while(strct){
{ if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
HasSubhierarchy = TRUE; DrawSheetStruct* sht = (DrawSheetStruct*)strct;
if( ScreenList ) BuildSheetList(sht);
{ }
*ScreenList = (SCH_SCREEN*) CurrStruct; strct = strct->Pnext;
ScreenList++; }
} }
else m_currList.Pop();
(*Count)++;
}
CurrStruct = CurrStruct->Pnext;
}
if( !HasSubhierarchy )
return ScreenList;
/* Read the Sub Hierarchies */
CurrStruct = DrawStruct;
while( CurrStruct )
{
if( CurrStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
SCH_SCREEN* Screen = (SCH_SCREEN*) CurrStruct;
/* Go to Subhierachy if needed
* (warning: BuildScreenList must not called with a NULL parameter
* for DrawStruct, because BuildScreenList restart from the root screen
* when DrawStruct == NULL */
if( Screen->EEDrawList )
ScreenList = BuildScreenList( ScreenList, Screen->EEDrawList, Count );
}
CurrStruct = CurrStruct->Pnext;
}
return ScreenList;
} }

View File

@ -83,11 +83,16 @@ extern int* TemplateShape[5][4];
/* Forward declarations */ /* Forward declarations */
class DrawSheetStruct; class DrawSheetStruct;
extern DrawSheetStruct* g_RootSheet;
class SCH_SCREEN : public BASE_SCREEN class SCH_SCREEN : public BASE_SCREEN
{ {
public: public:
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( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
~SCH_SCREEN(); ~SCH_SCREEN();
@ -100,6 +105,8 @@ public:
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */ void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */
bool CheckIfOnDrawList( EDA_BaseStruct* st );
void AddToDrawList( EDA_BaseStruct* DrawStruct );
void ClearUndoORRedoList( EDA_BaseStruct* List ); void ClearUndoORRedoList( EDA_BaseStruct* List );
bool SchematicCleanUp( wxDC* DC = NULL ); bool SchematicCleanUp( wxDC* DC = NULL );
@ -117,7 +124,7 @@ class DrawSheetLabelStruct : public EDA_BaseStruct, public EDA_TextStruct
public: public:
int m_Layer; int m_Layer;
int m_Edge, m_Shape; int m_Edge, m_Shape;
bool m_IsDangling; // TRUE si non connecté bool m_IsDangling; // TRUE si non connect<EFBFBD>
public: public:
DrawSheetLabelStruct( DrawSheetStruct* parent, DrawSheetLabelStruct( DrawSheetStruct* parent,
@ -140,20 +147,25 @@ public:
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
WX_DEFINE_ARRAY( DrawSheetStruct*, SheetGrowArray );
class DrawSheetStruct : public SCH_SCREEN /* Gestion de la hierarchie */ class DrawSheetStruct : public EDA_BaseStruct /*public SCH_SCREEN*/ /* Gestion de la hierarchie */
{ {
public: public:
wxString m_SheetName; 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_SheetNameSize;
// wxString m_FileName; in SCH_SCREEN
int m_FileNameSize; int m_FileNameSize;
wxPoint m_Pos; wxPoint m_Pos;
wxSize m_Size; /* Position and Size of sheet symbol */ wxSize m_Size; /* Position and Size of sheet symbol */
int m_Layer; int m_Layer;
DrawSheetLabelStruct* m_Label; /* Points de connection */ DrawSheetLabelStruct* m_Label; /* Points de connection, linked list.*/
int m_NbLabel; /* Nombre de points de connexion */ int m_NbLabel; /* Nombre de points de connexion */
SCH_SCREEN* m_s;
public: public:
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
@ -170,29 +182,94 @@ public:
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
void SwapData( DrawSheetStruct* copyitem ); 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.
}; };
#define DSLSZ 32
class DrawSheetList
{
public:
int m_numSheets;
DrawSheetStruct* m_sheets[DSLSZ];
/* Class to handle the list of screens in a hierarchy */ 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;
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 );
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 );
class EDA_ScreenList class EDA_ScreenList
{ {
private: private:
int m_Count; ScreenGrowArray m_List;
SCH_SCREEN** m_List; unsigned int m_Index;
int m_Index;
public: public:
EDA_ScreenList( EDA_BaseStruct* DrawStruct ); EDA_ScreenList(){
~EDA_ScreenList(); m_Index = 0;
int GetCount() { return m_Count; } BuildScreenList(g_RootSheet);
}
~EDA_ScreenList() {}
int GetCount() { return m_List.GetCount(); }
SCH_SCREEN* GetFirst(); SCH_SCREEN* GetFirst();
SCH_SCREEN* GetNext(); SCH_SCREEN* GetNext();
SCH_SCREEN* GetScreen( int index ); SCH_SCREEN* GetScreen( unsigned int index );
void UpdateSheetNumberAndDate(); void UpdateScreenNumberAndDate();
private: private:
SCH_SCREEN** BuildScreenList( SCH_SCREEN** ScreenList, void AddScreenToList( SCH_SCREEN* testscreen );
EDA_BaseStruct* DrawStruct, int* Count ); void BuildScreenList( EDA_BaseStruct* sheet );
}; };
#endif /* CLASS_SCREEN_H */ #endif /* CLASS_SCREEN_H */

View File

@ -18,6 +18,7 @@
/* class DrawTextStruct */ /* class DrawTextStruct */
/* class DrawLabelStruct */ /* class DrawLabelStruct */
/* class DrawGlobalLabelStruct */ /* class DrawGlobalLabelStruct */
/* class DrawHierLabelStruct */
/************************/ /************************/
/**************************************************************************/ /**************************************************************************/
@ -47,7 +48,11 @@ DrawTextStruct* DrawTextStruct::GenCopy()
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
newitem = new DrawGlobalLabelStruct( m_Pos, m_Text ); newitem = new DrawGlobalLabelStruct(m_Pos, m_Text );
break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
newitem = new DrawHierLabelStruct(m_Pos, m_Text );
break; break;
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
@ -102,8 +107,7 @@ void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/* restore new values */ /* restore new values */
SwapData( (DrawTextStruct*) g_ItemToUndoCopy ); SwapData( (DrawTextStruct*) g_ItemToUndoCopy );
delete g_ItemToUndoCopy; SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = NULL;
} }
EDA_BaseStruct::Place( frame, DC ); EDA_BaseStruct::Place( frame, DC );
@ -121,15 +125,24 @@ DrawLabelStruct::DrawLabelStruct( const wxPoint& pos, const wxString& text ) :
/***********************************************************************************/ /***********************************************************************************/
DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString& text ) : DrawGlobalLabelStruct::DrawGlobalLabelStruct(const wxPoint& pos, const wxString& text) :
DrawTextStruct( pos, text, DRAW_GLOBAL_LABEL_STRUCT_TYPE ) DrawTextStruct( pos, text, DRAW_GLOBAL_LABEL_STRUCT_TYPE )
/***********************************************************************************/ /***********************************************************************************/
{ {
m_Layer = LAYER_GLOBLABEL; m_Layer = LAYER_GLOBLABEL;
m_Shape = NET_INPUT; m_Shape = NET_BIDI;
m_IsDangling = TRUE; m_IsDangling = TRUE;
} }
/***********************************************************************************/
DrawHierLabelStruct::DrawHierLabelStruct(const wxPoint& pos, const wxString& text) :
DrawTextStruct( pos, text, DRAW_HIER_LABEL_STRUCT_TYPE )
/***********************************************************************************/
{
m_Layer = LAYER_HIERLABEL;
m_Shape = NET_INPUT;
m_IsDangling = TRUE;
}
/*******************************************************************************************/ /*******************************************************************************************/
void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
@ -201,10 +214,9 @@ void DrawLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of
/*******************************************************************************************/ /*******************************************************************************************/
void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawHierLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/******************************************************************************************/ /******************************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon /* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/ */
{ {
@ -254,6 +266,76 @@ void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoi
break; break;
} }
Template = TemplateShape[m_Shape][m_Orient];
imax = *Template; Template++;
for( ii = 0, jj = 0; ii < imax; ii++ )
{
Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.x + offset.x;
jj++; Template++;
Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.y + offset.y;
jj++; Template++;
}
GRPoly( &panel->m_ClipBox, DC, imax, Poly, 0, width, color, color );
if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
}
/*******************************************************************************************/
void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
/******************************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/
//should reimplement this with a custom global shape??
//it is the same as Hierarchal sheet.
{
int* Template;
int Poly[20];
int ii, jj, imax, color, HalfSize;
wxSize Size = m_Size;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 )
color = Color;
else
color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
HalfSize = Size.x / 2; ii = Size.x + TXTMARGE;
switch( m_Orient )
{
case 0: /* Orientation horiz normale */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x - ii + offset.x, m_Pos.y + offset.y ), color,
m_Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width );
break;
case 1: /* Orientation vert UP */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + offset.x, m_Pos.y + ii + offset.y ), color,
m_Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width );
break;
case 2: /* Orientation horiz inverse */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + ii + offset.x, m_Pos.y + offset.y ), color,
m_Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width );
break;
case 3: /* Orientation vert BOTTOM */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + offset.x, m_Pos.y - ii + offset.y ), color,
m_Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width );
break;
}
Template = TemplateShape[m_Shape][m_Orient]; Template = TemplateShape[m_Shape][m_Orient];

View File

@ -106,6 +106,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
case DRAW_PICK_ITEM_STRUCT_TYPE: case DRAW_PICK_ITEM_STRUCT_TYPE:
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:

View File

@ -16,7 +16,8 @@
#include "macros.h" #include "macros.h"
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(ArrayOfSheetLists);
/***************************/ /***************************/
/* class DrawPartStruct */ /* class DrawPartStruct */
/* class EDA_SchComponentStruct */ /* class EDA_SchComponentStruct */
@ -88,6 +89,71 @@ const wxString& EDA_SchComponentStruct::ReturnFieldName( int aFieldNdx ) const
return m_Field[aFieldNdx].m_Name; return m_Field[aFieldNdx].m_Name;
} }
/************************************/
wxString EDA_SchComponentStruct::GetPath(DrawSheetList* sheet)
/************************************/
{
wxString str;
str.Printf(_("%8.8lX"), m_TimeStamp );
return sheet->Path() + str;
}
/************************************/
const wxString EDA_SchComponentStruct::GetRef( DrawSheetList* sheet )
/************************************/
{
wxString path = GetPath( sheet );
unsigned int i;
for(i=0; i<m_Paths.GetCount(); i++){
if( m_Paths[i].Cmp(path) == 0 ){
/*printf("GetRef path: %s ref: %s\n",
CONV_TO_UTF8(m_Paths[i]),
CONV_TO_UTF8(m_References[i])); */
return m_References[i];
}
}
return m_PrefixString;
}
/************************************/
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));
unsigned int i;
bool notInArray = true;
for(i=0; i<m_Paths.GetCount(); i++){
if(m_Paths[i].Cmp(path) == 0){
//just update the reference text, not the timestamp.
m_References.RemoveAt(i);
m_References.Insert(ref, i);
notInArray = false;
}
}
if(notInArray){
m_References.Add(ref);
m_Paths.Add(path);
}
if(m_Field[REFERENCE].m_Text.IsEmpty() ||
( abs(m_Field[REFERENCE].m_Pos.x - m_Pos.x) +
abs(m_Field[REFERENCE].m_Pos.y - m_Pos.y) > 1000)) {
//move it to a reasonable position..
m_Field[REFERENCE].m_Pos = m_Pos;
}
m_Field[REFERENCE].m_Text = ref; //for drawing.
}
/************************************/
void EDA_SchComponentStruct::ClearRefs()
/************************************/
{
m_Paths.Empty();
m_References.Empty();
}
const wxString& EDA_SchComponentStruct::GetFieldValue( int aFieldNdx ) const const wxString& EDA_SchComponentStruct::GetFieldValue( int aFieldNdx ) const
{ {
@ -109,8 +175,8 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) :
int ii; int ii;
m_Multi = 0; /* In multi unit chip - which unit to draw. */ m_Multi = 0; /* In multi unit chip - which unit to draw. */
m_RefIdNumber = 0; //m_FlagControlMulti = 0;
m_FlagControlMulti = 0; m_UsedOnSheets.Clear();
m_Convert = 0; /* Gestion des mutiples representations (conversion De Morgan) */ m_Convert = 0; /* Gestion des mutiples representations (conversion De Morgan) */
/* The rotation/mirror transformation matrix. pos normal*/ /* The rotation/mirror transformation matrix. pos normal*/
@ -132,6 +198,8 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) :
m_Field[REFERENCE].m_Layer = LAYER_REFERENCEPART; m_Field[REFERENCE].m_Layer = LAYER_REFERENCEPART;
m_PinIsDangling = NULL; m_PinIsDangling = NULL;
m_PrefixString = wxString(_("U"));
} }
@ -183,8 +251,6 @@ EDA_Rect EDA_SchComponentStruct::GetBoundaryBox()
BoundaryBox.Offset( m_Pos ); BoundaryBox.Offset( m_Pos );
return BoundaryBox; return BoundaryBox;
} }
/**************************************************************************/ /**************************************************************************/
void PartTextStruct::SwapData( PartTextStruct* copyitem ) void PartTextStruct::SwapData( PartTextStruct* copyitem )
/**************************************************************************/ /**************************************************************************/
@ -250,8 +316,7 @@ void EDA_SchComponentStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/* restore new values */ /* restore new values */
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy ); SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy );
delete g_ItemToUndoCopy; SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = NULL;
} }
EDA_BaseStruct::Place( frame, DC ); EDA_BaseStruct::Place( frame, DC );
@ -265,13 +330,13 @@ void EDA_SchComponentStruct::ClearAnnotation()
/* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1) /* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
*/ */
{ {
m_RefIdNumber = 0; wxString defRef = m_PrefixString;
defRef.Append( _("?") );
while( isdigit( m_Field[REFERENCE].m_Text.Last() ) ) m_References.Empty();
m_Field[REFERENCE].m_Text.RemoveLast(); unsigned int i;
for(i=0; i< m_Paths.GetCount(); i++){
if( m_Field[REFERENCE].m_Text.Last() != '?' ) m_References.Add(defRef);
m_Field[REFERENCE].m_Text.Append( '?' ); }
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
@ -291,7 +356,8 @@ EDA_SchComponentStruct* EDA_SchComponentStruct::GenCopy()
new_item->m_Multi = m_Multi; new_item->m_Multi = m_Multi;
new_item->m_ChipName = m_ChipName; new_item->m_ChipName = m_ChipName;
new_item->m_FlagControlMulti = m_FlagControlMulti; //new_item->m_FlagControlMulti = m_FlagControlMulti;
new_item->m_UsedOnSheets = m_UsedOnSheets;
new_item->m_Convert = m_Convert; new_item->m_Convert = m_Convert;
new_item->m_Transform[0][0] = m_Transform[0][0]; new_item->m_Transform[0][0] = m_Transform[0][0];
new_item->m_Transform[0][1] = m_Transform[0][1]; new_item->m_Transform[0][1] = m_Transform[0][1];
@ -522,9 +588,9 @@ int EDA_SchComponentStruct::GetRotationMiroir()
wxPoint EDA_SchComponentStruct::GetScreenCoord( const wxPoint& coord ) wxPoint EDA_SchComponentStruct::GetScreenCoord( const wxPoint& coord )
/***********************************************************************/ /***********************************************************************/
/* Renvoie la coordonnée du point coord, en fonction de l'orientation /* Renvoie la coordonn<EFBFBD>e du point coord, en fonction de l'orientation
* du composant (rotation, miroir). * du composant (rotation, miroir).
* Les coord sont toujours relatives à l'ancre (coord 0,0) du composant * Les coord sont toujours relatives <EFBFBD> l'ancre (coord 0,0) du composant
*/ */
{ {
wxPoint screenpos; wxPoint screenpos;
@ -548,7 +614,7 @@ void EDA_SchComponentStruct::Show( int nestLevel, std::ostream& os )
{ {
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" ref=\"" << GetReference().mb_str() << '"' << " ref=\"" << ReturnFieldName(0) << '"' <<
" chipName=\"" << m_ChipName.mb_str() << '"' << " chipName=\"" << m_ChipName.mb_str() << '"' <<
m_Pos << m_Pos <<
" layer=\"" << m_Layer << '"' << " layer=\"" << m_Layer << '"' <<

View File

@ -11,10 +11,11 @@
#include "macros.h" #include "macros.h"
#include "base_struct.h" #include "base_struct.h"
#include <wx/arrstr.h>
#include "class_screen.h"
#include <wx/dynarray.h>
/* Definition de la representation du composant */ /* Definition de la representation du composant */
#define NUMBER_OF_FIELDS 12 /* Nombre de champs de texte affectes au composant */
enum NumFieldType { enum NumFieldType {
REFERENCE = 0, /* Champ Reference of part, i.e. "IC21" */ REFERENCE = 0, /* Champ Reference of part, i.e. "IC21" */
VALUE, /* Champ Value of part, i.e. "3.3K" */ VALUE, /* Champ Value of part, i.e. "3.3K" */
@ -27,7 +28,8 @@ enum NumFieldType {
FIELD5, FIELD5,
FIELD6, FIELD6,
FIELD7, FIELD7,
FIELD8 FIELD8,
NUMBER_OF_FIELDS /* Nombre de champs de texte affectes au composant */
}; };
@ -64,7 +66,7 @@ public:
/* the class DrawPartStruct describes a basic virtual component /* the class DrawPartStruct describes a basic virtual component
* Not used directly: * Not used directly:
* used classes are EDA_SchComponentStruct (the "classic" schematic component * used classes are EDA_SchComponentStruct (the "classic" schematic component, below)
* and the Pseudo component DrawSheetStruct * and the Pseudo component DrawSheetStruct
*/ */
class DrawPartStruct : public EDA_BaseStruct class DrawPartStruct : public EDA_BaseStruct
@ -83,27 +85,26 @@ public:
{ {
return wxT( "DrawPart" ); return wxT( "DrawPart" );
} }
/**
* Function GetReference
* returns a reference to the Reference
*/
const wxString& GetReference() { return m_Field[REFERENCE].m_Text; }
}; };
WX_DECLARE_OBJARRAY(DrawSheetList, ArrayOfSheetLists);
/* the class EDA_SchComponentStruct describes a real component */ /* the class EDA_SchComponentStruct describes a real component */
class EDA_SchComponentStruct : public DrawPartStruct class EDA_SchComponentStruct : public DrawPartStruct
{ {
public: public:
int m_RefIdNumber; /* reference count: for U1, R2 .. it is the 1 or 2 value */
int m_Multi; /* In multi unit chip - which unit to draw. */ int m_Multi; /* In multi unit chip - which unit to draw. */
int m_FlagControlMulti; //int m_FlagControlMulti;
int m_Convert; /* Gestion des mutiples representations (ex: conversion De Morgan) */ 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. */ int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
bool* m_PinIsDangling; // liste des indicateurs de pin non connectee 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: public:
EDA_SchComponentStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); EDA_SchComponentStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
~EDA_SchComponentStruct( void ) { } ~EDA_SchComponentStruct( void ) { }
@ -143,6 +144,12 @@ public:
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); 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) #if defined(DEBUG)
/** /**
* Function Show * Function Show

View File

@ -60,7 +60,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, GetScreen()->m_Curseur, &LibItem ); Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, &LibItem );
if( Pin ) if( Pin )
break; // Priority is probing a pin first break; // Priority is probing a pin first
LibItem = (EDA_SchComponentStruct*) DrawStruct; LibItem = (EDA_SchComponentStruct*) DrawStruct;
@ -68,7 +68,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
break; break;
default: default:
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, GetScreen()->m_Curseur, &LibItem ); Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, &LibItem );
break; break;
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
@ -82,7 +82,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
Pin->Display_Infos( this ); Pin->Display_Infos( this );
if( LibItem ) if( LibItem )
Affiche_1_Parametre( this, 1, Affiche_1_Parametre( this, 1,
LibItem->m_Field[REFERENCE].m_Text, LibItem->GetRef(GetSheet()),
LibItem->m_Field[VALUE].m_Text, LibItem->m_Field[VALUE].m_Text,
CYAN ); CYAN );
@ -121,7 +121,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
wxString msg; wxString msg;
int ii; int ii;
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, MARKERITEM ); DrawStruct = PickStruct( refpoint, GetScreen(), MARKERITEM );
if( DrawStruct ) if( DrawStruct )
{ {
DrawMarkerStruct* Marker = (DrawMarkerStruct*) DrawStruct; DrawMarkerStruct* Marker = (DrawMarkerStruct*) DrawStruct;
@ -134,7 +134,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, DrawStruct = PickStruct( refpoint, GetScreen(),
NOCONNECTITEM ); NOCONNECTITEM );
if( DrawStruct ) if( DrawStruct )
{ {
@ -142,7 +142,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, DrawStruct = PickStruct( refpoint, GetScreen(),
JUNCTIONITEM ); JUNCTIONITEM );
if( DrawStruct ) if( DrawStruct )
{ {
@ -150,17 +150,17 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, DrawStruct = PickStruct( refpoint, GetScreen(),
WIREITEM | BUSITEM | RACCORDITEM ); WIREITEM | BUSITEM | RACCORDITEM );
if( DrawStruct ) // Search for a pin if( DrawStruct ) // Search for a pin
{ {
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, refpoint, &LibItem ); Pin = LocateAnyPin( m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
if( Pin ) if( Pin )
{ {
Pin->Display_Infos( this ); Pin->Display_Infos( this );
if( LibItem ) if( LibItem )
Affiche_1_Parametre( this, 1, Affiche_1_Parametre( this, 1,
LibItem->m_Field[REFERENCE].m_Text, LibItem->GetRef(GetSheet()),
LibItem->m_Field[VALUE].m_Text, LibItem->m_Field[VALUE].m_Text,
CYAN ); CYAN );
} }
@ -169,7 +169,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, FIELDCMPITEM ); DrawStruct = PickStruct( refpoint, GetScreen(), FIELDCMPITEM );
if( DrawStruct ) if( DrawStruct )
{ {
PartTextStruct* Field = (PartTextStruct*) DrawStruct; PartTextStruct* Field = (PartTextStruct*) DrawStruct;
@ -180,29 +180,29 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
} }
/* search for a pin */ /* search for a pin */
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, refpoint, &LibItem ); Pin = LocateAnyPin( m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
if( Pin ) if( Pin )
{ {
Pin->Display_Infos( this ); Pin->Display_Infos( this );
if( LibItem ) if( LibItem )
Affiche_1_Parametre( this, 1, Affiche_1_Parametre( this, 1,
LibItem->m_Field[REFERENCE].m_Text, LibItem->GetRef(GetSheet()),
LibItem->m_Field[VALUE].m_Text, LibItem->m_Field[VALUE].m_Text,
CYAN ); CYAN );
if( IncludePin == TRUE ) if( IncludePin == TRUE )
return LibItem; return LibItem;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, LIBITEM ); DrawStruct = PickStruct( refpoint, GetScreen(), LIBITEM );
if( DrawStruct ) if( DrawStruct )
{ {
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
LibItem = (EDA_SchComponentStruct*) DrawStruct; LibItem = (EDA_SchComponentStruct*) DrawStruct;
LibItem->Display_Infos( this ); LibItem->Display_Infos( this );
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, DrawStruct = PickStruct( refpoint, GetScreen(),
SHEETITEM ); SHEETITEM );
if( DrawStruct ) if( DrawStruct )
{ {
@ -211,7 +211,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
} }
// Recherche des autres elements // Recherche des autres elements
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, DrawStruct = PickStruct( refpoint, GetScreen(),
SEARCHALL ); SEARCHALL );
if( DrawStruct ) if( DrawStruct )
{ {
@ -228,17 +228,16 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
/***********************************************************************/ /***********************************************************************/
{ {
wxSize delta; wxSize delta;
int zoom = m_CurrentScreen->GetZoom(); SCH_SCREEN* screen = (SCH_SCREEN*)GetScreen();
int zoom = screen->GetZoom();
wxPoint curpos, oldpos; wxPoint curpos, oldpos;
int hotkey = 0; int hotkey = 0;
ActiveScreen = (SCH_SCREEN*) m_CurrentScreen; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur;
curpos = m_CurrentScreen->m_MousePosition; delta.x = screen->GetGrid().x / zoom;
oldpos = m_CurrentScreen->m_Curseur; delta.y = screen->GetGrid().y / zoom;
delta.x = m_CurrentScreen->GetGrid().x / zoom;
delta.y = m_CurrentScreen->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
@ -252,37 +251,37 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
case EDA_PANNING_UP_KEY: case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP ); OnZoom( ID_ZOOM_PANNING_UP );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_PANNING_DOWN_KEY: case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN ); OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_PANNING_LEFT_KEY: case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT ); OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_PANNING_RIGHT_KEY: case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT ); OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_ZOOM_IN_FROM_MOUSE: case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_PLUS_KEY ); OnZoom( ID_ZOOM_PLUS_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_ZOOM_OUT_FROM_MOUSE: case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_MOINS_KEY ); OnZoom( ID_ZOOM_MOINS_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_ZOOM_CENTER_FROM_MOUSE: case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY ); OnZoom( ID_ZOOM_CENTER_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
@ -315,22 +314,22 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
} }
/* Recalcul de la position du curseur schema */ /* Recalcul de la position du curseur schema */
m_CurrentScreen->m_Curseur = curpos; screen->m_Curseur = curpos;
/* Placement sur la grille generale */ /* Placement sur la grille generale */
PutOnGrid( &m_CurrentScreen->m_Curseur ); PutOnGrid( &(screen->m_Curseur) );
if( m_CurrentScreen->IsRefreshReq() ) if( screen->IsRefreshReq() )
{ {
RedrawActiveWindow( DC, TRUE ); RedrawActiveWindow( DC, TRUE );
} }
if( oldpos != m_CurrentScreen->m_Curseur ) if( oldpos != screen->m_Curseur )
{ {
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
m_CurrentScreen->m_Curseur = oldpos; screen->m_Curseur = oldpos;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = curpos; GetScreen()->m_Curseur = curpos;
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
@ -341,9 +340,9 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
if( hotkey ) if( hotkey )
{ {
if( m_CurrentScreen->GetCurItem() if( screen->GetCurItem()
&& m_CurrentScreen->GetCurItem()->m_Flags ) && screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, m_CurrentScreen->GetCurItem() ); OnHotKey( DC, hotkey, screen->GetCurItem() );
else else
OnHotKey( DC, hotkey, NULL ); OnHotKey( DC, hotkey, NULL );
} }

View File

@ -98,7 +98,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
for( DanglingItem = ItemList; DanglingItem != NULL; DanglingItem = nextitem ) for( DanglingItem = ItemList; DanglingItem != NULL; DanglingItem = nextitem )
{ {
nextitem = DanglingItem->m_Pnext; nextitem = DanglingItem->m_Pnext;
delete DanglingItem; SAFE_DELETE( DanglingItem );
} }
ItemList = RebuildEndList( DrawList ); ItemList = RebuildEndList( DrawList );
@ -109,6 +109,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
switch( DrawItem->Type() ) switch( DrawItem->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) DrawItem ) #define STRUCT ( (DrawLabelStruct*) DrawItem )
@ -146,7 +147,7 @@ LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( EDA_BaseStruct* DrawList,
const wxPoint& pos ) const wxPoint& pos )
/********************************************************************/ /********************************************************************/
/* Teste si le point de coordonnées pos est sur l'extrémité d'une PIN /* Teste si le point de coordonn<EFBFBD>es pos est sur l'extr<74>mit<69> d'une PIN
* retourne un pointeur sur la pin * retourne un pointeur sur la pin
* NULL sinon * NULL sinon
*/ */
@ -280,7 +281,7 @@ wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin,
EDA_SchComponentStruct* DrawLibItem ) EDA_SchComponentStruct* DrawLibItem )
/****************************************************/ /****************************************************/
/* Retourne la position physique de la pin, qui dépend de l'orientation /* Retourne la position physique de la pin, qui d<EFBFBD>pend de l'orientation
* du composant */ * du composant */
{ {
wxPoint PinPos = Pin->m_Pos; wxPoint PinPos = Pin->m_Pos;
@ -316,8 +317,9 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) DrawItem ) #define STRUCT ( (DrawLabelStruct*) DrawItem )
item = new DanglingEndHandle( LABEL_END ); item = new DanglingEndHandle( LABEL_END );
item->m_Item = DrawItem; item->m_Item = DrawItem;

View File

@ -116,24 +116,28 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
for(DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct=DelStruct->Pnext) for(DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct=DelStruct->Pnext)
DelStruct->m_Flags = 0; DelStruct->m_Flags = 0;
BreakSegmentOnJunction( GetScreen() ); BreakSegmentOnJunction( (SCH_SCREEN*)GetScreen() );
DelStruct = GetScreen()->EEDrawList; DelStruct = GetScreen()->EEDrawList;
/* Locate all the wires, bus or junction under the mouse cursor, and put them in a list /* Locate all the wires, bus or junction under the mouse cursor, and put them in a list
of items to delete of items to delete
*/ */
SCH_SCREEN* screen = (SCH_SCREEN*)GetScreen();
EDA_BaseStruct* savedEEDrawList = screen->EEDrawList;
while ( DelStruct && while ( DelStruct &&
(DelStruct = PickStruct(GetScreen()->m_Curseur, (DelStruct = PickStruct(screen->m_Curseur,
DelStruct, JUNCTIONITEM|WIREITEM|BUSITEM)) != NULL ) screen, JUNCTIONITEM|WIREITEM|BUSITEM)) != NULL )
{ {
DelStruct->m_Flags = SELECTEDNODE|STRUCT_DELETED; DelStruct->m_Flags = SELECTEDNODE|STRUCT_DELETED;
/* Put this structure in the picked list: */ /* Put this structure in the picked list: */
PickedItem = new DrawPickedStruct(DelStruct); PickedItem = new DrawPickedStruct(DelStruct);
PickedItem->Pnext = PickedList; PickedItem->Pnext = PickedList;
PickedList = PickedItem; PickedList = PickedItem;
DelStruct=DelStruct->Pnext; DelStruct=DelStruct->Pnext;
screen->EEDrawList = DelStruct;
} }
GetScreen()->EEDrawList = savedEEDrawList;
/* Mark all wires, junctions, .. connected to one of the item to delete /* Mark all wires, junctions, .. connected to one of the item to delete
*/ */
if ( DeleteFullConnection ) if ( DeleteFullConnection )
@ -224,7 +228,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
if ( DelStruct->Type() != DRAW_LABEL_STRUCT_TYPE ) continue; if ( DelStruct->Type() != DRAW_LABEL_STRUCT_TYPE ) continue;
GetScreen()->m_Curseur = ((DrawTextStruct*)DelStruct)->m_Pos; GetScreen()->m_Curseur = ((DrawTextStruct*)DelStruct)->m_Pos;
EDA_BaseStruct * TstStruct = EDA_BaseStruct * TstStruct =
PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList,WIREITEM|BUSITEM); PickStruct(GetScreen()->m_Curseur, GetScreen(),WIREITEM|BUSITEM);
if ( TstStruct && TstStruct->m_Flags & STRUCT_DELETED ) if ( TstStruct && TstStruct->m_Flags & STRUCT_DELETED )
{ {
DelStruct->m_Flags |= STRUCT_DELETED; DelStruct->m_Flags |= STRUCT_DELETED;
@ -267,33 +271,33 @@ bool LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC)
*/ */
{ {
EDA_BaseStruct * DelStruct; EDA_BaseStruct * DelStruct;
SCH_SCREEN * screen = frame->GetScreen(); SCH_SCREEN * screen = (SCH_SCREEN*)(frame->GetScreen());
bool item_deleted = FALSE; bool item_deleted = FALSE;
DelStruct = PickStruct(screen->m_Curseur, DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, MARKERITEM); screen, MARKERITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, JUNCTIONITEM); screen, JUNCTIONITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, NOCONNECTITEM); screen, NOCONNECTITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, RACCORDITEM); screen, RACCORDITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, WIREITEM|BUSITEM); screen, WIREITEM|BUSITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, DRAWITEM); screen, DRAWITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, TEXTITEM|LABELITEM); screen, TEXTITEM|LABELITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, LIBITEM); screen, LIBITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, SHEETITEM); screen, SHEETITEM);
if (DelStruct) if (DelStruct)
{ {
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
DeleteStruct(frame->DrawPanel, DC, DelStruct); DeleteStruct(frame->DrawPanel, DC, DelStruct);
frame->TestDanglingEnds(frame->m_CurrentScreen->EEDrawList, DC); frame->TestDanglingEnds(frame->GetScreen()->EEDrawList, DC);
frame->GetScreen()->SetModify(); frame->GetScreen()->SetModify();
item_deleted = TRUE; item_deleted = TRUE;
} }
@ -331,6 +335,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE) if (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE)
{ /* Cette stucture est rattachee a une feuille, et n'est pas { /* Cette stucture est rattachee a une feuille, et n'est pas
accessible par la liste globale directement */ accessible par la liste globale directement */
//this structure has a sheet attached, which we must find.
DrawList = Screen->EEDrawList; DrawList = Screen->EEDrawList;
for ( ; DrawList != NULL; DrawList = DrawList->Pnext ) for ( ; DrawList != NULL; DrawList = DrawList->Pnext )
{ {
@ -342,7 +347,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
{ {
((DrawSheetStruct *) DrawList)->m_Label = ((DrawSheetStruct *) DrawList)->m_Label =
(DrawSheetLabelStruct *)SheetLabel->Pnext; (DrawSheetLabelStruct *)SheetLabel->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
return; return;
} }
else while( SheetLabel->Pnext )/* Examen de la liste dependante */ else while( SheetLabel->Pnext )/* Examen de la liste dependante */
@ -351,7 +356,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if( NextLabel == (DrawSheetLabelStruct*) DrawStruct ) if( NextLabel == (DrawSheetLabelStruct*) DrawStruct )
{ {
SheetLabel->Pnext = (EDA_BaseStruct *)NextLabel->Pnext; SheetLabel->Pnext = (EDA_BaseStruct *)NextLabel->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
return; return;
} }
SheetLabel = NextLabel; SheetLabel = NextLabel;
@ -360,7 +365,6 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
return; return;
} }
if (DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE) if (DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE)
{ {
PickedList = (DrawPickedStruct *) DrawStruct; PickedList = (DrawPickedStruct *) DrawStruct;
@ -369,7 +373,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if (PickedList->m_PickedStruct == Screen->EEDrawList) if (PickedList->m_PickedStruct == Screen->EEDrawList)
{ {
Screen->EEDrawList = Screen->EEDrawList->Pnext; Screen->EEDrawList = Screen->EEDrawList->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
} }
else else
{ {
@ -379,7 +383,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if (DrawList->Pnext == PickedList->m_PickedStruct) if (DrawList->Pnext == PickedList->m_PickedStruct)
{ {
DrawList->Pnext = DrawList->Pnext->Pnext; DrawList->Pnext = DrawList->Pnext->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
return; return;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
@ -393,7 +397,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if (DrawStruct == Screen->EEDrawList) if (DrawStruct == Screen->EEDrawList)
{ {
Screen->EEDrawList = DrawStruct->Pnext; Screen->EEDrawList = DrawStruct->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
} }
else else
{ {
@ -403,7 +407,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if (DrawList->Pnext == DrawStruct) if (DrawList->Pnext == DrawStruct)
{ {
DrawList->Pnext = DrawStruct->Pnext; DrawList->Pnext = DrawStruct->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
return; return;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
@ -423,7 +427,7 @@ SCH_SCREEN * screen;
EDA_BaseStruct * DrawStruct, * NextStruct; EDA_BaseStruct * DrawStruct, * NextStruct;
DrawMarkerStruct * Marker; DrawMarkerStruct * Marker;
EDA_ScreenList ScreenList(NULL); EDA_ScreenList ScreenList;
for ( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for ( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{ {
for ( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct) for ( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct)
@ -471,7 +475,7 @@ LibEDA_BaseStruct *PreviousDrawItem;
if( LibEntry->m_Drawings == DrawItem ) if( LibEntry->m_Drawings == DrawItem )
{ {
LibEntry->m_Drawings = DrawItem->Next(); LibEntry->m_Drawings = DrawItem->Next();
delete DrawItem; SAFE_DELETE( DrawItem );
} }
else /* Cas des autres items */ else /* Cas des autres items */
@ -480,7 +484,7 @@ LibEDA_BaseStruct *PreviousDrawItem;
if(PreviousDrawItem->Pnext == DrawItem) if(PreviousDrawItem->Pnext == DrawItem)
{ {
PreviousDrawItem->Pnext = DrawItem->Pnext; PreviousDrawItem->Pnext = DrawItem->Pnext;
delete DrawItem; break; SAFE_DELETE( DrawItem ); break;
} }
PreviousDrawItem = PreviousDrawItem->Next(); PreviousDrawItem = PreviousDrawItem->Next();
} }
@ -488,7 +492,7 @@ LibEDA_BaseStruct *PreviousDrawItem;
else /* Structure non reliee a un composant */ else /* Structure non reliee a un composant */
{ {
delete DrawItem; SAFE_DELETE( DrawItem );
} }
} }

View File

@ -37,19 +37,20 @@ wxString msg;
} }
/* effacement du sous schema correspondant */ /* effacement du sous schema correspondant */
if( FirstSheet->IsModify() && confirm_deletion ) if( FirstSheet->m_s->IsModify() && confirm_deletion )
{ {
msg.Printf( _("Sheet %s (file %s) modified. Save it?"), msg.Printf( _("Sheet %s (file %s) modified. Save it?"),
FirstSheet->m_SheetName.GetData(), FirstSheet->m_SheetName.GetData(),
FirstSheet->m_FileName.GetData()); FirstSheet->m_FileName.GetData());
if( IsOK(NULL, msg) ) if( IsOK(NULL, msg) )
{ {
frame->SaveEEFile(FirstSheet, FILE_SAVE_AS); frame->SaveEEFile(FirstSheet->m_s, FILE_SAVE_AS);
} }
} }
/* free the sub hierarchy */ /* free the sub hierarchy */
EEDrawList = FirstSheet->EEDrawList; if(FirstSheet->m_s){
EEDrawList = FirstSheet->m_s->EEDrawList;
while (EEDrawList != NULL) while (EEDrawList != NULL)
{ {
DrawStruct = EEDrawList; DrawStruct = EEDrawList;
@ -59,15 +60,17 @@ wxString msg;
DeleteSubHierarchy((DrawSheetStruct *) DrawStruct, confirm_deletion); DeleteSubHierarchy((DrawSheetStruct *) DrawStruct, confirm_deletion);
} }
} }
/* Effacement des elements de la feuille courante */ /* Effacement des elements de la feuille courante */
FirstSheet->FreeDrawList(); FirstSheet->m_s->FreeDrawList();
}
} }
/*********************************************************************/ /*********************************************************************/
void ClearDrawList(EDA_BaseStruct *DrawList, bool confirm_deletion) //void ClearDrawList(EDA_BaseStruct *DrawList, bool confirm_deletion)
/********************************************************************/ /********************************************************************/
/* free the draw list DrawList and the subhierarchies */ /* free the draw list DrawList and the subhierarchies */
//this is redundant -- use FreeDrawList, a member of SCH_SCREEN
/*
{ {
EDA_BaseStruct *DrawStruct; EDA_BaseStruct *DrawStruct;
@ -84,7 +87,7 @@ EDA_BaseStruct *DrawStruct;
delete DrawStruct; delete DrawStruct;
} }
} }
*/
/********************************************************************/ /********************************************************************/
bool ClearProjectDrawList(SCH_SCREEN * screen, bool confirm_deletion) bool ClearProjectDrawList(SCH_SCREEN * screen, bool confirm_deletion)
/********************************************************************/ /********************************************************************/
@ -94,11 +97,10 @@ bool ClearProjectDrawList(SCH_SCREEN * screen, bool confirm_deletion)
{ {
if ( screen == NULL ) return(TRUE); if ( screen == NULL ) return(TRUE);
ClearDrawList(screen->EEDrawList, confirm_deletion); screen->FreeDrawList();
screen->EEDrawList = NULL;
/* Clear the screen datas */ /* Clear the screen datas */
screen->m_SheetNumber = screen->m_NumberOfSheet = 1; screen->m_ScreenNumber = screen->m_NumberOfScreen = 1;
screen->m_Title.Empty(); screen->m_Title.Empty();
screen->m_Revision.Empty(); screen->m_Revision.Empty();
screen->m_Company.Empty(); screen->m_Company.Empty();

View File

@ -46,24 +46,16 @@
////@end XPM images ////@end XPM images
/* Structures pour memo et liste des elements */
typedef struct ListLabel
{
int m_LabelType;
void * m_Label;
int m_SheetNumber;
} ListLabel;
/* fonctions locales */ /* fonctions locales */
static int GenListeGLabels( ListLabel * List ); static int GenListeGLabels( ListLabel * List );
static int ListTriComposantByRef(EDA_SchComponentStruct **Objet1, int GenListeCmp( ListComponent * List );
EDA_SchComponentStruct **Objet2); static int ListTriComposantByRef(ListComponent *Objet1,
static int ListTriComposantByVal(EDA_SchComponentStruct **Objet1, ListComponent *Objet2);
EDA_SchComponentStruct **Objet2); static int ListTriComposantByVal(ListComponent *Objet1,
ListComponent *Objet2);
static int ListTriGLabelBySheet(ListLabel *Objet1, ListLabel *Objet2); static int ListTriGLabelBySheet(ListLabel *Objet1, ListLabel *Objet2);
static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2); static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2);
static void DeleteSubCmp( EDA_BaseStruct ** List , int NbItems); static void DeleteSubCmp( ListComponent * List , int NbItems);
static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems); static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems);
@ -552,12 +544,14 @@ wxString mask, filename;
else else
s_ExportSeparatorSymbol = s_ExportSeparator[0]; s_ExportSeparatorSymbol = s_ExportSeparator[0];
m_ListFileName = ScreenSch->m_FileName; m_ListFileName = g_RootSheet->m_s->m_FileName;
ChangeFileNameExt(m_ListFileName, EXT_LIST); ChangeFileNameExt(m_ListFileName, EXT_LIST);
//need to get rid of the path.
m_ListFileName = m_ListFileName.AfterLast('/');
mask = wxT("*"); mask = wxT("*");
mask += EXT_LIST; mask += EXT_LIST;
filename = EDA_FileSelector(_("Bill of material:"), filename = EDA_FileSelector(_("Bill of materials:"),
wxEmptyString, /* Chemin par defaut (ici dir courante) */ wxEmptyString, /* Chemin par defaut (ici dir courante) */
m_ListFileName, /* nom fichier par defaut, et resultat */ m_ListFileName, /* nom fichier par defaut, et resultat */
EXT_LIST, /* extension par defaut */ EXT_LIST, /* extension par defaut */
@ -600,7 +594,7 @@ void WinEDA_Build_BOM_Frame::CreateExportList(const wxString & FullFileName)
*/ */
{ {
FILE *f; FILE *f;
EDA_BaseStruct ** List; ListComponent * List;
int NbItems; int NbItems;
wxString msg; wxString msg;
@ -616,8 +610,7 @@ wxString msg;
NbItems = GenListeCmp( NULL ); NbItems = GenListeCmp( NULL );
if( NbItems ) if( NbItems )
{ {
List = (EDA_BaseStruct **) List = (ListComponent*)MyZMalloc( NbItems * sizeof(ListComponent) );
MyZMalloc( NbItems * sizeof(EDA_BaseStruct **) );
if( List == NULL ) if( List == NULL )
{ {
fclose( f ); fclose( f );
@ -627,7 +620,7 @@ wxString msg;
GenListeCmp( List ); GenListeCmp( List );
/* sort component list */ /* sort component list */
qsort( List, NbItems, sizeof( EDA_BaseStruct * ), qsort( List, NbItems, sizeof( ListComponent ),
(int(*)(const void*, const void*))ListTriComposantByRef ); (int(*)(const void*, const void*))ListTriComposantByRef );
// if( ! s_ListWithSubCmponents ) // if( ! s_ListWithSubCmponents )
@ -654,7 +647,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems(const wxString & FullFileName)
*/ */
{ {
FILE *f; FILE *f;
EDA_BaseStruct ** List; ListComponent * List;
ListLabel * ListOfLabels; ListLabel * ListOfLabels;
int NbItems; int NbItems;
char Line[1024]; char Line[1024];
@ -672,8 +665,8 @@ wxString msg;
NbItems = GenListeCmp( NULL ); NbItems = GenListeCmp( NULL );
if( NbItems ) if( NbItems )
{ {
List = ( EDA_BaseStruct **) List = ( ListComponent *)
MyZMalloc( NbItems * sizeof(EDA_BaseStruct **) ); MyZMalloc( NbItems * sizeof(ListComponent) );
if( List == NULL ) if( List == NULL )
{ {
fclose( f ); fclose( f );
@ -682,6 +675,10 @@ wxString msg;
GenListeCmp( List ); GenListeCmp( List );
for(int i=0; i<NbItems; i++){
printf("found component: %s\n", List[i].m_Ref);
}
/* generation du fichier listing */ /* generation du fichier listing */
DateAndTime(Line); DateAndTime(Line);
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion();
@ -689,9 +686,12 @@ wxString msg;
/* Tri et impression de la liste des composants */ /* Tri et impression de la liste des composants */
qsort( List, NbItems, sizeof( EDA_BaseStruct * ), qsort( List, NbItems, sizeof( ListComponent ),
(int(*)(const void*, const void*))ListTriComposantByRef ); (int(*)(const void*, const void*))ListTriComposantByRef );
printf("sorted by reference:\n");
for(int i=0; i<NbItems; i++){
printf("found component: %s\n", List[i].m_Ref);
}
// if( ! s_ListWithSubCmponents ) // if( ! s_ListWithSubCmponents )
if( ! m_ListSubCmpItems->GetValue() ) if( ! m_ListSubCmpItems->GetValue() )
DeleteSubCmp(List, NbItems); DeleteSubCmp(List, NbItems);
@ -705,7 +705,7 @@ wxString msg;
// if( s_ListByValue ) // if( s_ListByValue )
if( m_ListCmpbyValItems->GetValue() ) if( m_ListCmpbyValItems->GetValue() )
{ {
qsort( List, NbItems, sizeof( EDA_BaseStruct * ), qsort( List, NbItems, sizeof( ListComponent ),
(int(*)(const void*, const void*))ListTriComposantByVal ); (int(*)(const void*, const void*))ListTriComposantByVal );
PrintListeCmpByVal(f, List, NbItems); PrintListeCmpByVal(f, List, NbItems);
} }
@ -720,6 +720,7 @@ wxString msg;
if( NbItems ) if( NbItems )
{ {
ListOfLabels = (ListLabel *) MyZMalloc( NbItems * sizeof(ListLabel) ); ListOfLabels = (ListLabel *) MyZMalloc( NbItems * sizeof(ListLabel) );
memset((void*)ListOfLabels, 0, NbItems * sizeof(ListLabel));
if( ListOfLabels == NULL ) if( ListOfLabels == NULL )
{ {
fclose( f ); fclose( f );
@ -761,26 +762,31 @@ wxString msg;
/****************************************/ /****************************************/
int GenListeCmp( EDA_BaseStruct ** List ) int GenListeCmp( ListComponent * List )
/****************************************/ /****************************************/
/* Routine de generation de la liste des elements utiles du dessin /* Routine de generation de la liste des elements utiles du dessin
* Si List == NULL: comptage des elements * Si List == NULL: comptage des elements
* Sinon remplissage de la liste * Sinon remplissage de la liste
* Initialise "FlagControlMulti" a SheetNumber pour la sortie des listes * Initialise "FlagControlMulti" a SheetNumber pour la sortie des listes
* et m_Father comme pointeur sur la sheet d'appartenance * et m_Father comme pointeur sur la sheet d'appartenance
*
* routine for generating a list of the used components.
* if List == null, just returns the count. if not, fills the list.
* goes through the sheets, not the screens, so that we account for
* multiple instances of a given screen.
*/ */
{ {
int ItemCount = 0; int ItemCount = 0;
EDA_BaseStruct *DrawList; EDA_BaseStruct *DrawList;
EDA_SchComponentStruct *DrawLibItem; EDA_SchComponentStruct *DrawLibItem;
BASE_SCREEN * screen; DrawSheetList * sheet;
/* Build the screen list */ /* Build the sheet (not screen) list */
EDA_ScreenList ScreenList(NULL); EDA_SheetList SheetList(NULL);
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
DrawList = screen->EEDrawList; DrawList = sheet->LastDrawList();
while( DrawList ) while( DrawList )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
@ -788,11 +794,14 @@ BASE_SCREEN * screen;
case DRAW_LIB_ITEM_STRUCT_TYPE : case DRAW_LIB_ITEM_STRUCT_TYPE :
ItemCount++; ItemCount++;
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct *) DrawList;
DrawLibItem->m_FlagControlMulti = screen->m_SheetNumber; DrawLibItem->m_Parent = sheet->LastScreen();
DrawLibItem->m_Parent = screen;
if( List ) if( List )
{ {
*List = DrawList; (*List).m_Comp = DrawLibItem;
(*List).m_SheetList = *sheet;
strncpy(&((*List).m_Ref[0]),
CONV_TO_UTF8(DrawLibItem->GetRef(sheet)),
sizeof((*List).m_Ref));
List++; List++;
} }
break; break;
@ -818,24 +827,27 @@ static int GenListeGLabels( ListLabel * List )
int ItemCount = 0; int ItemCount = 0;
EDA_BaseStruct *DrawList; EDA_BaseStruct *DrawList;
DrawSheetLabelStruct *SheetLabel; DrawSheetLabelStruct *SheetLabel;
BASE_SCREEN * screen; DrawSheetList * sheet;
/* Build the screen list */ /* Build the screen list */
EDA_ScreenList ScreenList(NULL); EDA_SheetList SheetList(NULL);
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
DrawList = screen->EEDrawList; DrawList = sheet->LastDrawList();
while( DrawList ) wxString path = sheet->Path();
while(DrawList )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
ItemCount++; ItemCount++;
if( List ) if( List )
{ {
List->m_LabelType = DRAW_GLOBAL_LABEL_STRUCT_TYPE; List->m_LabelType = DrawList->Type();
List->m_SheetNumber = screen->m_SheetNumber; snprintf(List->m_SheetPath, sizeof(List->m_SheetPath),
"%s", CONV_TO_UTF8(path));
List->m_Label = DrawList; List->m_Label = DrawList;
List++; List++;
} }
@ -850,7 +862,8 @@ BASE_SCREEN * screen;
if( List ) if( List )
{ {
List->m_LabelType = DRAW_SHEETLABEL_STRUCT_TYPE; List->m_LabelType = DRAW_SHEETLABEL_STRUCT_TYPE;
List->m_SheetNumber = screen->m_SheetNumber; snprintf(List->m_SheetPath, sizeof(List->m_SheetPath),
"%s", CONV_TO_UTF8(path));
List->m_Label = SheetLabel; List->m_Label = SheetLabel;
List++; List++;
} }
@ -871,8 +884,8 @@ BASE_SCREEN * screen;
/**********************************************************/ /**********************************************************/
static int ListTriComposantByVal(EDA_SchComponentStruct **Objet1, static int ListTriComposantByVal(ListComponent *Objet1,
EDA_SchComponentStruct **Objet2) ListComponent *Objet2)
/**********************************************************/ /**********************************************************/
/* Routine de comparaison pour le tri du Tableau par qsort() /* Routine de comparaison pour le tri du Tableau par qsort()
* Les composants sont tries * Les composants sont tries
@ -884,27 +897,31 @@ static int ListTriComposantByVal(EDA_SchComponentStruct **Objet1,
int ii; int ii;
const wxString * Text1, *Text2; const wxString * Text1, *Text2;
if( ( *Objet1 == NULL ) && ( *Objet2 == NULL ) ) if( ( Objet1 == NULL ) && ( Objet2 == NULL ) )
return( 0 ); return( 0 );
if( *Objet1 == NULL ) if( Objet1 == NULL )
return( -1 ); return( -1 );
if( *Objet2 == NULL ) if( Objet2 == NULL )
return( 1 );
if( ( Objet1->m_Comp == NULL ) && ( Objet2->m_Comp == NULL ) )
return( 0 );
if( Objet1->m_Comp == NULL )
return( -1 );
if( Objet2->m_Comp == NULL )
return( 1 ); return( 1 );
Text1 = &(*Objet1)->m_Field[VALUE].m_Text; Text1 = &(Objet1->m_Comp->m_Field[VALUE].m_Text);
Text2 = &(*Objet2)->m_Field[VALUE].m_Text; Text2 = &(Objet2->m_Comp->m_Field[VALUE].m_Text);
ii = Text1->CmpNoCase(*Text2); ii = Text1->CmpNoCase(*Text2);
if( ii == 0 ) if( ii == 0 )
{ {
Text1 = &(*Objet1)->m_Field[REFERENCE].m_Text; ii = strcmp(Objet1->m_Ref, Objet2->m_Ref);
Text2 = &(*Objet2)->m_Field[REFERENCE].m_Text;
ii = Text1->CmpNoCase(*Text2);
} }
if( ii == 0 ) if( ii == 0 )
{ {
ii = (*Objet1)->m_Multi - (*Objet2)->m_Multi; ii = Objet1->m_Comp->m_Multi - Objet2->m_Comp->m_Multi;
} }
return( ii ); return( ii );
@ -912,8 +929,8 @@ const wxString * Text1, *Text2;
/**********************************************************/ /**********************************************************/
static int ListTriComposantByRef(EDA_SchComponentStruct **Objet1, static int ListTriComposantByRef(ListComponent *Objet1,
EDA_SchComponentStruct **Objet2) ListComponent *Objet2)
/**********************************************************/ /**********************************************************/
/* Routine de comparaison pour le tri du Tableau par qsort() /* Routine de comparaison pour le tri du Tableau par qsort()
* Les composants sont tries * Les composants sont tries
@ -925,27 +942,30 @@ static int ListTriComposantByRef(EDA_SchComponentStruct **Objet1,
int ii; int ii;
const wxString * Text1, *Text2; const wxString * Text1, *Text2;
if( ( *Objet1 == NULL ) && ( *Objet2 == NULL ) ) if( ( Objet1 == NULL ) && ( Objet2 == NULL ) )
return( 0 ); return( 0 );
if( *Objet1 == NULL ) if( Objet1 == NULL )
return( -1 ); return( -1 );
if( *Objet2 == NULL ) if( Objet2 == NULL )
return( 1 ); return( 1 );
Text1 = &(*Objet1)->m_Field[REFERENCE].m_Text; if( ( Objet1->m_Comp == NULL ) && ( Objet2->m_Comp == NULL ) )
Text2 = &(*Objet2)->m_Field[REFERENCE].m_Text; return( 0 );
ii = Text1->CmpNoCase(*Text2); if( Objet1->m_Comp == NULL )
return( -1 );
if( Objet2->m_Comp == NULL )
return( 1 );
if( ii == 0 ) ii = strcmp(Objet1->m_Ref, Objet2->m_Ref);
{
Text1 = &(*Objet1)->m_Field[VALUE].m_Text; if( ii == 0 ){
Text2 = &(*Objet2)->m_Field[VALUE].m_Text; Text1 = &( Objet1->m_Comp->m_Field[VALUE].m_Text );
Text2 = &( Objet2->m_Comp->m_Field[VALUE].m_Text );
ii = Text1->CmpNoCase(*Text2); ii = Text1->CmpNoCase(*Text2);
} }
if( ii == 0 ) if( ii == 0 ){
{ ii = Objet1->m_Comp->m_Multi - Objet2->m_Comp->m_Multi;
ii = (*Objet1)->m_Multi - (*Objet2)->m_Multi;
} }
return( ii ); return( ii );
@ -978,7 +998,7 @@ const wxString * Text1, *Text2;
if( ii == 0 ) if( ii == 0 )
{ {
ii = Objet1->m_SheetNumber - Objet2->m_SheetNumber; ii = strcmp(Objet1->m_SheetPath, Objet2->m_SheetPath);
} }
return( ii ); return( ii );
@ -997,7 +1017,8 @@ static int ListTriGLabelBySheet(ListLabel *Objet1, ListLabel *Objet2)
int ii; int ii;
const wxString * Text1, *Text2; const wxString * Text1, *Text2;
ii = Objet1->m_SheetNumber - Objet2->m_SheetNumber;
ii = strcmp(Objet1->m_SheetPath, Objet2->m_SheetPath);
if( ii == 0 ) if( ii == 0 )
{ {
@ -1019,7 +1040,7 @@ const wxString * Text1, *Text2;
/**************************************************************/ /**************************************************************/
static void DeleteSubCmp( EDA_BaseStruct ** List, int NbItems ) static void DeleteSubCmp( ListComponent * List, int NbItems )
/**************************************************************/ /**************************************************************/
/* Supprime les sous-composants, c'est a dire les descriptions redonnantes des /* Supprime les sous-composants, c'est a dire les descriptions redonnantes des
* boitiers multiples * boitiers multiples
@ -1028,21 +1049,24 @@ static void DeleteSubCmp( EDA_BaseStruct ** List, int NbItems )
{ {
int ii; int ii;
EDA_SchComponentStruct * LibItem; EDA_SchComponentStruct * LibItem;
const wxString * OldName = NULL; wxString OldName;
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
LibItem = (EDA_SchComponentStruct *) List[ii]; LibItem = List[ii].m_Comp;
if( LibItem == NULL ) if( LibItem == NULL )
continue; continue;
if( OldName ) if( !OldName.IsEmpty() )
{ {
if( OldName->CmpNoCase( LibItem->m_Field[REFERENCE].m_Text ) == 0 ) if( strcmp(OldName.mb_str(), List[ii].m_Ref ) == 0 )
{ {
List[ii] = NULL; List[ii].m_Comp = NULL;
List[ii].m_SheetList.Clear();
List[ii].m_Ref[0] = 0;
} }
} }
OldName = &LibItem->m_Field[REFERENCE].m_Text; OldName.Printf(_("%s"), List[ii].m_Ref );
} }
} }
@ -1088,7 +1112,7 @@ wxCheckBox * FieldCtrl = FieldListCtrl[0];
/*********************************************************************************************/ /*********************************************************************************************/
int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE * f, EDA_BaseStruct ** List, int NbItems, int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems,
bool CompactForm ) bool CompactForm )
/*********************************************************************************************/ /*********************************************************************************************/
/* Print the B.O.M sorted by reference /* Print the B.O.M sorted by reference
@ -1103,7 +1127,7 @@ wxString msg;
if( CompactForm ) if( CompactForm )
{ {
fprintf( f, "ref%cvalue%csheet number%csheet name%cfootprint", fprintf( f, "ref%cvalue%csheet path%csheet name%cfootprint",
s_ExportSeparatorSymbol, s_ExportSeparatorSymbol, s_ExportSeparatorSymbol, s_ExportSeparatorSymbol,
s_ExportSeparatorSymbol, s_ExportSeparatorSymbol ); s_ExportSeparatorSymbol, s_ExportSeparatorSymbol );
wxCheckBox * FieldListCtrl[FIELD8 - FIELD1 + 1] = { wxCheckBox * FieldListCtrl[FIELD8 - FIELD1 + 1] = {
@ -1140,7 +1164,7 @@ wxString msg;
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
DrawList = List[ii]; DrawList = List[ii].m_Comp;
if( DrawList == NULL ) if( DrawList == NULL )
continue; continue;
@ -1148,7 +1172,7 @@ wxString msg;
continue; continue;
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct *) DrawList;
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) if( List[ii].m_Ref[0] == '#' )
continue; continue;
Multi = 0; Multi = 0;
@ -1160,7 +1184,7 @@ wxString msg;
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() ) if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() )
Unit = DrawLibItem->m_Multi + 'A' - 1; Unit = DrawLibItem->m_Multi + 'A' - 1;
sprintf( NameCmp,"%s", CONV_TO_UTF8(DrawLibItem->m_Field[REFERENCE].m_Text) ); sprintf( NameCmp,"%s", List[ii].m_Ref );
if( ! CompactForm || Unit != ' ' ) if( ! CompactForm || Unit != ' ' )
sprintf( NameCmp + strlen(NameCmp), "%c", Unit ); sprintf( NameCmp + strlen(NameCmp), "%c", Unit );
@ -1174,17 +1198,19 @@ wxString msg;
// if( s_ListWithSubCmponents ) // if( s_ListWithSubCmponents )
if( m_ListSubCmpItems->GetValue() ) if( m_ListSubCmpItems->GetValue() )
{ {
DrawSheetStruct * sheet = (DrawSheetStruct *)(DrawLibItem->m_Parent); SCH_SCREEN * screen = (SCH_SCREEN *)(DrawLibItem->m_Parent);
wxString sheetname; wxString sheetname;
if( sheet && sheet->Type() == DRAW_SHEET_STRUCT_TYPE ) if( screen && screen->Type() == SCREEN_STRUCT_TYPE )
sheetname = sheet->m_SheetName; sheetname = screen->m_FileName;
else else
sheetname = _("Root"); sheetname = _("?");
if( CompactForm ) if( CompactForm )
fprintf(f, "%c%d;%s", s_ExportSeparatorSymbol, DrawLibItem->m_FlagControlMulti, fprintf(f, "%c%s;%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8(List[ii].m_SheetList.Path()),
CONV_TO_UTF8(sheetname)); CONV_TO_UTF8(sheetname));
else else
fprintf(f, " (Sheet %.2d: \"%s\")", DrawLibItem->m_FlagControlMulti, fprintf(f, " (Sheet %s: \"%s\")",
CONV_TO_UTF8(List[ii].m_SheetList.Path()),
CONV_TO_UTF8(sheetname)); CONV_TO_UTF8(sheetname));
} }
@ -1201,7 +1227,7 @@ wxString msg;
} }
/*********************************************************************************************/ /*********************************************************************************************/
int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE * f, EDA_BaseStruct ** List, int NbItems ) int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE * f, ListComponent * List, int NbItems )
/**********************************************************************************************/ /**********************************************************************************************/
{ {
int ii, Multi; int ii, Multi;
@ -1220,7 +1246,7 @@ wxString msg;
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
DrawList = List[ii]; DrawList = List[ii].m_Comp;
if( DrawList == NULL ) if( DrawList == NULL )
continue; continue;
@ -1228,7 +1254,7 @@ wxString msg;
continue; continue;
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct *) DrawList;
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) if( List[ii].m_Ref[0] == '#' )
continue; continue;
Multi = 0; Multi = 0;
@ -1237,18 +1263,17 @@ wxString msg;
if( Entry ) if( Entry )
Multi = Entry->m_UnitCount; Multi = Entry->m_UnitCount;
// if( ( Multi > 1 ) && s_ListWithSubCmponents ) // if( ( Multi > 1 ) && s_ListWithSubCmponents )
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() ) if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() ){
Unit = DrawLibItem->m_Multi + 'A' - 1; Unit = DrawLibItem->m_Multi + 'A' - 1;
msg = DrawLibItem->m_Field[REFERENCE].m_Text; }
msg.Append(Unit); fprintf( f, "| %-12s %-10s%c",
fprintf( f, "| %-12s %-10s",
CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text), CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text),
CONV_TO_UTF8(msg) ); List[ii].m_Ref, Unit);
// if( s_ListWithSubCmponents ) // if( s_ListWithSubCmponents )
if( m_ListSubCmpItems->GetValue() ) if( m_ListSubCmpItems->GetValue() )
{ {
fprintf(f, " (Sheet %.2d)", DrawLibItem->m_FlagControlMulti); fprintf(f, " (Sheet %s)", CONV_TO_UTF8(List[ii].m_SheetList.Path()) );
} }
PrintFieldData(f, DrawLibItem); PrintFieldData(f, DrawLibItem);
@ -1265,11 +1290,12 @@ wxString msg;
static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems) static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems)
/******************************************************************/ /******************************************************************/
{ {
int ii, jj; int ii, jj;
DrawGlobalLabelStruct *DrawTextItem; DrawLabelStruct *DrawTextItem;
DrawSheetLabelStruct * DrawSheetLabel; DrawSheetLabelStruct * DrawSheetLabel;
ListLabel * LabelItem; ListLabel * LabelItem;
wxString msg; wxString msg;
char str[64];
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
@ -1277,12 +1303,18 @@ wxString msg;
switch( LabelItem->m_LabelType ) switch( LabelItem->m_LabelType )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case DRAW_HIER_LABEL_STRUCT_TYPE:
DrawTextItem = (DrawGlobalLabelStruct *)(LabelItem->m_Label); case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
DrawTextItem = (DrawLabelStruct *)(LabelItem->m_Label);
if(LabelItem->m_LabelType == DRAW_HIER_LABEL_STRUCT_TYPE)
strncpy(str, "Hierarchal", sizeof(str));
else
strncpy(str, "Global ", sizeof(str));
msg.Printf( msg.Printf(
_("> %-28.28s Global (Sheet %.2d) pos: %3.3f, %3.3f\n"), _("> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n"),
DrawTextItem->m_Text.GetData(), DrawTextItem->m_Text.GetData(),
LabelItem->m_SheetNumber, str,
LabelItem->m_SheetPath,
(float)DrawTextItem->m_Pos.x / 1000, (float)DrawTextItem->m_Pos.x / 1000,
(float)DrawTextItem->m_Pos.y / 1000); (float)DrawTextItem->m_Pos.y / 1000);
@ -1299,10 +1331,10 @@ wxString msg;
jj = 4; jj = 4;
wxString labtype = CONV_FROM_UTF8(SheetLabelType[jj]); wxString labtype = CONV_FROM_UTF8(SheetLabelType[jj]);
msg.Printf( msg.Printf(
_("> %-28.28s Sheet %-7.7s (Sheet %.2d) pos: %3.3f, %3.3f\n"), _("> %-28.28s Sheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n"),
DrawSheetLabel->m_Text.GetData(), DrawSheetLabel->m_Text.GetData(),
labtype.GetData(), labtype.GetData(),
LabelItem->m_SheetNumber, LabelItem->m_SheetPath,
(float)DrawSheetLabel->m_Pos.x / 1000, (float)DrawSheetLabel->m_Pos.x / 1000,
(float)DrawSheetLabel->m_Pos.y / 1000); (float)DrawSheetLabel->m_Pos.y / 1000);
fprintf(f, CONV_TO_UTF8(msg)); fprintf(f, CONV_TO_UTF8(msg));

View File

@ -131,8 +131,8 @@ public:
////@end WinEDA_Build_BOM_Frame member function declarations ////@end WinEDA_Build_BOM_Frame member function declarations
void GenereListeOfItems(const wxString & FullFileName); void GenereListeOfItems(const wxString & FullFileName);
void CreateExportList(const wxString & FullFileName); void CreateExportList(const wxString & FullFileName);
int PrintListeCmpByRef( FILE * f, EDA_BaseStruct ** List, int NbItems, bool CompactForm = FALSE ); int PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems, bool CompactForm = FALSE );
int PrintListeCmpByVal( FILE *f, EDA_BaseStruct **List, int NbItems); int PrintListeCmpByVal( FILE *f, ListComponent * List, int NbItems);
void PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem, bool CompactForm = FALSE); void PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem, bool CompactForm = FALSE);
void SavePreferences(); void SavePreferences();

View File

@ -68,6 +68,10 @@ wxString msg;
SetTitle(_("Global Label properties")); SetTitle(_("Global Label properties"));
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
SetTitle(_("Hierarchal Label properties"));
break;
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
SetTitle(_("Label properties")); SetTitle(_("Label properties"));
break; break;
@ -155,7 +159,7 @@ void WinEDA_LabelPropertiesFrame::CreateControls()
m_TextShapeStrings.Add(_("Bidi")); m_TextShapeStrings.Add(_("Bidi"));
m_TextShapeStrings.Add(_("TriState")); m_TextShapeStrings.Add(_("TriState"));
m_TextShapeStrings.Add(_("Passive")); m_TextShapeStrings.Add(_("Passive"));
m_TextShape = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Glabel Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeStrings, 1, wxRA_SPECIFY_COLS ); m_TextShape = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("label Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeStrings, 1, wxRA_SPECIFY_COLS );
m_TextShape->SetSelection(0); m_TextShape->SetSelection(0);
m_TextShape->Show(false); m_TextShape->Show(false);
itemBoxSizer6->Add(m_TextShape, 0, wxALIGN_TOP|wxALL, 5); itemBoxSizer6->Add(m_TextShape, 0, wxALIGN_TOP|wxALL, 5);
@ -185,7 +189,8 @@ void WinEDA_LabelPropertiesFrame::CreateControls()
m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) ); m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) );
////@end WinEDA_LabelPropertiesFrame content construction ////@end WinEDA_LabelPropertiesFrame content construction
if (m_CurrentText->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if (m_CurrentText->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
m_CurrentText->Type() == DRAW_HIER_LABEL_STRUCT_TYPE)
m_TextShape->Show(true); m_TextShape->Show(true);
} }

View File

@ -433,10 +433,10 @@ wxString msg;
break; break;
} }
if ( m_Parent->m_CurrentScreen ) if ( m_Parent->GetScreen() )
{ {
if ( setgrid ) m_Parent->m_CurrentScreen->SetGrid(grid); if ( setgrid ) m_Parent->GetScreen()->SetGrid(grid);
m_Parent->m_CurrentScreen->SetRefreshReq(); m_Parent->GetScreen()->SetRefreshReq();
} }
} }

View File

@ -14,28 +14,6 @@
#include "protos.h" #include "protos.h"
/**********************************************************/
SCH_SCREEN * CreateNewScreen(WinEDA_DrawFrame * frame_source,
SCH_SCREEN * OldScreen, int TimeStamp)
/**********************************************************/
/* Routine de creation ( par allocation memoire ) d'un nouvel ecran
cet ecran est en chainage arriere avec OldScreen
la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
*/
{
SCH_SCREEN * NewScreen;
NewScreen = new SCH_SCREEN(NULL, frame_source, SCHEMATIC_FRAME);
NewScreen->SetRefreshReq();
if(OldScreen) NewScreen->m_Company = OldScreen->m_Company;
NewScreen->m_TimeStamp = TimeStamp;
NewScreen->Pback = OldScreen;
return(NewScreen);
}
/**************************************/ /**************************************/
void SetFlagModify(BASE_SCREEN * Window) void SetFlagModify(BASE_SCREEN * Window)
/**************************************/ /**************************************/

View File

@ -29,15 +29,15 @@ enum id_libedit {
/* Variables locales */ /* Variables locales */
extern int CurrentUnit; extern int CurrentUnit;
/* Classe de la frame des propriétés d'un composant en librairie */ /* Classe de la frame des propri<EFBFBD>t<EFBFBD>s d'un composant en librairie */
/* Cette classe genere une fenetre type NoteBook, pour l'edition des propriétés /* Cette classe genere une fenetre type NoteBook, pour l'edition des propri<EFBFBD>t<EFBFBD>s
* d'un composant le librairie. * d'un composant le librairie.
* On peut éditer: * On peut <EFBFBD>diter:
* Texte dimensions et justification de tous les champs (Ref, Val, et autres champs) * Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
* Documentation et mots clefs * Documentation et mots clefs
* Nombre de part par boitier * Nombre de part par boitier
* et autres propriérés générales * et autres propri<EFBFBD>r<EFBFBD>s g<EFBFBD>n<EFBFBD>rales
*/ */
#include "dialog_edit_component_in_lib.cpp" #include "dialog_edit_component_in_lib.cpp"
@ -653,7 +653,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
Close(); return; Close(); return;
} }
m_Parent->m_CurrentScreen->SetModify(); m_Parent->GetScreen()->SetModify();
m_Parent->SaveCopyInUndoList( CurrentLibEntry ); m_Parent->SaveCopyInUndoList( CurrentLibEntry );
CopyPanelFieldToData(); CopyPanelFieldToData();
@ -761,7 +761,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
{ {
if( ii < FIELD1 || Field->m_Name.IsEmpty() ) if( ii < FIELD1 || Field->m_Name.IsEmpty() )
{ {
delete Field; SAFE_DELETE( Field );
if( previousField ) if( previousField )
previousField->Pnext = NextField; previousField->Pnext = NextField;
else else
@ -1056,8 +1056,8 @@ bool WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackage( int MaxUnit )
bool WinEDA_PartPropertiesFrame::SetUnsetConvert() bool WinEDA_PartPropertiesFrame::SetUnsetConvert()
/*****************************************************/ /*****************************************************/
/* crée ou efface (selon option AsConvert) les éléments /* cr<EFBFBD>e ou efface (selon option AsConvert) les <20>l<EFBFBD>ments
* de la représentation convertie d'un composant * de la repr<EFBFBD>sentation convertie d'un composant
*/ */
{ {
int FlagDel = 0; int FlagDel = 0;
@ -1096,7 +1096,7 @@ bool WinEDA_PartPropertiesFrame::SetUnsetConvert()
} }
else /* Representation convertie a supprimer */ else /* Representation convertie a supprimer */
{ {
/* Traitement des elements à supprimer */ /* Traitement des elements <EFBFBD> supprimer */
if( CurrentLibEntry ) if( CurrentLibEntry )
DrawItem = CurrentLibEntry->m_Drawings; DrawItem = CurrentLibEntry->m_Drawings;
for( ; DrawItem != NULL; DrawItem = NextDrawItem ) for( ; DrawItem != NULL; DrawItem = NextDrawItem )

View File

@ -88,6 +88,9 @@ void WinEDA_ComponentPropertiesFrame::InitBuffers()
for( ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ ) for( ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ )
{ {
m_FieldName[ii] = m_Cmp->ReturnFieldName( ii ); m_FieldName[ii] = m_Cmp->ReturnFieldName( ii );
if(ii == REFERENCE)
m_FieldText[ii] = m_Cmp->GetRef(m_Parent->GetSheet());
else
m_FieldText[ii] = m_Cmp->m_Field[ii].m_Text; m_FieldText[ii] = m_Cmp->m_Field[ii].m_Text;
m_FieldSize[ii] = m_Cmp->m_Field[ii].m_Size.x; m_FieldSize[ii] = m_Cmp->m_Field[ii].m_Size.x;
m_FieldFlags[ii] = m_FieldFlags[ii] =
@ -115,8 +118,9 @@ void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField()
{ {
int fieldId = m_CurrentFieldId; int fieldId = m_CurrentFieldId;
for( int ii = FIELD1; ii < NUMBER_OF_FIELDS; ii++ ) for( int ii = FIELD1; ii < NUMBER_OF_FIELDS; ii++ ){
m_FieldSelection->SetString( ii, m_FieldName[ii] ); m_FieldSelection->SetString( ii, m_FieldName[ii] );
}
if( fieldId == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER ) if( fieldId == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER )
m_FieldTextCtrl->Enable( FALSE ); m_FieldTextCtrl->Enable( FALSE );
@ -343,7 +347,7 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
(m_ConvertButt->GetValue() == TRUE) ? (m_ConvertButt->GetValue() == TRUE) ?
m_Cmp->m_Convert = 2 : m_Cmp->m_Convert = 1; m_Cmp->m_Convert = 2 : m_Cmp->m_Convert = 1;
//Mise a jour de la selection de l'élément dans le boitier //Mise a jour de la selection de l'<EFBFBD>l<EFBFBD>ment dans le boitier
if( m_Cmp->m_Multi ) if( m_Cmp->m_Multi )
m_Cmp->m_Multi = m_SelectUnit->GetSelection() + 1; m_Cmp->m_Multi = m_SelectUnit->GetSelection() + 1;
@ -382,13 +386,13 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
} }
// Mise a jour des textes // Mise a jour des textes (update the texts)
for( int ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ ) for( int ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ )
{ {
if( ii == REFERENCE ) // la reference ne peut etre vide if( ii == REFERENCE ) // la reference ne peut etre vide
{ {
if( !m_FieldText[ii].IsEmpty() ) if( !m_FieldText[ii].IsEmpty() )
m_Cmp->m_Field[ii].m_Text = m_FieldText[ii]; m_Cmp->SetRef(m_Parent->GetSheet(), m_FieldText[ii]);
} }
else if( ii == VALUE ) // la valeur ne peut etre vide et ne peut etre change sur un POWER else if( ii == VALUE ) // la valeur ne peut etre vide et ne peut etre change sur un POWER
{ {
@ -421,10 +425,10 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
m_Cmp->m_Field[ii].m_Pos.y += cmp_pos.y; m_Cmp->m_Field[ii].m_Pos.y += cmp_pos.y;
} }
m_Parent->m_CurrentScreen->SetModify(); m_Parent->GetScreen()->SetModify();
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE );
m_Parent->TestDanglingEnds( m_Parent->m_CurrentScreen->EEDrawList, &dc ); m_Parent->TestDanglingEnds( m_Parent->GetScreen()->EEDrawList, &dc );
EndModal( 0 ); EndModal( 0 );
} }
@ -454,7 +458,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC )
int x1, y1; int x1, y1;
EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) CurrentField->m_Parent; EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) CurrentField->m_Parent;
delete g_ItemToUndoCopy; SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = Cmp->GenCopy(); g_ItemToUndoCopy = Cmp->GenCopy();
pos = Cmp->m_Pos; pos = Cmp->m_Pos;
@ -476,7 +480,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC )
newpos.y = pos.y + Cmp->m_Transform[0][1] * x1 + Cmp->m_Transform[1][1] * y1; newpos.y = pos.y + Cmp->m_Transform[0][1] * x1 + Cmp->m_Transform[1][1] * y1;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = newpos; GetScreen()->m_Curseur = newpos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
OldPos = Field->m_Pos; OldPos = Field->m_Pos;
@ -561,6 +565,9 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
Field->m_Size.x = Field->m_Size.y = TextFieldSize; Field->m_Size.x = Field->m_Size.y = TextFieldSize;
} }
Field->m_Text = newtext; Field->m_Text = newtext;
if( FieldNumber == REFERENCE ){
Cmp->SetRef(GetSheet(), newtext);
}
} }
else /* Nouveau texte NULL */ else /* Nouveau texte NULL */
{ {
@ -580,7 +587,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); DrawTextField( DrawPanel, DC, Field, flag, g_XorMode );
Cmp->Display_Infos( this ); Cmp->Display_Infos( this );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
} }
@ -633,7 +640,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC )
DrawTextField( Panel, DC, CurrentField, Multiflag, GR_DEFAULT_DRAWMODE ); DrawTextField( Panel, DC, CurrentField, Multiflag, GR_DEFAULT_DRAWMODE );
} }
CurrentField = NULL; CurrentField = NULL;
delete g_ItemToUndoCopy; g_ItemToUndoCopy = NULL; SAFE_DELETE( g_ItemToUndoCopy );
} }
@ -725,7 +732,6 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
/**************************************************************************************************/ /**************************************************************************************************/
/* Edit the component text reference*/ /* Edit the component text reference*/
{ {
wxString msg;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
int flag = 0; int flag = 0;
@ -739,19 +745,18 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
if( Entry->m_UnitCount > 1 ) if( Entry->m_UnitCount > 1 )
flag = 1; flag = 1;
PartTextStruct* TextField = &Cmp->m_Field[REFERENCE]; wxString ref = Cmp->GetRef(GetSheet());
Get_Message( _( "Reference" ), ref, this );
msg = TextField->m_Text; if( !ref.IsEmpty() ) // New text entered
Get_Message( _( "Reference" ), msg, this );
if( !msg.IsEmpty() ) // New text entered
{ {
/* save old cmp in undo list if not already in edit, or moving ... */ /* save old cmp in undo list if not already in edit, or moving ... */
if( Cmp->m_Flags == 0 ) if( Cmp->m_Flags == 0 )
SaveCopyInUndoList( Cmp, IS_CHANGED ); SaveCopyInUndoList( Cmp, IS_CHANGED );
Cmp->SetRef(GetSheet(), ref);
DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, g_XorMode ); DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, g_XorMode );
TextField->m_Text = msg; Cmp->SetRef(GetSheet(), ref );
DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag,
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
GetScreen()->SetModify(); GetScreen()->SetModify();
@ -794,7 +799,7 @@ void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxD
TextField->m_Text = msg; TextField->m_Text = msg;
DrawTextField( DrawPanel, DC, &Cmp->m_Field[VALUE], flag, DrawTextField( DrawPanel, DC, &Cmp->m_Field[VALUE], flag,
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
} }
Cmp->Display_Infos( this ); Cmp->Display_Infos( this );
@ -848,7 +853,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( EDA_SchComponentStruct* Cmp,
DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag, DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag,
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
Cmp->Display_Infos( this ); Cmp->Display_Infos( this );
} }
@ -896,7 +901,7 @@ void WinEDA_ComponentPropertiesFrame::SetInitCmp( wxCommandEvent& event )
m_Cmp->SetRotationMiroir( CMP_NORMAL ); m_Cmp->SetRotationMiroir( CMP_NORMAL );
m_Parent->m_CurrentScreen->SetModify(); m_Parent->GetScreen()->SetModify();
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE );
EndModal( 1 ); EndModal( 1 );

View File

@ -87,6 +87,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
ItemInitialPosition = TextStruct->m_Pos; ItemInitialPosition = TextStruct->m_Pos;
OldSize = TextStruct->m_Size; OldSize = TextStruct->m_Size;
@ -98,7 +99,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
} }
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = ItemInitialPosition; GetScreen()->m_Curseur = ItemInitialPosition;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->SetModify(); GetScreen()->SetModify();
@ -142,7 +143,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
{ {
if( TextStruct == NULL ) if( TextStruct == NULL )
TextStruct = (DrawTextStruct*) PickStruct( GetScreen()->m_Curseur, TextStruct = (DrawTextStruct*) PickStruct( GetScreen()->m_Curseur,
GetScreen()->EEDrawList, TEXTITEM | LABELITEM ); GetScreen(), TEXTITEM | LABELITEM );
if( TextStruct == NULL ) if( TextStruct == NULL )
return; return;
@ -159,6 +160,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
TextStruct->m_Orient++; TextStruct->m_Orient++;
TextStruct->m_Orient &= 3; TextStruct->m_Orient &= 3;
@ -190,15 +192,21 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
switch( type ) switch( type )
{ {
case LAYER_NOTES: case LAYER_NOTES:
NewText = new DrawTextStruct( m_CurrentScreen->m_Curseur ); NewText = new DrawTextStruct( GetScreen()->m_Curseur );
break; break;
case LAYER_LOCLABEL: case LAYER_LOCLABEL:
NewText = new DrawLabelStruct( m_CurrentScreen->m_Curseur ); NewText = new DrawLabelStruct( GetScreen()->m_Curseur );
break;
case LAYER_HIERLABEL:
NewText = new DrawHierLabelStruct(GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel;
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
NewText = new DrawGlobalLabelStruct( m_CurrentScreen->m_Curseur ); NewText = new DrawGlobalLabelStruct(GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel; NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel; NewText->m_Orient = s_DefaultOrientGLabel;
break; break;
@ -216,11 +224,11 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
if( NewText->m_Text.IsEmpty() ) if( NewText->m_Text.IsEmpty() )
{ {
delete NewText; SAFE_DELETE( NewText );
return NULL; return NULL;
} }
if( type == LAYER_GLOBLABEL ) if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL)
{ {
s_DefaultShapeGLabel = NewText->m_Shape; s_DefaultShapeGLabel = NewText->m_Shape;
s_DefaultOrientGLabel = NewText->m_Orient; s_DefaultOrientGLabel = NewText->m_Orient;
@ -230,7 +238,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte; DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
m_CurrentScreen->SetCurItem( NewText ); GetScreen()->SetCurItem( NewText );
return NewText; return NewText;
} }
@ -252,6 +260,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
( (DrawTextStruct*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur; ( (DrawTextStruct*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur;
break; break;
@ -269,7 +278,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************************/ /*************************************************************/
/* Abort function for the command move text */ /* Abort function for the command move text */
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->m_CurrentScreen; SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->GetScreen();
EDA_BaseStruct* Struct = screen->GetCurItem(); EDA_BaseStruct* Struct = screen->GetCurItem();
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
@ -286,7 +295,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
if( Struct->m_Flags & IS_NEW ) if( Struct->m_Flags & IS_NEW )
{ {
delete Struct; SAFE_DELETE( Struct );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
} }
else /* this was a move command on an "old" text: restore its old settings. */ else /* this was a move command on an "old" text: restore its old settings. */
@ -295,6 +304,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
{ {
DrawTextStruct* Text = (DrawTextStruct*) Struct; DrawTextStruct* Text = (DrawTextStruct*) Struct;
@ -336,9 +346,11 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
newtext = new DrawGlobalLabelStruct( Text->m_Pos, Text->m_Text ); newtext = new DrawGlobalLabelStruct(Text->m_Pos, Text->m_Text );
break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
newtext = new DrawHierLabelStruct(Text->m_Pos, Text->m_Text );
break; break;
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
newtext = new DrawTextStruct( Text->m_Pos, Text->m_Text ); newtext = new DrawTextStruct( Text->m_Pos, Text->m_Text );
break; break;
@ -381,13 +393,12 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
{ {
Text->m_Flags = 0; Text->m_Flags = 0;
DeleteStruct( DrawPanel, DC, Text ); DeleteStruct( DrawPanel, DC, Text );
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
} }
GetScreen()->SetCurItem( newtext ); GetScreen()->SetCurItem( newtext );
delete g_ItemToUndoCopy; SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = NULL;
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CursorOff( DC ); // Erase schematic cursor

View File

@ -52,7 +52,7 @@ wxString FullFileName;
case ID_CONFIG_READ: case ID_CONFIG_READ:
{ {
wxString mask( wxT("*") ); mask += g_Prj_Config_Filename_ext; wxString mask( wxT("*") ); mask += g_Prj_Config_Filename_ext;
FullFileName = ScreenSch->m_FileName; FullFileName = g_RootSheet->m_s->m_FileName;
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext ); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Read config file"), FullFileName = EDA_FileSelector(_("Read config file"),
@ -142,7 +142,7 @@ wxString FullFileName;
bool IsRead = TRUE; bool IsRead = TRUE;
wxArrayString liblist_tmp = g_LibName_List; wxArrayString liblist_tmp = g_LibName_List;
if ( CfgFileName.IsEmpty() ) FullFileName = ScreenSch->m_FileName; if ( CfgFileName.IsEmpty() ) FullFileName = g_RootSheet->m_s->m_FileName;
else FullFileName = CfgFileName; else FullFileName = CfgFileName;
g_LibName_List.Clear(); g_LibName_List.Clear();
@ -185,7 +185,7 @@ wxString FullFileName;
wxString mask( wxT("*") ); wxString mask( wxT("*") );
mask += g_Prj_Config_Filename_ext; mask += g_Prj_Config_Filename_ext;
FullFileName = ScreenSch->m_FileName.AfterLast('/') /*ConfigFileName*/; FullFileName = g_RootSheet->m_s->m_FileName.AfterLast('/') /*ConfigFileName*/;
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext ); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
path = wxGetCwd(); path = wxGetCwd();

View File

@ -27,6 +27,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
/* Routine de Trace de segments ( WIRES, BUS ) pour lesquels chaque segment /* Routine de Trace de segments ( WIRES, BUS ) pour lesquels chaque segment
* est une structure. * est une structure.
*/ */
// NOT USED!!!@!@!
{ {
DrawSegmentStruct* oldsegment, * newsegment; DrawSegmentStruct* oldsegment, * newsegment;
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
@ -84,7 +85,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
GetScreen()->ManageCurseur( DrawPanel, DC, FALSE ); GetScreen()->ManageCurseur( DrawPanel, DC, FALSE );
oldsegment->m_EndIsDangling = FALSE; oldsegment->m_EndIsDangling = FALSE;
/* Creation du segment suivant ou fin de tracé si point sur pin, jonction ...*/ /* Creation du segment suivant ou fin de trac<EFBFBD> si point sur pin, jonction ...*/
if( IsTerminalPoint( GetScreen(), oldsegment->m_End, oldsegment->m_Layer ) ) if( IsTerminalPoint( GetScreen(), oldsegment->m_End, oldsegment->m_Layer ) )
{ {
EndSegment( DC ); return; EndSegment( DC ); return;
@ -385,6 +386,8 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) g_ItemToRepeat ) #define STRUCT ( (DrawLabelStruct*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
@ -396,19 +399,6 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
STRUCT->m_Text = Line; STRUCT->m_Text = Line;
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos.x += g_RepeatStep.x; ox = STRUCT->m_Pos.x;
STRUCT->m_Pos.y += g_RepeatStep.y; oy = STRUCT->m_Pos.y;
/*** Increment du numero de label ***/
strcpy( Line, STRUCT->GetText() );
IncrementLabelMember( Line );
STRUCT->m_Text = Line;
break;
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawSegmentStruct*) g_ItemToRepeat ) #define STRUCT ( (DrawSegmentStruct*) g_ItemToRepeat )
@ -479,10 +469,10 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
* - type WIRE, si il y a * - type WIRE, si il y a
* - une jonction * - une jonction
* - ou une pin * - ou une pin
* - ou une extrémité unique de fil * - ou une extr<EFBFBD>mit<EFBFBD> unique de fil
* *
* - type BUS, si il y a * - type BUS, si il y a
* - ou une extrémité unique de BUS * - ou une extr<EFBFBD>mit<EFBFBD> unique de BUS
*/ */
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;

View File

@ -193,7 +193,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
Field->m_HJustify, Field->m_VJustify, LineWidth ); Field->m_HJustify, Field->m_VJustify, LineWidth );
} }
// Tracé de l'ancre // Trac<EFBFBD> de l'ancre
int len = 3 * panel->GetZoom(); int len = 3 * panel->GetZoom();
GRLine( &panel->m_ClipBox, DC, posX, posY - len, posX, posY + len, 0, color ); GRLine( &panel->m_ClipBox, DC, posX, posY - len, posX, posY + len, 0, color );
GRLine( &panel->m_ClipBox, DC, posX - len, posY, posX + len, posY, 0, color ); GRLine( &panel->m_ClipBox, DC, posX - len, posY, posX + len, posY, 0, color );
@ -212,7 +212,7 @@ void EDA_SchComponentStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
bool dummy = FALSE; bool dummy = FALSE;
if( ( Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ) ) == NULL ) if( ( Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ) ) == NULL )
{ /* composant non trouvé, on affiche un composant "dummy" */ { /* composant non trouv<EFBFBD>, on affiche un composant "dummy" */
dummy = TRUE; dummy = TRUE;
if( DummyCmp == NULL ) if( DummyCmp == NULL )
CreateDummyCmp(); CreateDummyCmp();
@ -587,8 +587,8 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
LibDrawPin* Pin = (LibDrawPin*) DEntry; LibDrawPin* Pin = (LibDrawPin*) DEntry;
if( Pin->m_Attributs & PINNOTDRAW ) if( Pin->m_Attributs & PINNOTDRAW )
{ {
if( (ActiveScreen->m_Type == SCHEMATIC_FRAME) if( /*(GetScreen()->m_Type == SCHEMATIC_FRAME )
&& !g_ShowAllPins ) &&*/ !g_ShowAllPins )
break; break;
} }

View File

@ -91,9 +91,9 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
ChangeFileNameExt( FullFileName, DOC_EXT ); ChangeFileNameExt( FullFileName, DOC_EXT );
LoadDocLib( frame, FullFileName, NewLib->m_Name ); LoadDocLib( frame, FullFileName, NewLib->m_Name );
} }
else else{
delete NewLib; SAFE_DELETE( NewLib );
}
fclose( f ); fclose( f );
return NewLib; return NewLib;
} }
@ -237,7 +237,7 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
TempLib->m_Pnext = TempLib->m_Pnext->m_Pnext; TempLib->m_Pnext = TempLib->m_Pnext->m_Pnext;
} }
delete Lib; SAFE_DELETE( Lib );
/* The removed librairy can be the current library in libedit. /* The removed librairy can be the current library in libedit.
* If so, clear the current library in libedit */ * If so, clear the current library in libedit */
@ -483,7 +483,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char
Msg.Printf( wxT( " Error at line %d of library \n\"%s\",\nlibrary not loaded" ), Msg.Printf( wxT( " Error at line %d of library \n\"%s\",\nlibrary not loaded" ),
*LineNum, currentLibraryName.GetData() ); *LineNum, currentLibraryName.GetData() );
DisplayError( frame, Msg ); DisplayError( frame, Msg );
delete LibEntry; SAFE_DELETE( LibEntry );
return NULL; return NULL;
} }
} }
@ -604,7 +604,7 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
if( !Error ) if( !Error )
{ /* Convert '~' to spaces. */ { /* Convert '~' to spaces. */
Text->m_Text = CONV_FROM_UTF8( Buffer ); Text->m_Text = CONV_FROM_UTF8( Buffer );
Text->m_Text.Replace( wxT( "~" ), wxT( " " ) ); // Les espaces sont restitués Text->m_Text.Replace( wxT( "~" ), wxT( " " ) ); // Les espaces sont restitu<EFBFBD>s
} }
} }
break; break;
@ -780,7 +780,7 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
MsgLine.Printf( wxT( "Error in %c DRAW command in line %d, aborted." ), MsgLine.Printf( wxT( "Error in %c DRAW command in line %d, aborted." ),
Line[0], *LineNum ); Line[0], *LineNum );
DisplayError( frame, MsgLine ); DisplayError( frame, MsgLine );
delete New; SAFE_DELETE( New );
/* FLush till end of draw: */ /* FLush till end of draw: */
do { do {
@ -1119,8 +1119,8 @@ static int SortItemsFct( const void* ref, const void* item );
void EDA_LibComponentStruct::SortDrawItems() void EDA_LibComponentStruct::SortDrawItems()
/*******************************************/ /*******************************************/
/* Trie les éléments graphiques d'un composant lib pour améliorer /* Trie les <EFBFBD>l<EFBFBD>ments graphiques d'un composant lib pour am<61>liorer
* le tracé: * le trac<EFBFBD>:
* items remplis en premier, pins en dernier * items remplis en premier, pins en dernier
* En cas de superposition d'items, c'est plus lisible * En cas de superposition d'items, c'est plus lisible
*/ */

View File

@ -1,222 +0,0 @@
/****************************************/
/* Module to load/save EESchema files. */
/****************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "protos.h"
#include "id.h"
static void LoadSubHierarchy( WinEDA_SchematicFrame* frame, EDA_BaseStruct* DrawList );
/* Variables locales */
/************************************************************************************/
int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNew )
/************************************************************************************/
/*
* Load an entire project ( shcematic root file and its subhierarchies, the configuration and the libs
* which are not already loaded)
*/
{
SCH_SCREEN* screen;
wxString FullFileName, msg;
bool LibCacheExist = FALSE;
EDA_ScreenList ScreenList( NULL );
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{
if( screen->IsModify() )
break;
}
if( screen )
{
if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) )
return FALSE;
if( ScreenSch->m_FileName != g_DefaultSchematicFileName )
SetLastProject( ScreenSch->m_FileName );
}
screen = ScreenSch;
FullFileName = FileName;
if( ( FullFileName.IsEmpty() ) && !IsNew )
{
wxString mask = wxT( "*" ) + g_SchExtBuffer;
FullFileName = EDA_FileSelector( _( "Schematic files:" ),
wxEmptyString, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */
g_SchExtBuffer, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE
);
if( FullFileName.IsEmpty() )
return FALSE;
}
if( ClearProjectDrawList( screen, TRUE ) == FALSE )
return 1;
ActiveScreen = m_CurrentScreen = screen = ScreenSch;
ScreenSch->ClearUndoRedoList();
screen->SetCurItem( NULL );
wxSetWorkingDirectory( wxPathOnly( FullFileName ) );
m_CurrentScreen->m_FileName = FullFileName;
Affiche_Message( wxEmptyString );
MsgPanel->EraseMsgBox();
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );
m_CurrentScreen->ClrModify();
m_CurrentScreen->Pnext = NULL;
if( IsNew )
{
screen->m_CurrentSheet = &g_Sheet_A4;
screen->SetZoom( 32 );
screen->m_SheetNumber = screen->m_NumberOfSheet = 1;
screen->m_Title = wxT( "noname.sch" );
m_CurrentScreen->m_FileName = screen->m_Title;
screen->m_Company.Empty();
screen->m_Commentaire1.Empty();
screen->m_Commentaire2.Empty();
screen->m_Commentaire3.Empty();
screen->m_Commentaire4.Empty();
Read_Config( wxEmptyString, TRUE );
Zoom_Automatique( TRUE );
ReDrawPanel();
return 1;
}
// Rechargement de la configuration:
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
PrintMsg( msg );
Read_Config( wxEmptyString, FALSE );
// Delete old caches.
LibraryStruct* nextlib, * lib = g_LibraryList;
for( ; lib != NULL; lib = nextlib )
{
nextlib = lib->m_Pnext;
if( lib->m_IsLibCache )
FreeCmpLibrary( this, lib->m_Name );
}
if( IsNew )
{
ReDrawPanel();
return 1;
}
// Loading the project library cache
wxString FullLibName;
wxString shortfilename;
wxSplitPath( ScreenSch->m_FileName, NULL, &shortfilename, NULL );
FullLibName << wxT( "." ) << STRING_DIR_SEP << shortfilename << wxT( ".cache" ) <<
g_LibExtBuffer;
if( wxFileExists( FullLibName ) )
{
wxString libname;
libname = FullLibName;
ChangeFileNameExt( libname, wxEmptyString );
msg = wxT( "Load " ) + FullLibName;
LibraryStruct* LibCache = LoadLibraryName( this, FullLibName, libname );
if( LibCache )
{
LibCache->m_IsLibCache = TRUE;
msg += wxT( " OK" );
}
else
msg += wxT( " ->Error" );
PrintMsg( msg );
LibCacheExist = TRUE;
}
if( !wxFileExists( ScreenSch->m_FileName ) && !LibCacheExist ) // Nouveau projet prpbablement
{
msg.Printf( _( "File %s not found (new project ?)" ),
ScreenSch->m_FileName.GetData() );
DisplayInfo( this, msg, 20 );
return -1;
}
if( LoadOneEEFile( ScreenSch, ScreenSch->m_FileName ) == FALSE )
return 0;
/* load all subhierarchies fond in current list and new loaded list */
LoadSubHierarchy( this, ScreenSch->EEDrawList );
/* Reaffichage ecran de base (ROOT) si necessaire */
ActiveScreen = ScreenSch;
Zoom_Automatique( FALSE );
return 1;
}
/*******************************************************************************/
void LoadSubHierarchy( WinEDA_SchematicFrame* frame, EDA_BaseStruct* DrawList )
/*******************************************************************************/
/* load subhierarcy when sheets are found in DrawList
* recursive function.
*/
{
EDA_BaseStruct* EEDrawList = DrawList;
while( EEDrawList )
{
if( EEDrawList->Type() == DRAW_SHEET_STRUCT_TYPE )
{
#undef STRUCT
#define STRUCT ( (DrawSheetStruct*) EEDrawList )
int timestamp = STRUCT->m_TimeStamp;
if( timestamp == 0 )
{
timestamp = GetTimeStamp();
STRUCT->m_TimeStamp = timestamp;
}
if( !STRUCT->m_FileName.IsEmpty() )
{
//problem -- must check for closed loops here, or we may never exit!
//search back up the linked list tree...
EDA_BaseStruct* strct = EEDrawList;
bool noRecurse = true;
while( strct->m_Parent ){
strct = strct->m_Parent;
if( ((DrawSheetStruct*)strct)->m_FileName ==
STRUCT->m_FileName ){
wxString msg;
msg += wxString::Format(_( "The sheet hierarchy has an infinite loop, halting recursive loads. file: "));
msg += STRUCT->m_FileName;
DisplayError( frame, msg );
noRecurse = false;
}
}
if( frame->LoadOneEEFile( STRUCT, STRUCT->m_FileName ) == TRUE && noRecurse)
{
LoadSubHierarchy( frame, STRUCT->EEDrawList );
}
}
else
DisplayError( frame, _( "No FileName in SubSheet" ) );
}
EEDrawList = EEDrawList->Pnext;
}
}

View File

@ -35,7 +35,7 @@ char marq_bitmap[]=
char marqERC_bitmap[]= char marqERC_bitmap[]=
{ {
8, 8, 0, 0, /* Dimensions x et y , offsets x et y du bitmap de marqueurs*/ 8, 8, 0, 0, /* Dimensions x et y , offsets x et y du bitmap de marqueurs*/
-1, /* Color: -1 = couleur non précisée */ -1, /* Color: -1 = couleur non pr<EFBFBD>cis<EFBFBD>e */
1,1,1,1,1,0,0,0, 1,1,1,1,1,0,0,0,
1,1,1,0,1,0,0,0, 1,1,1,0,1,0,0,0,
1,1,1,1,0,0,0,0, 1,1,1,1,0,0,0,0,
@ -129,18 +129,18 @@ wxString title;
void WinEDA_DrawPanel::PrintPage(wxDC * DC, bool Print_Sheet_Ref, int PrintMask) void WinEDA_DrawPanel::PrintPage(wxDC * DC, bool Print_Sheet_Ref, int PrintMask)
/*******************************************************************************/ /*******************************************************************************/
{ {
BASE_SCREEN * screen, * oldscreen = m_Parent->GetScreen(); BASE_SCREEN * screen; // * oldscreen = m_Parent->GetScreen();
wxBeginBusyCursor(); wxBeginBusyCursor();
screen = m_Parent->m_CurrentScreen = ActiveScreen; ActiveScreen = screen = m_Parent->GetScreen();
RedrawStructList(this,DC, screen->EEDrawList, GR_COPY); RedrawStructList(this,DC, screen->EEDrawList, GR_COPY);
if ( Print_Sheet_Ref ) if ( Print_Sheet_Ref )
m_Parent->TraceWorkSheet(DC, screen, g_DrawMinimunLineWidth ); m_Parent->TraceWorkSheet(DC, screen, g_DrawMinimunLineWidth );
m_Parent->m_CurrentScreen = oldscreen; //m_Parent->m_CurrentSheet->m_s = oldscreen;
wxEndBusyCursor(); wxEndBusyCursor();
} }
@ -223,7 +223,7 @@ void DrawMarkerStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint &
int DrawMode, int Color) int DrawMode, int Color)
/****************************************************************************************/ /****************************************************************************************/
{ {
#define WAR 1 // utilisé aussi dans erc.cpp #define WAR 1 // utilis<EFBFBD> aussi dans erc.cpp
if( m_Type == MARQ_ERC ) if( m_Type == MARQ_ERC )
{ {
@ -420,6 +420,8 @@ int width = g_DrawMinimunLineWidth;
} }
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
{ {
DrawLabelStruct * Struct; DrawLabelStruct * Struct;
Struct = (DrawLabelStruct * ) DrawStruct; Struct = (DrawLabelStruct * ) DrawStruct;
@ -429,16 +431,6 @@ int width = g_DrawMinimunLineWidth;
break; break;
} }
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
{
DrawGlobalLabelStruct * Struct;
Struct = (DrawGlobalLabelStruct * ) DrawStruct;
Struct->m_Pos.x += dx; Struct->m_Pos.y += dy;
Struct->Draw(panel, DC, wxPoint(0,0),DrawMode,g_GhostColor);
Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy;
break;
}
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
{ {
DrawNoConnectStruct * Struct; DrawNoConnectStruct * Struct;

View File

@ -24,10 +24,6 @@
#include "bitmaps.h" #include "bitmaps.h"
#include "eda_dde.h" #include "eda_dde.h"
/* Routines locales */
static void CreateScreens();
// Global variables // Global variables
wxString g_Main_Title( wxT( "EESchema" ) ); wxString g_Main_Title( wxT( "EESchema" ) );
@ -61,8 +57,6 @@ bool WinEDA_App::OnInit()
if( argc > 1 ) if( argc > 1 )
FFileName = argv[1]; FFileName = argv[1];
CreateScreens();
/* init EESCHEMA */ /* init EESCHEMA */
GetSettings(); // read current setup GetSettings(); // read current setup
SeedLayers(); SeedLayers();
@ -106,25 +100,3 @@ bool WinEDA_App::OnInit()
return TRUE; return TRUE;
} }
/******************************/
static void CreateScreens()
/******************************/
/*
* Fonction d'init des écrans utilisés dans EESchema:
*/
{
/* creation des ecrans Sch , Lib */
if( ScreenSch == NULL )
ScreenSch = new SCH_SCREEN( SCHEMATIC_FRAME );
ScreenSch->m_FileName = g_DefaultSchematicFileName;
ScreenSch->m_Date = GenDate();
ActiveScreen = ScreenSch;
if( ScreenLib == NULL )
ScreenLib = new SCH_SCREEN( LIBEDITOR_FRAME );
ScreenLib->SetZoom( 4 );
ScreenLib->m_UndoRedoCountMax = 10;
}

View File

@ -51,7 +51,7 @@ int WriteFichierERC = FALSE;
* PIN_OPENEMITTER, PIN_NC * PIN_OPENEMITTER, PIN_NC
*/ */
#define OK 0 #define OK 0
#define WAR 1 // utilisé aussi dans eeredraw #define WAR 1 // utilis<EFBFBD> aussi dans eeredraw
#define ERR 2 #define ERR 2
#define UNC 3 #define UNC 3
@ -185,7 +185,7 @@ void WinEDA_ErcFrame::ReBuildMatrixPanel()
text_height = text->GetRect().GetHeight(); text_height = text->GetRect().GetHeight();
bitmap_size = MAX( bitmap_size, text_height ); bitmap_size = MAX( bitmap_size, text_height );
delete text; SAFE_DELETE( text );
// compute the Y pos interval: // compute the Y pos interval:
BoxMatrixMinSize.y = ( bitmap_size * (PIN_NMAX + 1) ) + 5; BoxMatrixMinSize.y = ( bitmap_size * (PIN_NMAX + 1) ) + 5;
@ -313,7 +313,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
g_EESchemaVar.NbWarningErc = 0; g_EESchemaVar.NbWarningErc = 0;
/* Cleanup the entire hierarchy */ /* Cleanup the entire hierarchy */
EDA_ScreenList ScreenList( NULL ); EDA_ScreenList ScreenList;
for( SCH_SCREEN* Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() ) for( SCH_SCREEN* Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() )
{ {
@ -358,10 +358,12 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
case NET_LABEL: case NET_LABEL:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_PINLABEL: case NET_PINLABEL:
case NET_GLOBLABEL: //not sure how to handle global labels -- they should be treated like other nets (just global!0
case NET_GLOBBUSLABELMEMBER:
break; break;
case NET_GLOBLABEL: case NET_HIERLABEL:
case NET_GLOBBUSLABELMEMBER: case NET_HIERBUSLABELMEMBER:
case NET_SHEETLABEL: case NET_SHEETLABEL:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
TestLabel( m_Parent->DrawPanel, &dc, NetItemRef, StartNet ); TestLabel( m_Parent->DrawPanel, &dc, NetItemRef, StartNet );
@ -398,7 +400,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
if( WriteFichierERC == TRUE ) if( WriteFichierERC == TRUE )
{ {
wxString ErcFullFileName; wxString ErcFullFileName;
ErcFullFileName = ScreenSch->m_FileName; ErcFullFileName = g_RootSheet->m_s->m_FileName;
ChangeFileNameExt( ErcFullFileName, wxT( ".erc" ) ); ChangeFileNameExt( ErcFullFileName, wxT( ".erc" ) );
ErcFullFileName = EDA_FileSelector( _( "ERC file:" ), ErcFullFileName = EDA_FileSelector( _( "ERC file:" ),
wxEmptyString, /* Chemin par defaut */ wxEmptyString, /* Chemin par defaut */
@ -542,7 +544,7 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
Marker->m_Type = MARQ_ERC; Marker->m_Type = MARQ_ERC;
Marker->m_MarkFlags = WAR; Marker->m_MarkFlags = WAR;
screen = NetItemRef->m_Screen; screen = NetItemRef->m_SheetList.LastScreen();
Marker->Pnext = screen->EEDrawList; Marker->Pnext = screen->EEDrawList;
screen->EEDrawList = Marker; screen->EEDrawList = Marker;
g_EESchemaVar.NbErrorErc++; g_EESchemaVar.NbErrorErc++;
@ -550,14 +552,14 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
if( MinConn < 0 ) // Traitement des erreurs sur labels if( MinConn < 0 ) // Traitement des erreurs sur labels
{ {
if( (NetItemRef->m_Type == NET_GLOBLABEL) if( (NetItemRef->m_Type == NET_HIERLABEL)
|| (NetItemRef->m_Type == NET_GLOBBUSLABELMEMBER) ) || (NetItemRef->m_Type == NET_HIERBUSLABELMEMBER) )
{ {
Marker->m_Comment.Printf( _( "Warning GLabel %s not connected to SheetLabel" ), Marker->m_Comment.Printf( _( "Warning HLabel %s not connected to SheetLabel" ),
NetItemRef->m_Label->GetData() ); NetItemRef->m_Label->GetData() );
} }
else else
Marker->m_Comment.Printf( _( "Warning SheetLabel %s not connected to GLabel" ), Marker->m_Comment.Printf( _( "Warning SheetLabel %s not connected to HLabel" ),
NetItemRef->m_Label->GetData() ); NetItemRef->m_Label->GetData() );
if( screen == panel->GetScreen() ) if( screen == panel->GetScreen() )
@ -656,7 +658,7 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
|| (NetItemRef->GetNet() != NetItemTst->GetNet()) ) // fin de net || (NetItemRef->GetNet() != NetItemTst->GetNet()) ) // fin de net
{ /* Fin de netcode trouve: Tst connexion minimum */ { /* Fin de netcode trouve: Tst connexion minimum */
if( (*MinConnexion < NET_NC ) if( (*MinConnexion < NET_NC )
&& (local_minconn < NET_NC ) ) /* pin non connectée ou non pilotee */ && (local_minconn < NET_NC ) ) /* pin non connect<EFBFBD>e ou non pilotee */
{ {
Diagnose( panel, DC, NetItemRef, NULL, local_minconn, WAR ); Diagnose( panel, DC, NetItemRef, NULL, local_minconn, WAR );
*MinConnexion = DRV; // inhibition autres messages de ce type pour ce net *MinConnexion = DRV; // inhibition autres messages de ce type pour ce net
@ -670,11 +672,13 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
case NET_BUS: case NET_BUS:
case NET_JONCTION: case NET_JONCTION:
case NET_LABEL: case NET_LABEL:
case NET_GLOBLABEL: case NET_HIERLABEL:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_HIERBUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_SHEETLABEL: case NET_SHEETLABEL:
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
case NET_PINLABEL: case NET_PINLABEL:
break; break;
@ -719,7 +723,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
DrawMarkerStruct* Marker; DrawMarkerStruct* Marker;
char Line[256]; char Line[256];
static FILE* OutErc; static FILE* OutErc;
DrawSheetStruct* Sheet; DrawSheetList* Sheet;
wxString msg; wxString msg;
if( ( OutErc = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL ) if( ( OutErc = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
@ -730,19 +734,20 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
fprintf( OutErc, "%s (%s)\n", CONV_TO_UTF8( msg ), Line ); fprintf( OutErc, "%s (%s)\n", CONV_TO_UTF8( msg ), Line );
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
for( SCH_SCREEN* Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() ) for( Sheet = SheetList.GetFirst(); Sheet != NULL; Sheet = SheetList.GetNext() )
{ {
Sheet = (DrawSheetStruct*) Screen; if(Sheet->Last() == g_RootSheet){
msg.Printf( _( "\n***** Sheet Root\n" ) );
msg.Printf( _( "\n***** Sheet %d (%s)\n" ), }else{
Sheet->m_SheetNumber, wxString str = Sheet->Path();
Screen == ScreenSch ? _( "Root" ) : Sheet->m_SheetName.GetData() ); msg.Printf( _("\n***** Sheet %s\n"), str.GetData() );
}
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) ); fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) );
DrawStruct = Screen->EEDrawList; DrawStruct = Sheet->LastDrawList();
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE )
@ -770,7 +775,18 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
return TRUE; return TRUE;
} }
bool TestLabel_( ObjetNetListStruct* a, ObjetNetListStruct* b )
{
int at = a->m_Type;
int bt = b->m_Type;
if( (at == NET_HIERLABEL || at == NET_HIERBUSLABELMEMBER)
&&(bt == NET_SHEETLABEL || bt == NET_SHEETBUSLABELMEMBER) ){
if( a->m_SheetList == b->m_SheetListInclude ){
return true; //connected!
}
}
return false; //these two are unconnected
}
/***********************************************************************/ /***********************************************************************/
void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC, void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC,
ObjetNetListStruct* NetItemRef, ObjetNetListStruct* StartNet ) ObjetNetListStruct* NetItemRef, ObjetNetListStruct* StartNet )
@ -799,66 +815,16 @@ void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC,
|| ( NetItemRef->GetNet() != NetItemTst->GetNet() ) ) || ( NetItemRef->GetNet() != NetItemTst->GetNet() ) )
{ {
/* Fin de netcode trouve */ /* Fin de netcode trouve */
if( erc ) if( erc ){
{
/* GLabel ou SheetLabel orphelin */ /* GLabel ou SheetLabel orphelin */
Diagnose( panel, DC, NetItemRef, NULL, -1, WAR ); Diagnose( panel, DC, NetItemRef, NULL, -1, WAR );
} }
return; return;
} }
if(TestLabel_(NetItemRef, NetItemTst))
if( (NetItemRef->m_Type == NET_GLOBLABEL)
|| (NetItemRef->m_Type == NET_GLOBBUSLABELMEMBER) )
{
switch( NetItemTst->m_Type )
{
case NET_SEGMENT:
case NET_BUS:
case NET_JONCTION:
case NET_LABEL:
case NET_GLOBLABEL:
case NET_BUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER:
case NET_PINLABEL:
case NET_NOCONNECT:
case NET_PIN:
break;
case NET_SHEETBUSLABELMEMBER:
case NET_SHEETLABEL:
/* Tst si le GLabel est bien dans la bonne sousfeuille */
if( NetItemRef->m_SheetNumber == NetItemTst->m_NumInclude )
{
erc = 0; erc = 0;
} //same thing, different order.
break; if(TestLabel_(NetItemTst, NetItemRef))
}
}
else
{
switch( NetItemTst->m_Type )
{
case NET_SEGMENT:
case NET_BUS:
case NET_JONCTION:
case NET_LABEL:
case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER:
case NET_SHEETLABEL:
case NET_PINLABEL:
case NET_NOCONNECT:
case NET_PIN:
break;
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
/* Tst si le GLabel est bien dans la bonne sous-feuille */
if( NetItemTst->m_SheetNumber == NetItemRef->m_NumInclude )
{
erc = 0; erc = 0;
} }
break;
}
}
}
} }

View File

@ -20,7 +20,7 @@
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
/****************************************************************/ /****************************************************************/
/* Commands to save shepatic project or the current page. /* Commands to save project or the current page.
*/ */
{ {
int id = event.GetId(); int id = event.GetId();
@ -28,7 +28,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_SAVE_PROJECT: /* Update Schematic File */ case ID_SAVE_PROJECT: /* Update Schematic File */
SaveProject( this ); SaveProject( );
break; break;
case ID_SAVE_ONE_SHEET: /* Update Schematic File */ case ID_SAVE_ONE_SHEET: /* Update Schematic File */
@ -47,26 +47,25 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
/******************************************************************************************/ /******************************************************************************************/
bool WinEDA_SchematicFrame::LoadOneSheet( SCH_SCREEN* screen, const wxString& filename ) //bool WinEDA_SchematicFrame::LoadOneSheet(DrawSheetStruct* sheet, const wxString& filename )
/******************************************************************************************/ /******************************************************************************************/
{ //{
// return FALSE;
//when is this used? and why?
/*
//this must be called with a non-null pointer screen pointer, clearly.
//also note that this is for reading in a *root* file
wxString FullFileName = filename; wxString FullFileName = filename;
if( screen->EEDrawList != NULL )
{
if( !IsOK( this, _( "Clear SubHierarchy ?" ) ) )
return FALSE;
}
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
{ {
wxString mask; wxString mask;
mask = wxT( "*" ) + g_SchExtBuffer; mask = wxT( "*" ) + g_SchExtBuffer;
FullFileName = EDA_FileSelector( _( "Schematic files:" ), FullFileName = EDA_FileSelector( _( "Schematic files:" ),
wxEmptyString, /* default path */ wxEmptyString, //default path
screen->m_FileName, /* default filename */ sheet->m_s->m_FileName,// default filename
g_SchExtBuffer, /* extension par defaut */ g_SchExtBuffer, // extension par defaut
mask, /* Masque d'affichage */ mask, // Masque d'affichage
this, this,
wxFD_OPEN, wxFD_OPEN,
FALSE FALSE
@ -76,52 +75,212 @@ bool WinEDA_SchematicFrame::LoadOneSheet( SCH_SCREEN* screen, const wxString& fi
} }
ClearProjectDrawList( screen, TRUE ); ClearProjectDrawList( screen, TRUE );
printf("in LoadOneScreen setting screen filename: %s \n", (const char*) FullFileName.mb_str() );
screen->m_FileName = FullFileName; screen->m_FileName = FullFileName;
LoadOneEEFile( screen, FullFileName ); LoadDrawSheet( DrawSheetStruct * sheet, filename);
screen->SetModify(); screen->SetModify();
if( GetScreen() == screen ) if( GetScreen() == screen )
Refresh( TRUE ); Refresh( TRUE );
return TRUE; return TRUE;
*/
//}
/************************************************************************************/
int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNew )
/************************************************************************************/
{
/*
* Load an entire project
* ( schematic root file and its subhierarchies, the configuration and the libs
* which are not already loaded)
*/
SCH_SCREEN* screen;
wxString FullFileName, msg;
bool LibCacheExist = FALSE;
EDA_ScreenList ScreenList;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{
if( screen->IsModify() )
break;
}
if( screen )
{
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 );
}
FullFileName = FileName;
if( ( FullFileName.IsEmpty() ) && !IsNew )
{
wxString mask = wxT( "*" ) + g_SchExtBuffer;
FullFileName = EDA_FileSelector( _( "Schematic files:" ),
wxEmptyString, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */
g_SchExtBuffer, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE
);
if( FullFileName.IsEmpty() )
return FALSE;
}
if(g_RootSheet){
SAFE_DELETE(g_RootSheet);
}
CreateScreens();
screen = (SCH_SCREEN*)GetScreen();
wxSetWorkingDirectory( wxPathOnly( FullFileName ) );
GetScreen()->m_FileName = FullFileName;
g_RootSheet->m_FileName = FullFileName;
Affiche_Message( wxEmptyString );
MsgPanel->EraseMsgBox();
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );
GetScreen()->ClrModify();
//m_CurrentSheet->m_s->Pnext = NULL; should be by default
if( IsNew )
{
screen->m_CurrentSheetDesc = &g_Sheet_A4;
screen->SetZoom( 32 );
screen->m_ScreenNumber = screen->m_NumberOfScreen = 1;
screen->m_Title = wxT( "noname.sch" );
GetScreen()->m_FileName = screen->m_Title;
screen->m_Company.Empty();
screen->m_Commentaire1.Empty();
screen->m_Commentaire2.Empty();
screen->m_Commentaire3.Empty();
screen->m_Commentaire4.Empty();
Read_Config( wxEmptyString, TRUE );
Zoom_Automatique( TRUE );
ReDrawPanel();
return 1;
}
// Rechargement de la configuration:
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
PrintMsg( msg );
Read_Config( wxEmptyString, FALSE );
// Delete old caches.
LibraryStruct* nextlib, * lib = g_LibraryList;
for( ; lib != NULL; lib = nextlib )
{
nextlib = lib->m_Pnext;
if( lib->m_IsLibCache )
FreeCmpLibrary( this, lib->m_Name );
}
if( IsNew )
{
ReDrawPanel();
return 1;
}
// Loading the project library cache
wxString FullLibName;
wxString shortfilename;
wxSplitPath( g_RootSheet->m_s->m_FileName, NULL, &shortfilename, NULL );
FullLibName << wxT( "." ) << STRING_DIR_SEP << shortfilename << wxT( ".cache" ) <<
g_LibExtBuffer;
if( wxFileExists( FullLibName ) )
{
wxString libname;
libname = FullLibName;
ChangeFileNameExt( libname, wxEmptyString );
msg = wxT( "Load " ) + FullLibName;
LibraryStruct* LibCache = LoadLibraryName( this, FullLibName, libname );
if( LibCache )
{
LibCache->m_IsLibCache = TRUE;
msg += wxT( " OK" );
}
else
msg += wxT( " ->Error" );
PrintMsg( msg );
LibCacheExist = TRUE;
}
if( !wxFileExists( g_RootSheet->m_s->m_FileName ) && !LibCacheExist ) // Nouveau projet prpbablement
{
msg.Printf( _( "File %s not found (new project ?)" ),
g_RootSheet->m_s->m_FileName.GetData() );
DisplayInfo( this, msg, 20 );
return -1;
}
//load the project.
SAFE_DELETE(g_RootSheet->m_s);
if(!g_RootSheet->Load(this))
return 0;
/* Reaffichage ecran de base (ROOT) si necessaire */
ActiveScreen = GetScreen();
Zoom_Automatique( FALSE );
DrawPanel->Refresh( TRUE );
return 1;
}
/**********************************************************/
SCH_SCREEN * WinEDA_SchematicFrame::CreateNewScreen(
SCH_SCREEN * OldScreen, int TimeStamp)
/**********************************************************/
/* Routine de creation ( par allocation memoire ) d'un nouvel ecran
cet ecran est en chainage arriere avec OldScreen
la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
*/
{
SCH_SCREEN * NewScreen;
NewScreen = new SCH_SCREEN(SCHEMATIC_FRAME);
NewScreen->SetRefreshReq();
if(OldScreen) NewScreen->m_Company = OldScreen->m_Company;
NewScreen->m_TimeStamp = TimeStamp;
NewScreen->Pback = OldScreen;
return(NewScreen);
} }
/****************************************************/ /****************************************************/
void SaveProject( WinEDA_SchematicFrame* frame ) void WinEDA_SchematicFrame::SaveProject( )
/****************************************************/ /****************************************************/
/* Sauvegarde toutes les feuilles du projet /* Sauvegarde toutes les feuilles du projet
* et crée une librairie archive des composants, de nom <root_name>.chche.lib * et cr<EFBFBD>e une librairie archive des composants, de nom <root_name>.chche.lib
*/ */
{ {
SCH_SCREEN* screen_tmp; SCH_SCREEN* screen_tmp, *screen;
wxString LibArchiveFileName; wxString LibArchiveFileName;
if( frame == NULL ) screen_tmp = (SCH_SCREEN*)GetScreen(); //save...
return;
screen_tmp = frame->GetScreen(); EDA_ScreenList ScreenList;
EDA_ScreenList ScreenList( NULL ); for( screen = ScreenList.GetFirst(); screen != NULL;
screen = ScreenList.GetNext() )
for( ActiveScreen = ScreenList.GetFirst();
ActiveScreen != NULL;
ActiveScreen = ScreenList.GetNext() )
{ {
frame->m_CurrentScreen = ActiveScreen; printf("SaveEEFile, %s\n", (const char*)screen->m_FileName.mb_str() );
frame->SaveEEFile( NULL, FILE_SAVE_AS ); SaveEEFile( screen, FILE_SAVE_AS );
} }
frame->m_CurrentScreen = ActiveScreen = screen_tmp;
/* Creation du fichier d'archivage composants en repertoire courant */ /* Creation du fichier d'archivage composants en repertoire courant */
LibArchiveFileName = MakeFileName( wxEmptyString, ScreenSch->m_FileName, wxEmptyString ); LibArchiveFileName = MakeFileName( wxEmptyString, GetScreen()->m_FileName, wxEmptyString );
ChangeFileNameExt( LibArchiveFileName, wxEmptyString ); ChangeFileNameExt( LibArchiveFileName, wxEmptyString );
/* mise a jour extension */ /* mise a jour extension */
LibArchiveFileName += wxT( ".cache" ) + g_LibExtBuffer; LibArchiveFileName += wxT( ".cache" ) + g_LibExtBuffer;
LibArchive( frame, LibArchiveFileName ); LibArchive( this, LibArchiveFileName );
} }
@ -132,10 +291,14 @@ int CountCmpNumber()
/* Routine retournant le nombre de composants dans le schema, /* Routine retournant le nombre de composants dans le schema,
* powers non comprises */ * powers non comprises */
{ {
return g_RootSheet->ComponentCount();
/*
BASE_SCREEN* Window; BASE_SCREEN* Window;
EDA_BaseStruct* Phead; EDA_BaseStruct* Phead;
int Nb = 0; int Nb = 0;
Window = ScreenSch; Window = ScreenSch;
while( Window ) while( Window )
{ {
@ -153,4 +316,5 @@ int CountCmpNumber()
} }
return Nb; return Nb;
*/
} }

View File

@ -79,7 +79,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
* @param mouseWarp If true, then move the mouse cursor to the item. * @param mouseWarp If true, then move the mouse cursor to the item.
*/ */
{ {
SCH_SCREEN* Screen, * ScreenWithComponentFound = NULL; DrawSheetList* sheet, * SheetWithComponentFound = NULL;
EDA_BaseStruct* DrawList = NULL; EDA_BaseStruct* DrawList = NULL;
EDA_SchComponentStruct* Component = NULL; EDA_SchComponentStruct* Component = NULL;
wxSize DrawAreaSize = DrawPanel->GetClientSize(); wxSize DrawAreaSize = DrawPanel->GetClientSize();
@ -89,25 +89,25 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
wxString msg; wxString msg;
LibDrawPin* pin; LibDrawPin* pin;
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
Screen = ScreenList.GetFirst(); sheet = SheetList.GetFirst();
if( !Find_in_hierarchy ) if( !Find_in_hierarchy )
Screen = (SCH_SCREEN*) m_CurrentScreen; sheet = m_CurrentSheet;
for( ; Screen != NULL; Screen = ScreenList.GetNext() ) for( ; sheet != NULL; sheet = SheetList.GetNext() )
{ {
DrawList = Screen->EEDrawList; DrawList = sheet->LastDrawList();
for( ; (DrawList != NULL) && (NotFound == true); DrawList = DrawList->Pnext ) for( ; (DrawList != NULL) && (NotFound == true); DrawList = DrawList->Pnext )
{ {
if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
EDA_SchComponentStruct* pSch; EDA_SchComponentStruct* pSch;
pSch = (EDA_SchComponentStruct*) DrawList; pSch = (EDA_SchComponentStruct*) DrawList;
if( component_reference.CmpNoCase( pSch->m_Field[REFERENCE].m_Text ) == 0 ) if( component_reference.CmpNoCase( pSch->GetRef(sheet) ) == 0 )
{ {
Component = pSch; Component = pSch;
ScreenWithComponentFound = Screen; SheetWithComponentFound = sheet;
switch( SearchType ) switch( SearchType )
{ {
@ -149,11 +149,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
if( Component ) if( Component )
{ {
Screen = ScreenWithComponentFound; sheet = SheetWithComponentFound;
if( Screen != GetScreen() ) if( sheet != GetSheet() )
{ {
Screen->SetZoom( GetScreen()->GetZoom() ); sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
m_CurrentScreen = ActiveScreen = Screen; *m_CurrentSheet = *sheet;
ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences();
DoCenterAndRedraw = TRUE; DoCenterAndRedraw = TRUE;
} }
wxPoint delta; wxPoint delta;
@ -164,18 +166,18 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
pos = delta + Component->m_Pos; pos = delta + Component->m_Pos;
wxPoint old_cursor_position = Screen->m_Curseur; wxPoint old_cursor_position = sheet->LastScreen()->m_Curseur;
Screen->m_Curseur = pos; sheet->LastScreen()->m_Curseur = pos;
curpos = DrawPanel->CursorScreenPosition(); curpos = DrawPanel->CursorScreenPosition();
DrawPanel->GetViewStart( DrawPanel->GetViewStart(
&m_CurrentScreen->m_StartVisu.x, &( GetScreen()->m_StartVisu.x ),
&m_CurrentScreen->m_StartVisu.y ); &( GetScreen()->m_StartVisu.y ));
// calcul des coord curseur avec origine = screen // calcul des coord curseur avec origine = screen
curpos.x -= m_CurrentScreen->m_StartVisu.x; curpos.x -= GetScreen()->m_StartVisu.x;
curpos.y -= m_CurrentScreen->m_StartVisu.y; curpos.y -= GetScreen()->m_StartVisu.y;
/* Il y a peut-etre necessite de recadrer le dessin: */ /* Il y a peut-etre necessite de recadrer le dessin: */
#define MARGIN 30 #define MARGIN 30
@ -194,13 +196,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
EXCHG( old_cursor_position, Screen->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
if( mouseWarp ) if( mouseWarp )
GRMouseWarp( DrawPanel, curpos ); GRMouseWarp( DrawPanel, curpos );
EXCHG( old_cursor_position, Screen->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
} }
@ -273,7 +275,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
* SearchType = 0: search the first marker, else search next marker * SearchType = 0: search the first marker, else search next marker
*/ */
{ {
SCH_SCREEN* Screen, * FirstScreen = NULL; DrawSheetList* sheet, * FirstSheet = NULL;
EDA_BaseStruct* DrawList, * FirstStruct = NULL, * Struct = NULL; EDA_BaseStruct* DrawList, * FirstStruct = NULL, * Struct = NULL;
DrawMarkerStruct* Marker = NULL; DrawMarkerStruct* Marker = NULL;
int StartCount; int StartCount;
@ -289,13 +291,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
if( SearchType == 0 ) if( SearchType == 0 )
s_MarkerCount = 0; s_MarkerCount = 0;
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
NotFound = TRUE; StartCount = 0; NotFound = TRUE; StartCount = 0;
/* Search for s_MarkerCount markers */ /* Search for s_MarkerCount markers */
for( Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
DrawList = Screen->EEDrawList; DrawList = sheet->LastDrawList();
while( DrawList && NotFound ) while( DrawList && NotFound )
{ {
if( DrawList->Type() == DRAW_MARKER_STRUCT_TYPE ) if( DrawList->Type() == DRAW_MARKER_STRUCT_TYPE )
@ -303,9 +305,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
Marker = (DrawMarkerStruct*) DrawList; Marker = (DrawMarkerStruct*) DrawList;
NotFound = FALSE; NotFound = FALSE;
pos = Marker->m_Pos; pos = Marker->m_Pos;
if( FirstScreen == NULL ) /* First item found */ if( FirstSheet == NULL ) /* First item found */
{ {
FirstScreen = Screen; firstpos = pos; FirstSheet = sheet; firstpos = pos;
FirstStruct = DrawList; FirstStruct = DrawList;
} }
@ -326,31 +328,33 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
break; break;
} }
if( NotFound && FirstScreen ) // markers are found, but we have reach the last marker */ if( NotFound && FirstSheet ) // markers are found, but we have reach the last marker */
{ // After the last marker, the first marker is used */ { // After the last marker, the first marker is used */
NotFound = FALSE; Screen = FirstScreen; NotFound = FALSE; sheet = FirstSheet;
Struct = FirstStruct; Struct = FirstStruct;
pos = firstpos; s_MarkerCount = 1; pos = firstpos; s_MarkerCount = 1;
} }
if( NotFound == FALSE ) if( NotFound == FALSE )
{ {
if( Screen != GetScreen() ) if( sheet != GetSheet() )
{ {
Screen->SetZoom( GetScreen()->GetZoom() ); sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
m_CurrentScreen = ActiveScreen = Screen; *m_CurrentSheet = *sheet;
ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences();
DoCenterAndRedraw = TRUE; DoCenterAndRedraw = TRUE;
} }
old_cursor_position = Screen->m_Curseur; old_cursor_position = sheet->LastScreen()->m_Curseur;
Screen->m_Curseur = pos; sheet->LastScreen()->m_Curseur = pos;
curpos = DrawPanel->CursorScreenPosition(); curpos = DrawPanel->CursorScreenPosition();
// calcul des coord curseur avec origine = screen // calcul des coord curseur avec origine = screen
DrawPanel->GetViewStart( &m_CurrentScreen->m_StartVisu.x, DrawPanel->GetViewStart( &m_CurrentSheet->LastScreen()->m_StartVisu.x,
&m_CurrentScreen->m_StartVisu.y ); &m_CurrentSheet->LastScreen()->m_StartVisu.y );
curpos.x -= m_CurrentScreen->m_StartVisu.x; curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x;
curpos.y -= m_CurrentScreen->m_StartVisu.y; curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y;
// reposition the window if the chosen marker is off screen. // reposition the window if the chosen marker is off screen.
#define MARGIN 30 #define MARGIN 30
@ -368,14 +372,14 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
EXCHG( old_cursor_position, Screen->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
GRMouseWarp( DrawPanel, curpos ); GRMouseWarp( DrawPanel, curpos );
EXCHG( old_cursor_position, Screen->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
} }
wxString path = sheet->Path();
msg.Printf( _( "Marker %d found in %s" ), s_MarkerCount, Screen->m_FileName.GetData() ); msg.Printf( _( "Marker %d found in %s" ), s_MarkerCount, path.GetData() );
Affiche_Message( msg ); Affiche_Message( msg );
} }
else else
@ -425,7 +429,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
* @param mouseWarp If true, then move the mouse cursor to the item. * @param mouseWarp If true, then move the mouse cursor to the item.
*/ */
{ {
SCH_SCREEN* Screen, * FirstScreen = NULL; DrawSheetList* Sheet, * FirstSheet = NULL;
EDA_BaseStruct* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL; EDA_BaseStruct* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL;
int StartCount, ii, jj; int StartCount, ii, jj;
bool NotFound; bool NotFound;
@ -457,15 +461,15 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
NotFound = TRUE; NotFound = TRUE;
StartCount = 0; StartCount = 0;
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
Screen = ScreenList.GetFirst(); Sheet = SheetList.GetFirst();
if( !Find_in_hierarchy ) if( !Find_in_hierarchy )
Screen = (SCH_SCREEN*) m_CurrentScreen; Sheet = m_CurrentSheet;
for( ; Screen != NULL; Screen = ScreenList.GetNext() ) for( ; Sheet != NULL; Sheet = SheetList.GetNext() )
{ {
DrawList = Screen->EEDrawList; DrawList = Sheet->LastDrawList();
while( DrawList ) while( DrawList )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
@ -473,7 +477,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
EDA_SchComponentStruct * pSch; EDA_SchComponentStruct * pSch;
pSch = (EDA_SchComponentStruct*) DrawList; pSch = (EDA_SchComponentStruct*) DrawList;
if( WildCompareString( WildText, pSch->m_Field[REFERENCE].m_Text, FALSE ) ) if( WildCompareString( WildText, pSch->GetRef(Sheet), FALSE ) )
{ {
NotFound = FALSE; NotFound = FALSE;
pos = pSch->m_Field[REFERENCE].m_Pos; pos = pSch->m_Field[REFERENCE].m_Pos;
@ -488,6 +492,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
DrawTextStruct * pDraw; DrawTextStruct * pDraw;
pDraw = (DrawTextStruct*) DrawList; pDraw = (DrawTextStruct*) DrawList;
@ -504,9 +509,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
if( NotFound == FALSE ) /* Item found ! */ if( NotFound == FALSE ) /* Item found ! */
{ {
if( FirstScreen == NULL ) /* First Item found */ if( FirstSheet == NULL ) /* First Item found */
{ {
FirstScreen = Screen; FirstSheet = Sheet;
firstpos = pos; firstpos = pos;
FirstStruct = DrawList; FirstStruct = DrawList;
} }
@ -535,10 +540,10 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
break; break;
} }
if( NotFound && FirstScreen ) if( NotFound && FirstSheet )
{ {
NotFound = FALSE; NotFound = FALSE;
Screen = FirstScreen; Sheet = FirstSheet;
Struct = FirstStruct; Struct = FirstStruct;
pos = firstpos; pos = firstpos;
s_ItemsCount = 1; s_ItemsCount = 1;
@ -546,10 +551,12 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
if( NotFound == FALSE ) if( NotFound == FALSE )
{ {
if( Screen != GetScreen() ) if( Sheet != GetSheet() )
{ {
Screen->SetZoom( GetScreen()->GetZoom() ); Sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
m_CurrentScreen = ActiveScreen = Screen; *m_CurrentSheet = *Sheet;
ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences();
DoCenterAndRedraw = TRUE; DoCenterAndRedraw = TRUE;
} }
@ -570,18 +577,18 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
pos.y = jj + pSch->m_Pos.y; pos.y = jj + pSch->m_Pos.y;
} }
old_cursor_position = Screen->m_Curseur; old_cursor_position = Sheet->LastScreen()->m_Curseur;
Screen->m_Curseur = pos; Sheet->LastScreen()->m_Curseur = pos;
curpos = DrawPanel->CursorScreenPosition(); curpos = DrawPanel->CursorScreenPosition();
DrawPanel->GetViewStart( DrawPanel->GetViewStart(
&m_CurrentScreen->m_StartVisu.x, &( GetScreen()->m_StartVisu.x ),
&m_CurrentScreen->m_StartVisu.y ); &( GetScreen()->m_StartVisu.y ));
// calcul des coord curseur avec origine = screen // calcul des coord curseur avec origine = screen
curpos.x -= m_CurrentScreen->m_StartVisu.x; curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x;
curpos.y -= m_CurrentScreen->m_StartVisu.y; curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y;
/* Il y a peut-etre necessite de recadrer le dessin: */ /* Il y a peut-etre necessite de recadrer le dessin: */
#define MARGIN 30 #define MARGIN 30
@ -599,18 +606,18 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
EXCHG( old_cursor_position, Screen->m_Curseur ); EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
if( mouseWarp ) if( mouseWarp )
GRMouseWarp( DrawPanel, curpos ); GRMouseWarp( DrawPanel, curpos );
EXCHG( old_cursor_position, Screen->m_Curseur ); EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
} }
msg = WildText + _( " Found in " ) + Screen->m_FileName; msg = WildText + _( " Found in " ) + Sheet->Last()->m_SheetName;
Affiche_Message( msg ); Affiche_Message( msg );
} }
else else

View File

@ -72,6 +72,7 @@ typedef enum {
LAYER_JUNCTION, LAYER_JUNCTION,
LAYER_LOCLABEL, LAYER_LOCLABEL,
LAYER_GLOBLABEL, LAYER_GLOBLABEL,
LAYER_HIERLABEL,
LAYER_PINFUN, LAYER_PINFUN,
LAYER_PINNUM, LAYER_PINNUM,
LAYER_PINNAM, LAYER_PINNAM,
@ -147,7 +148,7 @@ extern int g_HVLines;
eda_global int g_PlotPSColorOpt; // True = plot postcript color (see plotps.cpp) eda_global int g_PlotPSColorOpt; // True = plot postcript color (see plotps.cpp)
// Gestion de diverses variables, options... devant etre mémorisées mais // Gestion de diverses variables, options... devant etre m<EFBFBD>moris<EFBFBD>es mais
// Remises a 0 lors d'un rechargement de projetc // Remises a 0 lors d'un rechargement de projetc
struct EESchemaVariables struct EESchemaVariables
{ {
@ -164,7 +165,7 @@ eda_global int g_PrintFillMask; /* pour les options "FILL",
eda_global wxString g_CurrentViewLibraryName; /* nom de la librairie en cours d'examen */ eda_global wxString g_CurrentViewLibraryName; /* nom de la librairie en cours d'examen */
eda_global wxString g_CurrentViewComponentName; /* nom du le composant en cours d'examen */ eda_global wxString g_CurrentViewComponentName; /* nom du le composant en cours d'examen */
eda_global int g_ViewConvert; /* Vue normal / convert */ eda_global int g_ViewConvert; /* Vue normal / convert */
eda_global int g_ViewUnit; /* unité a afficher (A, B ..) */ eda_global int g_ViewUnit; /* unit<EFBFBD> a afficher (A, B ..) */
/* Variables globales pour Schematic Edit */ /* Variables globales pour Schematic Edit */
eda_global int g_DefaultTextLabelSize eda_global int g_DefaultTextLabelSize
@ -218,7 +219,8 @@ struct HPGL_Pen_Descr_Struct
eda_global HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr; eda_global HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
/* Ecrans usuels */ /* Ecrans usuels */
eda_global SCH_SCREEN * ScreenSch; //eda_global SCH_SCREEN * ScreenSch;
eda_global DrawSheetStruct* g_RootSheet;
eda_global SCH_SCREEN * ScreenLib; eda_global SCH_SCREEN * ScreenLib;
/*************************************/ /*************************************/
@ -253,7 +255,7 @@ eda_global wxString g_NetListerCommandLine; // ligne de commande pour l'appel au
eda_global LayerStruct g_LayerDescr; /* couleurs des couches */ eda_global LayerStruct g_LayerDescr; /* couleurs des couches */
eda_global bool g_EditPinByPinIsOn /* bool: TRUE si edition des pins pin a pin au lieu */ eda_global bool g_EditPinByPinIsOn /* bool: TRUE si edition des pins pin a pin au lieu */
#ifdef MAIN /* de l'edition simultanée des pins de meme coordonnées */ #ifdef MAIN /* de l'edition simultan<EFBFBD>e des pins de meme coordonn<6E>es */
= FALSE = FALSE
#endif #endif
; ;

View File

@ -178,7 +178,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp; DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
DrawLibItem = new EDA_SchComponentStruct( m_CurrentScreen->m_Curseur ); DrawLibItem = new EDA_SchComponentStruct( GetScreen()->m_Curseur );
DrawLibItem->m_Multi = 1;/* Selection de l'unite 1 dans le boitier */ DrawLibItem->m_Multi = 1;/* Selection de l'unite 1 dans le boitier */
DrawLibItem->m_Convert = 1; DrawLibItem->m_Convert = 1;
DrawLibItem->m_ChipName = Name; DrawLibItem->m_ChipName = Name;
@ -209,7 +209,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Entry->m_Prefix.m_Pos.y + DrawLibItem->m_Pos.y; Entry->m_Prefix.m_Pos.y + DrawLibItem->m_Pos.y;
DrawLibItem->m_Field[REFERENCE].m_Orient = Entry->m_Prefix.m_Orient; DrawLibItem->m_Field[REFERENCE].m_Orient = Entry->m_Prefix.m_Orient;
DrawLibItem->m_Field[REFERENCE].m_Size = Entry->m_Prefix.m_Size; DrawLibItem->m_Field[REFERENCE].m_Size = Entry->m_Prefix.m_Size;
DrawLibItem->m_Field[REFERENCE].m_Text = msg; DrawLibItem->m_PrefixString = Entry->m_Prefix.m_Text;
DrawLibItem->m_Field[REFERENCE].m_Attributs = Entry->m_Prefix.m_Attributs; DrawLibItem->m_Field[REFERENCE].m_Attributs = Entry->m_Prefix.m_Attributs;
DrawLibItem->m_Field[REFERENCE].m_HJustify = Entry->m_Prefix.m_HJustify; DrawLibItem->m_Field[REFERENCE].m_HJustify = Entry->m_Prefix.m_HJustify;
DrawLibItem->m_Field[REFERENCE].m_VJustify = Entry->m_Prefix.m_VJustify; DrawLibItem->m_Field[REFERENCE].m_VJustify = Entry->m_Prefix.m_VJustify;
@ -253,14 +253,14 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
wxPoint move_vector; wxPoint move_vector;
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*)
panel->m_Parent->m_CurrentScreen->GetCurItem(); panel->m_Parent->GetScreen()->GetCurItem();
/* Effacement du composant */ /* Effacement du composant */
if( erase ) if( erase )
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
move_vector.x = panel->m_Parent->m_CurrentScreen->m_Curseur.x - DrawLibItem->m_Pos.x; move_vector.x = panel->m_Parent->GetScreen()->m_Curseur.x - DrawLibItem->m_Pos.x;
move_vector.y = panel->m_Parent->m_CurrentScreen->m_Curseur.y - DrawLibItem->m_Pos.y; move_vector.y = panel->m_Parent->GetScreen()->m_Curseur.y - DrawLibItem->m_Pos.y;
MoveOneStruct( DrawLibItem, move_vector ); MoveOneStruct( DrawLibItem, move_vector );
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
@ -301,7 +301,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
} }
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
@ -314,12 +314,12 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
*/ */
{ {
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*)
Panel->m_Parent->m_CurrentScreen->GetCurItem(); Panel->m_Parent->GetScreen()->GetCurItem();
if( DrawLibItem->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */ if( DrawLibItem->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
{ {
DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 );
delete DrawLibItem; SAFE_DELETE( DrawLibItem );
} }
else if( DrawLibItem ) /* Deplacement ancien composant en cours */ else if( DrawLibItem ) /* Deplacement ancien composant en cours */
{ {
@ -338,7 +338,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
DrawLibItem->m_Flags = 0; DrawLibItem->m_Flags = 0;
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
Panel->m_Parent->m_CurrentScreen->SetCurItem( NULL ); Panel->m_Parent->GetScreen()->SetCurItem( NULL );
} }
@ -385,7 +385,7 @@ void WinEDA_SchematicFrame::SelPartUnit( EDA_SchComponentStruct* DrawComponent,
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
@ -426,7 +426,7 @@ void WinEDA_SchematicFrame::ConvertPart( EDA_SchComponentStruct* DrawComponent,
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
@ -471,18 +471,19 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component,
if( Component->m_Flags == 0 ) if( Component->m_Flags == 0 )
{ {
if( g_ItemToUndoCopy ) if( g_ItemToUndoCopy ){
delete g_ItemToUndoCopy; SAFE_DELETE( g_ItemToUndoCopy );
}
g_ItemToUndoCopy = Component->GenCopy(); g_ItemToUndoCopy = Component->GenCopy();
} }
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = Component->m_Pos; GetScreen()->m_Curseur = Component->m_Pos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp; DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
m_CurrentScreen->SetCurItem( Component ); GetScreen()->SetCurItem( Component );
OldPos = Component->m_Pos; OldPos = Component->m_Pos;
memcpy( OldTransMat, Component->m_Transform, sizeof(OldTransMat) ); memcpy( OldTransMat, Component->m_Transform, sizeof(OldTransMat) );

View File

@ -21,8 +21,7 @@
#include "../bitmaps/treensel.xpm" #include "../bitmaps/treensel.xpm"
static void InstallScreenFromSheet(WinEDA_SchematicFrame * frame, static void UpdateScreenFromSheet(WinEDA_SchematicFrame * frame);
DrawSheetStruct * Sheet );
enum { enum {
ID_TREECTRL_HIERARCHY = 1600 ID_TREECTRL_HIERARCHY = 1600
@ -31,15 +30,15 @@ enum {
class WinEDA_HierFrame; class WinEDA_HierFrame;
/* Cette classe permet de memoriser la feuille (sheet) associée a l'item /* Cette classe permet de memoriser la feuille (sheet) associ<EFBFBD>e a l'item
pour l'arbre de hierarchie */ pour l'arbre de hierarchie */
class TreeItemData: public wxTreeItemData class TreeItemData: public wxTreeItemData
{ {
public: public:
DrawSheetStruct * Sheet; DrawSheetList m_SheetList;
TreeItemData(DrawSheetStruct * sheet) :wxTreeItemData() TreeItemData(DrawSheetList sheet) :wxTreeItemData()
{ {
Sheet = sheet; m_SheetList = sheet;
} }
}; };
@ -82,7 +81,7 @@ class WinEDA_HierFrame : public wxDialog
public: public:
WinEDA_SchematicFrame * m_Parent; WinEDA_SchematicFrame * m_Parent;
WinEDA_Tree * m_Tree; WinEDA_Tree * m_Tree;
int nbsheets; int m_nbsheets;
wxDC * m_DC; wxDC * m_DC;
private: private:
@ -91,8 +90,7 @@ private:
public: public:
WinEDA_HierFrame(WinEDA_SchematicFrame *parent, wxDC * DC, const wxPoint& pos); WinEDA_HierFrame(WinEDA_SchematicFrame *parent, wxDC * DC, const wxPoint& pos);
void BuildSheetList(EDA_BaseStruct * DrawStruct, void BuildSheetList(DrawSheetList * list, wxTreeItemId * previousmenu);
wxTreeItemId * previousmenu);
~WinEDA_HierFrame(); ~WinEDA_HierFrame();
void OnSelect(wxTreeEvent& event); void OnSelect(wxTreeEvent& event);
@ -123,17 +121,19 @@ WinEDA_HierFrame::WinEDA_HierFrame(WinEDA_SchematicFrame *parent, wxDC * DC,
wxDialog(parent, -1, _("Navigator"), pos, wxSize(110,50), wxDialog(parent, -1, _("Navigator"), pos, wxSize(110,50),
DIALOG_STYLE) DIALOG_STYLE)
{ {
wxTreeItemId cellule; wxTreeItemId cellule;
m_Parent = parent; m_Parent = parent;
m_DC = DC; m_DC = DC;
m_Tree = new WinEDA_Tree(this); m_Tree = new WinEDA_Tree(this);
nbsheets = 1; m_nbsheets = 1;
cellule = m_Tree->AddRoot(_("Root"), 0, 1); cellule = m_Tree->AddRoot(_("Root"), 0, 1);
m_Tree->SetItemBold(cellule, TRUE); m_Tree->SetItemBold(cellule, TRUE);
m_Tree->SetItemData( cellule, new TreeItemData(NULL) ); DrawSheetList list;
list.Push(g_RootSheet);
m_Tree->SetItemData( cellule, new TreeItemData(list) );
wxRect itemrect; wxRect itemrect;
#ifdef __UNIX__ #ifdef __UNIX__
@ -145,20 +145,18 @@ wxRect itemrect;
m_TreeSize.x = itemrect.GetWidth() + 10; m_TreeSize.x = itemrect.GetWidth() + 10;
m_TreeSize.y = 20; m_TreeSize.y = 20;
if (ScreenSch == m_Parent->m_CurrentScreen ) if( m_Parent->GetSheet()->Last() == g_RootSheet )
{ m_Tree->SelectItem(cellule); //root.
m_Tree->SelectItem(cellule);
}
maxposx = 15; maxposx = 15;
BuildSheetList(ScreenSch->EEDrawList, &cellule); BuildSheetList(&list, &cellule);
if ( nbsheets > 1) if ( m_nbsheets > 1)
{ {
m_Tree->Expand(cellule); m_Tree->Expand(cellule);
// Reajustage de la taille de la frame a une valeur optimale // Reajustage de la taille de la frame a une valeur optimale
m_TreeSize.y += nbsheets * itemrect.GetHeight(); m_TreeSize.y += m_nbsheets * itemrect.GetHeight();
m_TreeSize.x = MIN(m_TreeSize.x, 250); m_TreeSize.x = MIN(m_TreeSize.x, 250);
m_TreeSize.y = MIN( m_TreeSize.y, 350); m_TreeSize.y = MIN( m_TreeSize.y, 350);
SetClientSize(m_TreeSize); SetClientSize(m_TreeSize);
@ -179,7 +177,7 @@ void WinEDA_HierFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
} }
/********************************************************************/ /********************************************************************/
void WinEDA_HierFrame::BuildSheetList(EDA_BaseStruct * DrawStruct, void WinEDA_HierFrame::BuildSheetList(DrawSheetList* list,
wxTreeItemId * previousmenu) wxTreeItemId * previousmenu)
/********************************************************************/ /********************************************************************/
/* Routine de creation de l'arbre de navigation dans la hierarchy /* Routine de creation de l'arbre de navigation dans la hierarchy
@ -188,33 +186,27 @@ schematique
*/ */
{ {
wxTreeItemId menu; wxTreeItemId menu;
SCH_SCREEN * Screen;
if( nbsheets > NB_MAX_SHEET ) if( m_nbsheets > NB_MAX_SHEET ){
{ if( m_nbsheets == (NB_MAX_SHEET + 1) ){
if( nbsheets == (NB_MAX_SHEET + 1) )
{
wxString msg; wxString msg;
msg << wxT("BuildSheetList: Error: nbsheets > ") << NB_MAX_SHEET; msg << wxT("BuildSheetList: Error: nbsheets > ") << NB_MAX_SHEET;
DisplayError(this, msg); DisplayError(this, msg);
nbsheets++; m_nbsheets++;
} }
return; return;
} }
maxposx += m_Tree->GetIndent(); maxposx += m_Tree->GetIndent();
EDA_BaseStruct* bs = list->LastDrawList();
while( DrawStruct ) while(bs && m_nbsheets < NB_MAX_SHEET){
{ if(bs->Type() == DRAW_SHEET_STRUCT_TYPE){
if(DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) DrawSheetStruct* ss = (DrawSheetStruct*)bs;
{ m_nbsheets++;
#define STRUCT ((DrawSheetStruct*)DrawStruct)
nbsheets++;
menu = m_Tree->AppendItem(*previousmenu, menu = m_Tree->AppendItem(*previousmenu,
STRUCT->m_SheetName, 0 , 1 ); ss->m_SheetName, 0 , 1 );
m_Tree->SetItemData( menu, new TreeItemData(STRUCT) ); list->Push(ss);
// m_Tree->SetItemFont( menu, *StdFont); m_Tree->SetItemData( menu, new TreeItemData(*list) );
int ll = m_Tree->GetItemText(menu).Len(); int ll = m_Tree->GetItemText(menu).Len();
#ifdef __WINDOWS__ #ifdef __WINDOWS__
ll *= 9; // * char width ll *= 9; // * char width
@ -224,27 +216,15 @@ SCH_SCREEN * Screen;
ll += maxposx + 20; ll += maxposx + 20;
m_TreeSize.x = MAX(m_TreeSize.x, ll); m_TreeSize.x = MAX(m_TreeSize.x, ll);
m_TreeSize.y += 1; m_TreeSize.y += 1;
if ( *list == *(m_Parent->GetSheet()) ){
Screen = (SCH_SCREEN*) DrawStruct;
if (Screen == m_Parent->m_CurrentScreen )
{
m_Tree->EnsureVisible(menu); m_Tree->EnsureVisible(menu);
m_Tree->SelectItem(menu); m_Tree->SelectItem(menu);
} }
BuildSheetList(list, &menu);
/* Examen des sous - hierarchies */
if(Screen)
{
int oldnbsheets = nbsheets;
BuildSheetList(Screen->EEDrawList,&menu);
if( oldnbsheets != nbsheets )
{
m_Tree->SetItemBold(menu, TRUE);
m_Tree->Expand(menu); m_Tree->Expand(menu);
list->Pop();
} }
} bs = bs->Pnext;
}
DrawStruct = DrawStruct->Pnext;
} }
maxposx -= m_Tree->GetIndent(); maxposx -= m_Tree->GetIndent();
} }
@ -254,63 +234,37 @@ SCH_SCREEN * Screen;
void WinEDA_HierFrame::OnSelect(wxTreeEvent& event) void WinEDA_HierFrame::OnSelect(wxTreeEvent& event)
/***************************************************/ /***************************************************/
/* appelee sur un double-click de la souris pour la selection d'un item: /* appelee sur un double-click de la souris pour la selection d'un item:
Selectionne et affiche l'ecran demandé Selectionne et affiche l'ecran demand<EFBFBD>
*/ */
{ {
DrawSheetStruct * Sheet;
wxTreeItemId ItemSel = m_Tree->GetSelection(); wxTreeItemId ItemSel = m_Tree->GetSelection();
Sheet = ((TreeItemData*)(m_Tree->GetItemData(ItemSel)))->Sheet; *(m_Parent->m_CurrentSheet) =
InstallScreenFromSheet(m_Parent, Sheet); ((TreeItemData*)(m_Tree->GetItemData(ItemSel)))->m_SheetList;
wxString path = m_Parent->m_CurrentSheet->PathHumanReadable();
printf("changing to sheet %s\n", CONV_TO_UTF8(path));
UpdateScreenFromSheet(m_Parent);
Close(TRUE); Close(TRUE);
} }
/******************************************************/ /******************************************************/
void WinEDA_SchematicFrame::InstallPreviousScreen() void WinEDA_SchematicFrame::InstallPreviousSheet()
/******************************************************/ /******************************************************/
/* Set the current screen to display the parent sheet of the current displayed sheet /* Set the current screen to display the parent sheet of the current displayed sheet
*/ */
{ {
SCH_SCREEN * Screen; if( m_CurrentSheet->Last() == g_RootSheet ) return;
EDA_BaseStruct * DrawStruct;
if( m_CurrentScreen == ScreenSch ) return;
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
//make a copy for testing purposes.
/* Build the screen list */ DrawSheetList listtemp = *m_CurrentSheet;
EDA_ScreenList ScreenList(NULL); listtemp.Pop();
if ( listtemp.LastScreen() == NULL ){
/* search the list which have the current scheet in EEDrawList */ DisplayError( this, wxT("InstallPreviousScreen() Error: Sheet not found"));
for ( Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() )
{
DrawStruct = Screen->EEDrawList;
while (DrawStruct != NULL )
{
if ( DrawStruct == m_CurrentScreen ) break; // Found !
DrawStruct = DrawStruct->Pnext;
}
if ( DrawStruct ) break;
}
if ( Screen == NULL )
{
DisplayError( this, wxT("InstallPreviousScreen() Error: Screen not found"));
return; return;
} }
m_CurrentScreen = ActiveScreen = Screen; m_CurrentSheet->Pop();
DrawPanel->m_CanStartBlock = -1; UpdateScreenFromSheet(this);
DrawPanel->SetScrollbars( DrawPanel->m_Scroll_unit,
DrawPanel->m_Scroll_unit,
m_CurrentScreen->m_ScrollbarNumber.x,
m_CurrentScreen->m_ScrollbarNumber.y,
m_CurrentScreen->m_ScrollbarPos.x,
m_CurrentScreen->m_ScrollbarPos.y,TRUE);
ReDrawPanel();
DrawPanel->MouseToCursorSchema();
} }
/*********************************************************************/ /*********************************************************************/
@ -318,22 +272,23 @@ void WinEDA_SchematicFrame::InstallNextScreen(DrawSheetStruct * Sheet)
/*********************************************************************/ /*********************************************************************/
/* Routine d'installation de l'ecran correspondant au symbole Sheet pointe /* Routine d'installation de l'ecran correspondant au symbole Sheet pointe
par la souris par la souris
have to be careful here because the DrawSheetStructs within the EEDrawList
don't actually have a valid m_s (on purpose -- you need the m_SubSheet hierarchy
to maintain path info (well, this is but one way to maintain path info..)
*/ */
{ {
if( Sheet == NULL) if( Sheet == NULL)
{ {
DisplayError(this,wxT("InstallNextScreen() error")); return; DisplayError(this,wxT("InstallNextScreen() error")); return;
} }
m_CurrentSheet->Push(Sheet);
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
InstallScreenFromSheet(this, Sheet ); UpdateScreenFromSheet(this);
} }
/**************************************************************/ /**************************************************************/
static void InstallScreenFromSheet(WinEDA_SchematicFrame * frame, static void UpdateScreenFromSheet(WinEDA_SchematicFrame * frame)
DrawSheetStruct * Sheet )
/**************************************************************/ /**************************************************************/
/* Recherche et installe de l'ecran relatif au sheet symbole Sheet. /* Recherche et installe de l'ecran relatif au sheet symbole Sheet.
@ -341,15 +296,15 @@ static void InstallScreenFromSheet(WinEDA_SchematicFrame * frame,
*/ */
{ {
SCH_SCREEN * NewScreen; SCH_SCREEN * NewScreen;
SCH_SCREEN * oldscreen = (SCH_SCREEN*) frame->m_CurrentScreen; //SCH_SCREEN * oldscreen = frame->GetScreen(); what is oldscreen used for?
if( Sheet == NULL ) NewScreen = ScreenSch; NewScreen = frame->m_CurrentSheet->LastScreen();
else NewScreen = Sheet; if(!NewScreen)
NewScreen = g_RootSheet->m_s;
frame->m_CurrentScreen = ActiveScreen = NewScreen; // Reinit des parametres d'affichage du nouvel ecran
if ( oldscreen != frame->m_CurrentScreen ) // assumes m_CurrentSheet has already been updated.
{ // Reinit des parametres d'affichage du nouvel ecran
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
frame->DrawPanel->SetScrollbars( frame->DrawPanel->m_Scroll_unit, frame->DrawPanel->SetScrollbars( frame->DrawPanel->m_Scroll_unit,
frame->DrawPanel->m_Scroll_unit, frame->DrawPanel->m_Scroll_unit,
@ -358,19 +313,17 @@ SCH_SCREEN * oldscreen = (SCH_SCREEN*) frame->m_CurrentScreen;
NewScreen->m_ScrollbarPos.x, NewScreen->m_ScrollbarPos.x,
NewScreen->m_ScrollbarPos.y,TRUE); NewScreen->m_ScrollbarPos.y,TRUE);
//update the References
frame->m_CurrentSheet->UpdateAllScreenReferences();
frame->DrawPanel->m_CanStartBlock = -1; frame->DrawPanel->m_CanStartBlock = -1;
if ( NewScreen->m_FirstRedraw ) if ( NewScreen->m_FirstRedraw ){
{
NewScreen->m_FirstRedraw = FALSE; NewScreen->m_FirstRedraw = FALSE;
frame->Zoom_Automatique(TRUE); frame->Zoom_Automatique(TRUE);
} }else{
else
{
frame->ReDrawPanel(); frame->ReDrawPanel();
frame->DrawPanel->MouseToCursorSchema(); frame->DrawPanel->MouseToCursorSchema();
} }
} ActiveScreen = frame->m_CurrentSheet->LastScreen();
return; return;
} }

View File

@ -145,14 +145,14 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive * Commands are case insensitive
*/ */
{ {
bool ItemInEdit = m_CurrentScreen->GetCurItem() bool ItemInEdit = GetScreen()->GetCurItem()
&& m_CurrentScreen->GetCurItem()->m_Flags; && GetScreen()->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
if( hotkey == 0 ) if( hotkey == 0 )
return; return;
wxPoint MousePos = m_CurrentScreen->m_MousePosition; wxPoint MousePos = GetScreen()->m_MousePosition;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...) // Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 ) if( (hotkey & GR_KB_CTRL) != 0 )
@ -179,7 +179,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */ case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
@ -217,9 +217,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
RefreshToolBar = LocateAndDeleteItem( this, DC ); RefreshToolBar = LocateAndDeleteItem( this, DC );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
break; break;
case HK_REPEAT_LAST: case HK_REPEAT_LAST:
@ -276,11 +276,11 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( DrawStruct == NULL ) if( DrawStruct == NULL )
{ {
DrawStruct = PickStruct( GetScreen()->m_Curseur, DrawStruct = PickStruct( GetScreen()->m_Curseur,
GetScreen()->EEDrawList, LIBITEM | TEXTITEM | LABELITEM ); GetScreen(), LIBITEM | TEXTITEM | LABELITEM );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
} }
@ -301,6 +301,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
{ {
SaveCopyInUndoList( DrawStruct, IS_CHANGED ); SaveCopyInUndoList( DrawStruct, IS_CHANGED );
@ -317,7 +318,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component) case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
@ -332,7 +333,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_MIRROR_X_COMPONENT: // Mirror X (Component) case HK_MIRROR_X_COMPONENT: // Mirror X (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
@ -347,7 +348,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component) case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
@ -357,7 +358,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
} }
CmpRotationMiroir( CmpRotationMiroir(
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_NORMAL ); (EDA_SchComponentStruct*) DrawStruct, DC, CMP_NORMAL );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( (SCH_SCREEN*)GetScreen()->EEDrawList, DC );
} }
break; break;
@ -366,10 +367,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct && (DrawStruct->m_Flags ==0) ) if( DrawStruct && (DrawStruct->m_Flags ==0) )
{ {
m_CurrentScreen->SetCurItem( DrawStruct ); ((SCH_SCREEN*)GetScreen())->SetCurItem( DrawStruct );
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent ); wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event ); wxPostEvent( this, event );
@ -379,7 +380,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if(DrawStruct) if(DrawStruct)
{ {
EditComponentValue( EditComponentValue(
@ -391,7 +392,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if(DrawStruct) if(DrawStruct)
{ {
EditComponentFootprint( EditComponentFootprint(
@ -414,14 +415,14 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive * Commands are case insensitive
*/ */
{ {
bool ItemInEdit = m_CurrentScreen->GetCurItem() bool ItemInEdit = GetScreen()->GetCurItem()
&& m_CurrentScreen->GetCurItem()->m_Flags; && GetScreen()->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
if( hotkey == 0 ) if( hotkey == 0 )
return; return;
wxPoint MousePos = m_CurrentScreen->m_MousePosition; wxPoint MousePos = GetScreen()->m_MousePosition;
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor(); LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
@ -448,7 +449,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */ case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:

View File

@ -27,15 +27,15 @@ static int TriListEntry(EDA_LibComponentStruct **Objet1,
bool LibArchive(wxWindow * frame, const wxString & ArchFullFileName) bool LibArchive(wxWindow * frame, const wxString & ArchFullFileName)
/*******************************************************************/ /*******************************************************************/
/* /*
Creation du fichier librairie contenant tous les composants utilisés dans Creation du fichier librairie contenant tous les composants utilis<EFBFBD>s dans
le projet en cours le projet en cours
retourne TRUE si fichier créé retourne TRUE si fichier cr<EFBFBD><EFBFBD>
*/ */
{ {
wxString DocFileName, msg; wxString DocFileName, msg;
char Line[256]; char Line[256];
FILE *ArchiveFile, *DocFile; FILE *ArchiveFile, *DocFile;
EDA_BaseStruct ** ListStruct; ListComponent * List;
EDA_LibComponentStruct ** ListEntry, *Entry; EDA_LibComponentStruct ** ListEntry, *Entry;
int ii, NbItems; int ii, NbItems;
const wxChar * Text; const wxChar * Text;
@ -45,12 +45,11 @@ const wxChar * Text;
NbItems = GenListeCmp(NULL ); // Comptage des composants NbItems = GenListeCmp(NULL ); // Comptage des composants
if ( NbItems == 0 ) return FALSE; if ( NbItems == 0 ) return FALSE;
ListStruct = (EDA_BaseStruct **) List = (ListComponent *) MyZMalloc( NbItems * sizeof( ListComponent ) );
MyZMalloc( NbItems * sizeof(EDA_BaseStruct **) ); if (List == NULL ) return FALSE;
if (ListStruct == NULL ) return FALSE;
/* Calcul de la liste des composants */ /* Calcul de la liste des composants */
GenListeCmp(ListStruct); GenListeCmp(List);
/* Calcul de la liste des Entrees de librairie /* Calcul de la liste des Entrees de librairie
et Remplacement des alias par les composants "Root" */ et Remplacement des alias par les composants "Root" */
@ -60,12 +59,12 @@ const wxChar * Text;
for ( ii = 0; ii < NbItems; ii++ ) for ( ii = 0; ii < NbItems; ii++ )
{ {
Text = ( (EDA_SchComponentStruct*)ListStruct[ii])->m_ChipName.GetData(); Text = List[ii].m_Comp->m_ChipName.GetData();
Entry = FindLibPart(Text, wxEmptyString, FIND_ROOT); Entry = FindLibPart(Text, wxEmptyString, FIND_ROOT);
ListEntry[ii] = Entry; // = NULL si Composant non trouvé en librairie ListEntry[ii] = Entry; // = NULL si Composant non trouv<EFBFBD> en librairie
} }
MyFree(ListStruct); MyFree(List);
qsort( ListEntry, NbItems, sizeof(EDA_LibComponentStruct *), qsort( ListEntry, NbItems, sizeof(EDA_LibComponentStruct *),
(int(*)(const void*, const void*))TriListEntry); (int(*)(const void*, const void*))TriListEntry);
@ -95,7 +94,7 @@ const wxChar * Text;
/* Generation des elements */ /* Generation des elements */
for ( ii = 0; ii < NbItems; ii++ ) for ( ii = 0; ii < NbItems; ii++ )
{ {
if ( ListEntry[ii] == NULL ) // Composant non trouvé en librairie if ( ListEntry[ii] == NULL ) // Composant non trouv<EFBFBD> en librairie
{ {
continue; continue;
} }

View File

@ -41,7 +41,7 @@ void FreeLibraryEntry( LibCmpEntry* Entry )
/* Used by PQFreeFunc() to delete all entries /* Used by PQFreeFunc() to delete all entries
*/ */
{ {
delete Entry; SAFE_DELETE( Entry );
} }
@ -197,7 +197,7 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
while( field ) while( field )
{ {
TempField = field; field = (LibDrawField*) field->Pnext; TempField = field; field = (LibDrawField*) field->Pnext;
delete TempField; SAFE_DELETE( TempField );
} }
/* suppression des elements dependants */ /* suppression des elements dependants */
@ -205,7 +205,7 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
while( DrawItem ) while( DrawItem )
{ {
NextDrawItem = DrawItem->Next(); NextDrawItem = DrawItem->Next();
delete DrawItem; SAFE_DELETE( DrawItem );
DrawItem = NextDrawItem; DrawItem = NextDrawItem;
} }
} }

View File

@ -98,11 +98,10 @@ EDA_LibComponentStruct *LibEntry = NULL;
ScreenLib->ClrModify(); ScreenLib->ClrModify();
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
// Effacement ancien composant affiché // Effacement ancien composant affich<EFBFBD>
if( CurrentLibEntry) if( CurrentLibEntry)
{ {
delete CurrentLibEntry; SAFE_DELETE( CurrentLibEntry ) ;
CurrentLibEntry = NULL;
} }
/* Chargement du composant */ /* Chargement du composant */
@ -159,7 +158,7 @@ const wxChar * CmpName, *RootName = NULL;
CurrentAliasName = CmpName; CurrentAliasName = CmpName;
} }
if( CurrentLibEntry) delete CurrentLibEntry; if( CurrentLibEntry){ SAFE_DELETE( CurrentLibEntry ) ;}
CurrentLibEntry = CopyLibEntryStruct(this, LibEntry); CurrentLibEntry = CopyLibEntryStruct(this, LibEntry);
CurrentUnit = 1; CurrentConvert = 1; CurrentUnit = 1; CurrentConvert = 1;
@ -180,7 +179,7 @@ void WinEDA_LibeditFrame::RedrawActiveWindow(wxDC * DC, bool EraseBg)
/*********************************************************************/ /*********************************************************************/
/* Routine generale d'affichage a l'ecran du "PartLib" en cours d'edition */ /* Routine generale d'affichage a l'ecran du "PartLib" en cours d'edition */
{ {
if( m_CurrentScreen == NULL ) return; if( GetScreen() == NULL ) return;
ActiveScreen = GetScreen(); ActiveScreen = GetScreen();
@ -209,7 +208,7 @@ void WinEDA_LibeditFrame::RedrawActiveWindow(wxDC * DC, bool EraseBg)
DrawPanel->ManageCurseur(DrawPanel, DC, FALSE); // reaffichage lie au curseur DrawPanel->ManageCurseur(DrawPanel, DC, FALSE); // reaffichage lie au curseur
} }
m_CurrentScreen->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
DisplayLibInfos(); DisplayLibInfos();
Affiche_Status_Box(); Affiche_Status_Box();
} }
@ -260,7 +259,7 @@ void WinEDA_LibeditFrame::DisplayCmpDoc(const wxString & Name)
/**************************************************************/ /**************************************************************/
/* /*
Affiche la documentation du composant selectionne Affiche la documentation du composant selectionne
Utilisée lors de l'affichage de la liste des composants en librairie Utilis<EFBFBD>e lors de l'affichage de la liste des composants en librairie
*/ */
{ {
LibCmpEntry * CmpEntry; LibCmpEntry * CmpEntry;
@ -400,8 +399,8 @@ int diag;
NewStruct->m_Prefix.m_Text = wxT("U"); NewStruct->m_Prefix.m_Text = wxT("U");
NewStruct->m_Prefix.m_Text.MakeUpper(); NewStruct->m_Prefix.m_Text.MakeUpper();
// Effacement ancien composant affiché // Effacement ancien composant affich<EFBFBD>
if( CurrentLibEntry) delete CurrentLibEntry; if( CurrentLibEntry){ SAFE_DELETE( CurrentLibEntry );}
CurrentLibEntry = NewStruct; CurrentLibEntry = NewStruct;
CurrentUnit = 1; CurrentUnit = 1;
CurrentConvert = 1; CurrentConvert = 1;
@ -460,7 +459,7 @@ EDA_LibCmpAliasStruct * AliasEntry;
/* Effacement memoire pour cet alias */ /* Effacement memoire pour cet alias */
PQDelete( &Library->m_Entries, (void*) Entry ); PQDelete( &Library->m_Entries, (void*) Entry );
delete Entry; SAFE_DELETE( Entry );
if( Library->m_NumOfParts > 0 ) CurrentLib->m_NumOfParts --; if( Library->m_NumOfParts > 0 ) CurrentLib->m_NumOfParts --;
return; return;
} }
@ -469,7 +468,7 @@ EDA_LibCmpAliasStruct * AliasEntry;
if( Entry->m_AliasList.GetCount() == 0) // Trivial case: no alias, we can safety delete e=this entry if( Entry->m_AliasList.GetCount() == 0) // Trivial case: no alias, we can safety delete e=this entry
{ {
PQDelete( &Library->m_Entries, Entry ); PQDelete( &Library->m_Entries, Entry );
delete Entry; SAFE_DELETE( Entry );
if( Library->m_NumOfParts > 0 ) Library->m_NumOfParts --; if( Library->m_NumOfParts > 0 ) Library->m_NumOfParts --;
return; return;
} }

View File

@ -52,21 +52,21 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else else
{ {
DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry, DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
CurrentUnit, CurrentConvert ); CurrentUnit, CurrentConvert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = LocateDrawItem( GetScreen(), GetScreen()->m_MousePosition, DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), GetScreen()->m_MousePosition,
CurrentLibEntry, CurrentUnit, CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM ); CurrentConvert, LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry, DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
CurrentUnit, CurrentConvert ); CurrentUnit, CurrentConvert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = LocateDrawItem( GetScreen(), GetScreen()->m_Curseur, DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), GetScreen()->m_Curseur,
CurrentLibEntry, CurrentUnit, CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM ); CurrentConvert, LOCATE_ALL_DRAW_ITEM );
} }
@ -124,21 +124,23 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break; break;
case ID_LIBEDIT_DELETE_ITEM_BUTT: case ID_LIBEDIT_DELETE_ITEM_BUTT:
DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry, DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
CurrentUnit, CurrentConvert ); CurrentUnit, CurrentConvert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = LocateDrawItem( GetScreen(), m_CurrentScreen->m_MousePosition, DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
GetScreen()->m_MousePosition,
CurrentLibEntry, CurrentUnit, CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM ); CurrentConvert, LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry, DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
CurrentUnit, CurrentConvert ); CurrentUnit, CurrentConvert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = LocateDrawItem( GetScreen(), m_CurrentScreen->m_Curseur, DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
GetScreen()->m_Curseur,
CurrentLibEntry, CurrentUnit, CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM ); CurrentConvert, LOCATE_ALL_DRAW_ITEM );
} }
@ -154,7 +156,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
else else
DeleteOneLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, DrawEntry, TRUE ); DeleteOneLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, DrawEntry, TRUE );
DrawEntry = NULL; DrawEntry = NULL;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
break; break;
case ID_LIBEDIT_ANCHOR_ITEM_BUTT: case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
@ -177,8 +179,8 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/ /*************************************************************************/
/* Appelé sur un double click: /* Appel<EFBFBD> sur un double click:
* pour un ément editable (textes, composant): * pour un <EFBFBD>l<EFBFBD>ment editable (textes, composant):
* appel de l'editeur correspondant. * appel de l'editeur correspondant.
* pour une connexion en cours: * pour une connexion en cours:
* termine la connexion * termine la connexion
@ -193,23 +195,23 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( !m_ID_current_state // Simple localisation des elements if( !m_ID_current_state // Simple localisation des elements
|| (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) || (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
{ {
DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry, DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
CurrentUnit, CurrentConvert ); CurrentUnit, CurrentConvert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry, DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
CurrentUnit, CurrentConvert ); CurrentUnit, CurrentConvert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) m_CurrentScreen, DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
m_CurrentScreen->m_MousePosition, GetScreen()->m_MousePosition,
CurrentLibEntry, CurrentUnit, CurrentLibEntry, CurrentUnit,
CurrentConvert, CurrentConvert,
LOCATE_ALL_DRAW_ITEM ); LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) m_CurrentScreen, DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
m_CurrentScreen->m_Curseur, GetScreen()->m_Curseur,
CurrentLibEntry, CurrentUnit, CurrentLibEntry, CurrentUnit,
CurrentConvert, CurrentConvert,
LOCATE_ALL_DRAW_ITEM ); LOCATE_ALL_DRAW_ITEM );
@ -247,7 +249,7 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch( DrawEntry->Type() ) switch( DrawEntry->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 ) // Item localisé et non en edition: placement commande move if( DrawEntry->m_Flags == 0 ) // Item localis<EFBFBD> et non en edition: placement commande move
{ {
InstallPineditFrame( this, DC, pos ); InstallPineditFrame( this, DC, pos );
} }

View File

@ -35,7 +35,7 @@ bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu
/********************************************************************************/ /********************************************************************************/
{ {
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor(); LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
if ( CurrentLibEntry == NULL ) return true; if ( CurrentLibEntry == NULL ) return true;

View File

@ -33,7 +33,7 @@ EDA_LibComponentStruct * CopyItem;
while ( GetScreen()->m_RedoList ) while ( GetScreen()->m_RedoList )
{ {
item = GetScreen()->m_RedoList->Pnext; item = GetScreen()->m_RedoList->Pnext;
delete GetScreen()->m_RedoList; delete (GetScreen()->m_RedoList);
GetScreen()->m_RedoList = item; GetScreen()->m_RedoList = item;
} }
} }

View File

@ -35,10 +35,10 @@ static void ExitMoveField(WinEDA_DrawPanel * Panel, wxDC * DC)
if(CurrentDrawItem == NULL) return; if(CurrentDrawItem == NULL) return;
wxPoint curpos; wxPoint curpos;
curpos = Panel->m_Parent->m_CurrentScreen->m_Curseur; curpos = Panel->m_Parent->GetScreen()->m_Curseur;
Panel->m_Parent->m_CurrentScreen->m_Curseur = StartCursor; Panel->m_Parent->GetScreen()->m_Curseur = StartCursor;
ShowMoveField(Panel, DC, TRUE); ShowMoveField(Panel, DC, TRUE);
Panel->m_Parent->m_CurrentScreen->m_Curseur = curpos; Panel->m_Parent->GetScreen()->m_Curseur = curpos;
CurrentDrawItem->m_Flags = 0; CurrentDrawItem->m_Flags = 0;
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
@ -61,13 +61,13 @@ wxPoint startPos;
startPos.x = LastTextPosition.x; startPos.x = LastTextPosition.x;
startPos.y = -LastTextPosition.y; startPos.y = -LastTextPosition.y;
DrawPanel->CursorOff(DC); DrawPanel->CursorOff(DC);
m_CurrentScreen->m_Curseur = startPos; GetScreen()->m_Curseur = startPos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->ManageCurseur = ShowMoveField; DrawPanel->ManageCurseur = ShowMoveField;
DrawPanel->ForceCloseManageCurseur = ExitMoveField; DrawPanel->ForceCloseManageCurseur = ExitMoveField;
DrawPanel->ManageCurseur(DrawPanel, DC, TRUE); DrawPanel->ManageCurseur(DrawPanel, DC, TRUE);
StartCursor = m_CurrentScreen->m_Curseur; StartCursor = GetScreen()->m_Curseur;
DrawPanel->CursorOn(DC); DrawPanel->CursorOn(DC);
} }
@ -165,7 +165,7 @@ int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth);
DrawPanel->CursorOn(DC); DrawPanel->CursorOn(DC);
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
@ -228,7 +228,7 @@ int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth);
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth); Field->m_HJustify, Field->m_VJustify, LineWidth);
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
if ( Field->m_FieldId == VALUE ) ReCreateHToolbar(); if ( Field->m_FieldId == VALUE ) ReCreateHToolbar();
} }
@ -245,7 +245,7 @@ int color;
if( Field == NULL) return; if( Field == NULL) return;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
switch (Field->m_FieldId) switch (Field->m_FieldId)
{ {
case REFERENCE: case REFERENCE:
@ -312,8 +312,8 @@ int hjustify, vjustify;
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 += dy; else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 += dy;
x1 = x0 + dx; y1 = y0 + dy; x1 = x0 + dx; y1 = y0 + dy;
if( (m_CurrentScreen->m_Curseur.x >= x0) && ( m_CurrentScreen->m_Curseur.x <= x1) && if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) &&
(m_CurrentScreen->m_Curseur.y >= y0) && ( m_CurrentScreen->m_Curseur.y <= y1) ) (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) )
return &LibEntry->m_Name; return &LibEntry->m_Name;
/* Localisation du Prefix */ /* Localisation du Prefix */
@ -329,8 +329,8 @@ int hjustify, vjustify;
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy; else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy;
x1 = x0 + dx; y1 = y0 + dy; x1 = x0 + dx; y1 = y0 + dy;
if( (m_CurrentScreen->m_Curseur.x >= x0) && ( m_CurrentScreen->m_Curseur.x <= x1) && if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) &&
(m_CurrentScreen->m_Curseur.y >= y0) && ( m_CurrentScreen->m_Curseur.y <= y1) ) (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) )
return &LibEntry->m_Prefix; return &LibEntry->m_Prefix;
/* Localisation des autres fields */ /* Localisation des autres fields */
@ -349,8 +349,8 @@ int hjustify, vjustify;
if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2; if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2;
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy; else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy;
x1 = x0 + dx; y1 = y0 + dy; x1 = x0 + dx; y1 = y0 + dy;
if( (m_CurrentScreen->m_Curseur.x >= x0) && ( m_CurrentScreen->m_Curseur.x <= x1) && if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) &&
(m_CurrentScreen->m_Curseur.y >= y0) && ( m_CurrentScreen->m_Curseur.y <= y1) ) (GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) )
return(Field); return(Field);
} }
@ -367,16 +367,16 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor()
if ( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) if ( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
{ // Simple localisation des elements { // Simple localisation des elements
DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert); DrawEntry = LocatePin(GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert);
if ( DrawEntry == NULL ) if ( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(), DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(),
GetScreen()->m_MousePosition,CurrentLibEntry,CurrentUnit, GetScreen()->m_MousePosition,CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM); CurrentConvert,LOCATE_ALL_DRAW_ITEM);
} }
if ( DrawEntry == NULL ) if ( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(), GetScreen()->m_Curseur, CurrentLibEntry,CurrentUnit, DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(), GetScreen()->m_Curseur, CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM); CurrentConvert,LOCATE_ALL_DRAW_ITEM);
} }
if ( DrawEntry == NULL ) if ( DrawEntry == NULL )

View File

@ -53,7 +53,7 @@ EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_LibeditFrame::Process_Special_Functions ) WinEDA_LibeditFrame::Process_Special_Functions )
// PopUp Menus pour Zooms traités dans drawpanel.cpp // PopUp Menus pour Zooms trait<EFBFBD>s dans drawpanel.cpp
END_EVENT_TABLE() END_EVENT_TABLE()
@ -90,7 +90,7 @@ WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
/**********************************************/ /**********************************************/
{ {
m_Parent->m_LibeditFrame = NULL; m_Parent->m_LibeditFrame = NULL;
m_CurrentScreen = ScreenSch; //m_CurrentScreen = ScreenSch; humm, is this needed?
} }
@ -100,14 +100,14 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
{ {
LibraryStruct* Lib; LibraryStruct* Lib;
if( m_CurrentScreen->IsModify() ) if( GetScreen()->IsModify() )
{ {
if( !IsOK( this, _( "Component was modified!\nDiscard changes?" ) ) ) if( !IsOK( this, _( "Component was modified!\nDiscard changes?" ) ) )
{ {
Event.Veto(); return; Event.Veto(); return;
} }
else else
m_CurrentScreen->ClrModify(); GetScreen()->ClrModify();
} }
for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext ) for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
@ -261,8 +261,8 @@ int WinEDA_LibeditFrame::BestZoom()
} }
else else
{ {
dx = m_CurrentScreen->m_CurrentSheet->m_Size.x; dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
dy = m_CurrentScreen->m_CurrentSheet->m_Size.y; dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
} }
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
@ -275,12 +275,12 @@ int WinEDA_LibeditFrame::BestZoom()
if( CurrentLibEntry ) if( CurrentLibEntry )
{ {
m_CurrentScreen->m_Curseur = BoundaryBox.Centre(); GetScreen()->m_Curseur = BoundaryBox.Centre();
} }
else else
{ {
m_CurrentScreen->m_Curseur.x = 0; GetScreen()->m_Curseur.x = 0;
m_CurrentScreen->m_Curseur.y = 0; GetScreen()->m_Curseur.y = 0;
} }
return bestzoom; return bestzoom;
@ -303,7 +303,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
wxGetMousePosition( &pos.x, &pos.y ); wxGetMousePosition( &pos.x, &pos.y );
pos.y += 20; pos.y += 20;
switch( id ) // Arret de la commande de déplacement en cours switch( id ) // Arret de la commande de d<EFBFBD>placement en cours
{ {
case ID_POPUP_LIBEDIT_END_CREATE_ITEM: case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
case ID_POPUP_LIBEDIT_PIN_EDIT: case ID_POPUP_LIBEDIT_PIN_EDIT:
@ -339,7 +339,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_LIBEDIT_SAVE_CURRENT_LIB: case ID_LIBEDIT_SAVE_CURRENT_LIB:
if( m_CurrentScreen->IsModify() ) if( GetScreen()->IsModify() )
{ {
if( IsOK( this, _( "Include last component changes?" ) ) ) if( IsOK( this, _( "Include last component changes?" ) ) )
SaveOnePartInMemory(); SaveOnePartInMemory();
@ -608,7 +608,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
} }
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
break; break;

View File

@ -58,7 +58,7 @@
/* Fonctions locales */ /* Fonctions locales */
static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Window ); static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Window );
static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Window ); static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Window);
static int ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Window ); static int ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Window );
static void LoadLayers( FILE* f, int* linecnt ); static void LoadLayers( FILE* f, int* linecnt );
@ -71,7 +71,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
/************************************************************************************************/ /************************************************************************************************/
/* Routine to load an EESchema file. /* Routine to load an EESchema file.
* Returns TRUE if file has been loaded (at list partially.) * Returns TRUE if file has been loaded (at least partially.)
*/ */
{ {
char Line[1024], * SLine; char Line[1024], * SLine;
@ -105,7 +105,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
return FALSE; return FALSE;
} }
MsgDiag = _( "Loading " ) + FullFileName; screen->m_FileName = FullFileName;
MsgDiag = _( "Loading " ) + screen->m_FileName;
PrintMsg( MsgDiag ); PrintMsg( MsgDiag );
if( fgets( Line, 1024 - 1, f ) == NULL if( fgets( Line, 1024 - 1, f ) == NULL
@ -184,7 +185,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT( "EESchema file Segment struct error at line %d, aborted" ), wxT( "EESchema file Segment struct error at line %d, aborted" ),
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
delete SegmentStruct; SAFE_DELETE( SegmentStruct ) ;
break; break;
} }
@ -200,7 +201,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 ) if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 )
{ {
MsgDiag.Printf( MsgDiag.Printf(
wxT( "EESchema file Raccord struct error at line %d, aborted" ), wxT( "EESchema file record struct error at line %d, aborted" ),
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
break; break;
@ -220,7 +221,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT( "EESchema file Raccord struct error at line %d, aborted" ), wxT( "EESchema file Raccord struct error at line %d, aborted" ),
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
delete RaccordStruct; SAFE_DELETE( RaccordStruct ) ;
break; break;
} }
@ -264,7 +265,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT( "EESchema file polyline struct error at line %d, aborted" ), wxT( "EESchema file polyline struct error at line %d, aborted" ),
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
delete PolylineStruct; SAFE_DELETE( PolylineStruct ) ;
break; break;
} }
} }
@ -286,7 +287,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT( "EESchema file connection struct error at line %d, aborted" ), wxT( "EESchema file connection struct error at line %d, aborted" ),
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
delete ConnectionStruct; SAFE_DELETE( ConnectionStruct ) ;
} }
else else
{ {
@ -380,10 +381,26 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
Struct = (EDA_BaseStruct*) TextStruct; Struct = (EDA_BaseStruct*) TextStruct;
} }
else if( Name1[0] == 'G' ) else if( Name1[0] == 'G')
{ {
DrawGlobalLabelStruct* TextStruct = DrawGlobalLabelStruct* TextStruct =
new DrawGlobalLabelStruct( pos, CONV_FROM_UTF8( text ) ); new DrawGlobalLabelStruct(pos, CONV_FROM_UTF8( text ) );
Struct = (EDA_BaseStruct*) TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
TextStruct->m_Shape = NET_OUTPUT;
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
TextStruct->m_Shape = NET_BIDI;
if( stricmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 )
TextStruct->m_Shape = NET_TRISTATE;
if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 )
TextStruct->m_Shape = NET_UNSPECIFIED;
}
else if( Name1[0] == 'H')
{
DrawHierLabelStruct* TextStruct =
new DrawHierLabelStruct(pos, CONV_FROM_UTF8( text ) );
Struct = (EDA_BaseStruct*) TextStruct; Struct = (EDA_BaseStruct*) TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
@ -448,6 +465,9 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
TestDanglingEnds( screen->EEDrawList, NULL ); TestDanglingEnds( screen->EEDrawList, NULL );
MsgDiag = _( "Done Loading " ) + screen->m_FileName;
PrintMsg( MsgDiag );
return TRUE; /* Although it may be that file is only partially loaded. */ return TRUE; /* Although it may be that file is only partially loaded. */
} }
@ -509,10 +529,29 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
if( strcmp( Name2, NULL_STRING ) != 0 ) if( strcmp( Name2, NULL_STRING ) != 0 )
{ {
for( ii = 0; ii < (int) strlen( Name2 ); ii++ ) bool isDigit = false;
for( ii = 0; ii < (int) strlen( Name2 ); ii++ ){
if( Name2[ii] == '~' ) if( Name2[ii] == '~' )
Name2[ii] = ' '; Name2[ii] = ' ';
//get RefBase from this, too. store in Name1.
if(Name2[ii] >= '0' && Name2[ii] <= '9'){
isDigit = true;
Name1[ii] = 0; //null-terminate.
}
if(!isDigit){
Name1[ii] = Name2[ii];
}
}
Name1[ii] = 0; //just in case
int jj;
for(jj=0; jj<ii && Name1[jj] == ' '; jj++);
if(jj == ii){
//blank string.
LibItemStruct->m_PrefixString = wxT("U");
}else{
LibItemStruct->m_PrefixString = CONV_FROM_UTF8(&Name1[jj]);
//printf("prefix: %s\n", CONV_TO_UTF8(LibItemStruct->m_PrefixString));
}
if( !newfmt ) if( !newfmt )
LibItemStruct->m_Field[REFERENCE].m_Text = CONV_FROM_UTF8( Name2 ); LibItemStruct->m_Field[REFERENCE].m_Text = CONV_FROM_UTF8( Name2 );
} }
@ -527,6 +566,8 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
* "P " = position * "P " = position
* "U " = Num Unit, et Conversion * "U " = Num Unit, et Conversion
* "Fn" = Champs ( n = 0.. = numero de champ ) * "Fn" = Champs ( n = 0.. = numero de champ )
* "Ar" = AlternateReference, in the case of multiple sheets
* referring to one schematic file.
*/ */
/* Lecture des champs */ /* Lecture des champs */
@ -537,6 +578,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
return TRUE; return TRUE;
if( (Line[0] != 'F' ) if( (Line[0] != 'F' )
&& (Line[0] != 'P' ) && (Line[0] != 'P' )
&& (Line[0] != 'A' )
&& (Line[0] != 'U' ) ) && (Line[0] != 'U' ) )
break; break;
@ -552,7 +594,32 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
sscanf( Line + 1, "%d %d", sscanf( Line + 1, "%d %d",
&LibItemStruct->m_Pos.x, &LibItemStruct->m_Pos.y ); &LibItemStruct->m_Pos.x, &LibItemStruct->m_Pos.y );
} }
if( Line[0] == 'A' && Line[1] == 'R' )
{
/*format:
AR Path="/9086AF6E/67452AA0" Ref="C99"
where 9086AF6E is the unique timestamp of the containing sheet
and 67452AA0 is the timestamp of this component.
C99 is the reference given this path.
*/
int i=2;
while(i<256 && Line[i] != '"'){ i++; } i++;
//copy the path.
int j = 0;
while(i<256 && Line[i] != '"'){Name1[j] = Line[i]; i++; j++;} i++;
Name1[j] = 0;
wxString path = CONV_FROM_UTF8(Name1);
//i should be one after the closing quote, match the next opening quote
while(i<256 && Line[i] != '"'){ i++; } i++;
j = 0;
while(i<256 && Line[i] != '"'){Name1[j] = Line[i]; i++; j++;} i++;
Name1[j] = 0;
wxString ref = CONV_FROM_UTF8(Name1);
LibItemStruct->m_Paths.Add(path);
LibItemStruct->m_References.Add(ref);
LibItemStruct->m_Field[REFERENCE].m_Text = ref;
}
if( Line[0] == 'F' ) if( Line[0] == 'F' )
{ {
char FieldUserName[1024]; char FieldUserName[1024];
@ -695,6 +762,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
{ {
LibItemStruct->Pnext = Window->EEDrawList; LibItemStruct->Pnext = Window->EEDrawList;
Window->EEDrawList = (EDA_BaseStruct*) LibItemStruct; Window->EEDrawList = (EDA_BaseStruct*) LibItemStruct;
LibItemStruct->m_Parent = Window;
} }
return Failed; /* Fin lecture 1 composant */ return Failed; /* Fin lecture 1 composant */
@ -718,7 +786,11 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
SheetStruct = new DrawSheetStruct(); SheetStruct = new DrawSheetStruct();
SheetStruct->m_TimeStamp = GetTimeStamp(); SheetStruct->m_TimeStamp = GetTimeStamp();
SheetStruct->m_Parent = Window; //sheets are added to the EEDrawList like other schematic components.
//however, in order to preserve the heirarchy (through m_Parent pointers),
//a duplicate of the sheet is added to m_SubSheet array.
//must be a duplicate, references just work for a two-layer structure.
//this is accomplished through the Sync() function.
if( Line[0] == '$' ) /* Ligne doit etre "$Sheet" */ if( Line[0] == '$' ) /* Ligne doit etre "$Sheet" */
{ {
@ -749,6 +821,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
LineCount++; LineCount++;
if( fgets( Line, 256 - 1, f ) == NULL ) if( fgets( Line, 256 - 1, f ) == NULL )
return TRUE; return TRUE;
if( Line[0] == 'U' ){
sscanf( Line + 1, "%lX", &(SheetStruct->m_TimeStamp) );
if(SheetStruct->m_TimeStamp == 0) //zero is not unique!
SheetStruct->m_TimeStamp = GetTimeStamp();
continue;
}
if( Line[0] != 'F' ) if( Line[0] != 'F' )
break; break;
sscanf( Line + 1, "%d", &fieldref ); sscanf( Line + 1, "%d", &fieldref );
@ -804,6 +882,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
else else
{ {
SheetStruct->m_FileName = CONV_FROM_UTF8( Name1 ); SheetStruct->m_FileName = CONV_FROM_UTF8( Name1 );
//printf("in ReadSheetDescr : SheetStruct->m_FileName = %s \n", Name1);
SheetStruct->m_FileNameSize = size; SheetStruct->m_FileNameSize = size;
} }
} }
@ -865,13 +944,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
LineCount ); LineCount );
Failed = TRUE; Failed = TRUE;
} }
if( !Failed ) if( !Failed )
{ {
SheetStruct->Pnext = Window->EEDrawList; SheetStruct->Pnext = Window->EEDrawList;
Window->EEDrawList = (EDA_BaseStruct*) SheetStruct; Window->EEDrawList = (EDA_BaseStruct*)SheetStruct;
SheetStruct->m_Parent = Window;
} }
return Failed; /* Fin lecture 1 composant */ return Failed; /* Fin lecture 1 composant */
} }
@ -918,7 +996,7 @@ static int ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* W
} }
/* Ajuste ecran */ /* Ajuste ecran */
Window->m_CurrentSheet = wsheet; Window->m_CurrentSheetDesc = wsheet;
/* Recheche suite et fin de descr */ /* Recheche suite et fin de descr */
for( ; ; ) for( ; ; )
@ -930,7 +1008,7 @@ static int ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* W
if( strnicmp( Line, "Sheet", 2 ) == 0 ) if( strnicmp( Line, "Sheet", 2 ) == 0 )
sscanf( Line + 5, " %d %d", sscanf( Line + 5, " %d %d",
&Window->m_SheetNumber, &Window->m_NumberOfSheet ); &Window->m_ScreenNumber, &Window->m_NumberOfScreen );
if( strnicmp( Line, "Title", 2 ) == 0 ) if( strnicmp( Line, "Title", 2 ) == 0 )
{ {

View File

@ -113,20 +113,19 @@ EDA_SchComponentStruct* LocateSmallestComponent( SCH_SCREEN* Screen )
*/ */
/***********************************************************************/ /***********************************************************************/
EDA_BaseStruct* PickStruct( const wxPoint& refpos, EDA_BaseStruct* PickStruct( const wxPoint& refpos,
EDA_BaseStruct* DrawList, int SearchMask ) BASE_SCREEN* screen, int SearchMask)
/************************************************************************/ /************************************************************************/
/* Search an item at pos pos /* Search an item at pos pos
*/ */
{ {
bool Snapped; bool Snapped;
int zoom = ActiveScreen->GetZoom(); EDA_BaseStruct* DrawList = screen->EEDrawList;
if( screen==NULL || DrawList == NULL )
if( DrawList == NULL )
return NULL; return NULL;
if( ( Snapped = SnapPoint2( refpos, SearchMask, if( ( Snapped = SnapPoint2( refpos, SearchMask,
DrawList, NULL, zoom ) ) != FALSE ) DrawList, NULL, screen->GetZoom() ) ) != FALSE )
{ {
return LastSnappedStruct; return LastSnappedStruct;
} }
@ -136,7 +135,7 @@ EDA_BaseStruct* PickStruct( const wxPoint& refpos,
/***********************************************************************/ /***********************************************************************/
EDA_BaseStruct* PickStruct( EDA_Rect& block, EDA_BaseStruct* PickStruct( EDA_Rect& block,
EDA_BaseStruct* DrawList, int SearchMask ) BASE_SCREEN* screen, int SearchMask )
/************************************************************************/ /************************************************************************/
/* Search items in block /* Search items in block
@ -156,6 +155,10 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
if( y < OrigY ) if( y < OrigY )
EXCHG( y, OrigY ); EXCHG( y, OrigY );
EDA_BaseStruct* DrawList = screen->EEDrawList;
if( screen==NULL || DrawList == NULL )
return NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) ) if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) )
@ -173,7 +176,7 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
/* Only one item was picked - convert to scalar form (no list): */ /* Only one item was picked - convert to scalar form (no list): */
PickedItem = PickedList; PickedItem = PickedList;
PickedList = (DrawPickedStruct*) PickedList->m_PickedStruct; PickedList = (DrawPickedStruct*) PickedList->m_PickedStruct;
delete PickedItem; SAFE_DELETE( PickedItem ) ;
} }
if( PickedList != NULL ) if( PickedList != NULL )
@ -377,8 +380,9 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) DrawList ) #define STRUCT ( (DrawLabelStruct*) DrawList )
if( !(SearchMask & LABELITEM) ) if( !(SearchMask & LABELITEM) )
break; break;
dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1 ); /* longueur */ dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1 ); /* longueur */
@ -592,9 +596,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
return TRUE; return TRUE;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) DrawStruct ) #define STRUCT ( (DrawLabelStruct*) DrawStruct )
dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* longueur totale */ dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* longueur totale */
dy = STRUCT->m_Size.y / 2; /* Demi hauteur */ dy = STRUCT->m_Size.y / 2; /* Demi hauteur */
xt1 = xt2 = STRUCT->m_Pos.x; xt1 = xt2 = STRUCT->m_Pos.x;

View File

@ -20,7 +20,7 @@ OBJECTS = eeschema.o\
cross-probing.o\ cross-probing.o\
setpage.o\ setpage.o\
cmpclass.o\ cmpclass.o\
class_hierarchy_sheet.o\ class_drawsheet.o\
class_text-label.o\ class_text-label.o\
component_class.o\ component_class.o\
libclass.o\ libclass.o\

View File

@ -209,7 +209,7 @@ wxString msg;
if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) ) if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) )
{ {
item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii); item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii);
if ( item ) delete item; if ( item ){ SAFE_DELETE( item );}
} }
} }
for ( ii = 0; ii < max_file; ii++ ) for ( ii = 0; ii < max_file; ii++ )

View File

@ -24,8 +24,9 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, bool use_
static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet ); static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet );
static void AddPinToComponentPinList( EDA_SchComponentStruct* Component, static void AddPinToComponentPinList( EDA_SchComponentStruct* Component,
DrawSheetList* sheet,
LibDrawPin* PinEntry ); LibDrawPin* PinEntry );
static void FindOthersUnits( EDA_SchComponentStruct* Component ); static void FindOthersUnits( EDA_SchComponentStruct* Component, DrawSheetList* Sheet_in);
static int SortPinsByNum( ObjetNetListStruct** Pin1, ObjetNetListStruct** Pin2 ); static int SortPinsByNum( ObjetNetListStruct** Pin1, ObjetNetListStruct** Pin2 );
static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin ); static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin );
@ -91,7 +92,7 @@ void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
/****************************************************************************/ /****************************************************************************/
static EDA_SchComponentStruct* FindNextComponentAndCreatPinList( static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
EDA_BaseStruct* DrawList ) EDA_BaseStruct* DrawList, DrawSheetList* sheet)
/****************************************************************************/ /****************************************************************************/
/* Find a "suitable" component from the DrawList /* Find a "suitable" component from the DrawList
@ -116,8 +117,18 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
Component = (EDA_SchComponentStruct*) DrawList; Component = (EDA_SchComponentStruct*) DrawList;
/* already tested ? : */ /* already tested ? : */
if( Component->m_FlagControlMulti == 1 ) bool found = false;
continue; /* yes */ for(unsigned int i =0; i<Component->m_UsedOnSheets.GetCount(); i++){
if( Component->m_UsedOnSheets.Item(i) == *sheet ){
found = true;
break;
}
}
if( found ) continue;
//if( Component->m_FlagControlMulti == 1 )
// continue; /* yes */
// removed because with multiple instances of one schematic
// (several sheets pointing to 1 screen), this will be erroneously be toggled.
Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )
@ -125,11 +136,12 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
/* Power symbol and other component which have the reference starting by /* Power symbol and other component which have the reference starting by
* "#" are not included in netlist (pseudo components) */ * "#" are not included in netlist (pseudo components) */
if( Component->m_Field[REFERENCE].m_Text[0] == '#' ) wxString str = Component->GetRef(sheet);
if( str[0] == '#' )
continue; continue;
/* Create the pin table for this component */ /* Create the pin table for this component */
int ii = sizeof(ObjetNetListStruct) * MAXPIN; int ii = sizeof(ObjetNetListStruct*) * MAXPIN;
if( s_SortedComponentPinList == NULL ) if( s_SortedComponentPinList == NULL )
s_SortedComponentPinList = (ObjetNetListStruct**) MyMalloc( ii ); s_SortedComponentPinList = (ObjetNetListStruct**) MyMalloc( ii );
memset( s_SortedComponentPinList, 0, ii ); memset( s_SortedComponentPinList, 0, ii );
@ -146,14 +158,15 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
&& (DEntry->m_Convert != Component->m_Convert) ) && (DEntry->m_Convert != Component->m_Convert) )
continue; continue;
{ {
AddPinToComponentPinList( Component, (LibDrawPin*) DEntry ); AddPinToComponentPinList( Component, sheet, (LibDrawPin*) DEntry );
} }
} }
Component->m_FlagControlMulti = 1; //Component->m_FlagControlMulti = 1;
Component->m_UsedOnSheets.Add(*sheet);
if( Entry->m_UnitCount > 1 ) if( Entry->m_UnitCount > 1 )
FindOthersUnits( Component ); FindOthersUnits( Component, sheet);
/* Tri sur le numero de Pin de TabListePin */ /* Tri sur le numero de Pin de TabListePin */
qsort( s_SortedComponentPinList, s_SortedPinCount, sizeof(ObjetNetListStruct*), qsort( s_SortedComponentPinList, s_SortedPinCount, sizeof(ObjetNetListStruct*),
@ -195,7 +208,7 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
{ {
if( g_TabObjNet[jj].GetNet() != netcode ) if( g_TabObjNet[jj].GetNet() != netcode )
continue; continue;
if( ( g_TabObjNet[jj].m_Type != NET_GLOBLABEL) if( ( g_TabObjNet[jj].m_Type != NET_HIERLABEL)
&& ( g_TabObjNet[jj].m_Type != NET_LABEL) && ( g_TabObjNet[jj].m_Type != NET_LABEL)
&& ( g_TabObjNet[jj].m_Type != NET_PINLABEL) ) && ( g_TabObjNet[jj].m_Type != NET_PINLABEL) )
continue; continue;
@ -206,8 +219,11 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
if( !NetName.IsEmpty() ) if( !NetName.IsEmpty() )
{ {
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ) if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
NetName << wxT( "_" ) << g_TabObjNet[jj].m_SheetNumber; NetName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
+ NetName;
}
//NetName << wxT("_") << g_TabObjNet[jj].m_SheetList.PathHumanReadable();
} }
else else
{ {
@ -217,7 +233,6 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
return NetName; return NetName;
} }
/***********************************************************************/ /***********************************************************************/
void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame, void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
const wxString& FullFileName ) const wxString& FullFileName )
@ -225,10 +240,11 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
/* Create a generic netlist, and call an external netlister /* Create a generic netlist, and call an external netlister
* to change the netlist syntax and create the file * to change the netlist syntax and create the file
* -- does this still work?
*/ */
{ {
wxString Line, FootprintName; wxString Line, FootprintName;
BASE_SCREEN* CurrScreen; DrawSheetList* sheet;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* Component; EDA_SchComponentStruct* Component;
wxString netname; wxString netname;
@ -250,12 +266,14 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
/* Create netlist module section */ /* Create netlist module section */
fprintf( tmpfile, "$BeginComponentList\n" ); fprintf( tmpfile, "$BeginComponentList\n" );
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
for( CurrScreen = ScreenList.GetFirst(); CurrScreen != NULL; CurrScreen = ScreenList.GetNext() )
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( DrawList = CurrScreen->EEDrawList; DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
{ {
DrawList = Component = FindNextComponentAndCreatPinList( DrawList ); DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
if( Component == NULL ) if( Component == NULL )
break; // No component left break; // No component left
@ -269,7 +287,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
fprintf( tmpfile, "\n$BeginComponent\n" ); fprintf( tmpfile, "\n$BeginComponent\n" );
fprintf( tmpfile, "TimeStamp=%8.8lX\n", Component->m_TimeStamp ); fprintf( tmpfile, "TimeStamp=%8.8lX\n", Component->m_TimeStamp );
fprintf( tmpfile, "Footprint=%s\n", CONV_TO_UTF8( FootprintName ) ); fprintf( tmpfile, "Footprint=%s\n", CONV_TO_UTF8( FootprintName ) );
Line = wxT( "Reference=" ) + Component->m_Field[REFERENCE].m_Text + wxT( "\n" ); Line = wxT( "Reference=" ) + Component->GetPath(sheet) + wxT( "\n" );
Line.Replace( wxT( " " ), wxT( "_" ) ); Line.Replace( wxT( " " ), wxT( "_" ) );
fprintf( tmpfile, CONV_TO_UTF8( Line ) ); fprintf( tmpfile, CONV_TO_UTF8( Line ) );
@ -337,7 +355,7 @@ static void ClearUsedFlags( WinEDA_SchematicFrame* frame )
SCH_SCREEN* screen; SCH_SCREEN* screen;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_ScreenList ScreenList( NULL ); EDA_ScreenList ScreenList;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{ {
@ -347,7 +365,8 @@ static void ClearUsedFlags( WinEDA_SchematicFrame* frame )
if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
EDA_SchComponentStruct* Component = (EDA_SchComponentStruct*) DrawList; EDA_SchComponentStruct* Component = (EDA_SchComponentStruct*) DrawList;
Component->m_FlagControlMulti = 0; //Component->m_FlagControlMulti = 0;
Component->m_UsedOnSheets.Clear();
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
} }
@ -365,14 +384,14 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
* les nodes sont identifies par le netname * les nodes sont identifies par le netname
* sinon les nodes sont identifies par le netnumber * sinon les nodes sont identifies par le netnumber
* *
* tous les textes graphiques commençant par [.-+]pspice ou [.-+]gnucap * tous les textes graphiques commen<EFBFBD>ant par [.-+]pspice ou [.-+]gnucap
* sont considérés comme des commandes a placer dans la netliste * sont consid<EFBFBD>r<EFBFBD>s comme des commandes a placer dans la netliste
* [.-]pspice ou gnucap sont en debut * [.-]pspice ou gnucap sont en debut
+pspice et +gnucap sont en fin de netliste +pspice et +gnucap sont en fin de netliste
*/ */
{ {
char Line[1024]; char Line[1024];
SCH_SCREEN* screen; DrawSheetList* sheet;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* Component; EDA_SchComponentStruct* Component;
int ii, nbitems; int ii, nbitems;
@ -389,11 +408,11 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
/* Create text list starting by [.-]pspice , or [.-]gnucap (simulator commands) */ /* Create text list starting by [.-]pspice , or [.-]gnucap (simulator commands) */
/* and create text list starting by [+]pspice , or [+]gnucap (simulator commands) */ /* and create text list starting by [+]pspice , or [+]gnucap (simulator commands) */
bufnum[BUFYPOS_LEN] = 0; bufnum[BUFYPOS_LEN] = 0;
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( DrawList = screen->EEDrawList; DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
{ {
wxChar ident; wxChar ident;
if( DrawList->Type() != DRAW_TEXT_STRUCT_TYPE ) if( DrawList->Type() != DRAW_TEXT_STRUCT_TYPE )
@ -444,15 +463,15 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
/* Create component list */ /* Create component list */
ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/ ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( DrawList = screen->EEDrawList; DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
{ {
DrawList = Component = FindNextComponentAndCreatPinList( DrawList ); DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
if( Component == NULL ) if( Component == NULL )
break; break;
fprintf( f, "%s ", CONV_TO_UTF8( Component->m_Field[REFERENCE].m_Text ) ); fprintf( f, "%s ", CONV_TO_UTF8( Component->GetRef( sheet ) ) );
// Write pin list: // Write pin list:
for( ii = 0; ii < s_SortedPinCount; ii++ ) for( ii = 0; ii < s_SortedPinCount; ii++ )
@ -514,11 +533,11 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
{ {
wxString Line, FootprintName; wxString Line, FootprintName;
char Buf[256]; char Buf[256];
SCH_SCREEN* CurrScreen; DrawSheetList* sheet;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* Component; EDA_SchComponentStruct* Component;
int ii; int ii;
EDA_SchComponentStruct** CmpList = NULL; ListComponent* CmpList = NULL;
int CmpListCount = 0, CmpListSize = 1000; int CmpListCount = 0, CmpListSize = 1000;
DateAndTime( Buf ); DateAndTime( Buf );
@ -531,13 +550,13 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
/* Create netlist module section */ /* Create netlist module section */
ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/ ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
for( CurrScreen = ScreenList.GetFirst(); CurrScreen != NULL; CurrScreen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( DrawList = CurrScreen->EEDrawList; DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
{ {
DrawList = Component = FindNextComponentAndCreatPinList( DrawList ); DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet);
if( Component == NULL ) if( Component == NULL )
break; break;
@ -548,20 +567,19 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
{ {
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list */ if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list */
{ {
if( CmpList == NULL ) if( CmpList == NULL ){
CmpList = (EDA_SchComponentStruct**) MyZMalloc( sizeof( CmpList = (ListComponent*)
EDA_SchComponentStruct MyZMalloc( sizeof(ListComponent) * CmpListSize );
*) * CmpListSize ); }
if( CmpListCount >= CmpListSize ) if( CmpListCount >= CmpListSize )
{ {
CmpListSize += 1000; CmpListSize += 1000;
CmpList = (EDA_SchComponentStruct**) realloc( CmpList = (ListComponent*) realloc(
CmpList, CmpList,
sizeof( sizeof(ListComponent) * CmpListSize );
EDA_SchComponentStruct*)
* CmpListSize );
} }
CmpList[CmpListCount] = Component; CmpList[CmpListCount].m_Comp = Component;
strcpy(CmpList[CmpListCount].m_Ref, Component->GetRef( sheet ).mb_str());
CmpListCount++; CmpListCount++;
} }
} }
@ -574,10 +592,9 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
else else
FootprintName = wxT( "$noname" ); FootprintName = wxT( "$noname" );
Line = Component->m_Field[REFERENCE].m_Text; Line = Component->GetRef(sheet);
Line.Replace( wxT( " " ), wxT( "_" ) ); fprintf( f, " ( %s %s",
fprintf( f, " ( %8.8lX %s", CONV_TO_UTF8(Component->GetPath(sheet)),
Component->m_TimeStamp,
CONV_TO_UTF8( FootprintName ) ); CONV_TO_UTF8( FootprintName ) );
fprintf( f, " %s", CONV_TO_UTF8( Line ) ); fprintf( f, " %s", CONV_TO_UTF8( Line ) );
@ -622,11 +639,16 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
for( ii = 0; ii < CmpListCount; ii++ ) for( ii = 0; ii < CmpListCount; ii++ )
{ {
Component = CmpList[ii]; Component = CmpList[ii].m_Comp;
Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Line = Component->m_Field[REFERENCE].m_Text; //Line.Printf(_("%s"), CmpList[ii].m_Ref);
Line.Replace( wxT( " " ), wxT( "_" ) ); //Line.Replace( wxT( " " ), wxT( "_" ) );
fprintf( f, "$component %s\n", CONV_TO_UTF8( Line ) ); unsigned int i;
for(i=0; i<sizeof(CmpList[ii].m_Ref) && CmpList[ii].m_Ref[i]; i++){
if(CmpList[ii].m_Ref[i] == ' ')
CmpList[ii].m_Ref[i] = '_';
}
fprintf( f, "$component %s\n", CmpList[ii].m_Ref );
/* Write the footprint list */ /* Write the footprint list */
for( unsigned int jj = 0; jj < Entry->m_FootprintList.GetCount(); jj++ ) for( unsigned int jj = 0; jj < Entry->m_FootprintList.GetCount(); jj++ )
{ {
@ -652,7 +674,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
/*************************************************************************************/ /*************************************************************************************/
static void AddPinToComponentPinList( EDA_SchComponentStruct* Component, LibDrawPin* Pin ) static void AddPinToComponentPinList( EDA_SchComponentStruct* Component,
DrawSheetList* sheetlist, LibDrawPin* Pin )
/*************************************************************************************/ /*************************************************************************************/
/* Add a new pin description in the pin list s_SortedComponentPinList /* Add a new pin description in the pin list s_SortedComponentPinList
@ -669,6 +692,8 @@ static void AddPinToComponentPinList( EDA_SchComponentStruct* Component, LibDraw
continue; continue;
if( g_TabObjNet[ii].m_Link != Component ) if( g_TabObjNet[ii].m_Link != Component )
continue; continue;
if( g_TabObjNet[ii].m_SheetList != *sheetlist )
continue;
if( g_TabObjNet[ii].m_PinNum != Pin->m_PinNum ) if( g_TabObjNet[ii].m_PinNum != Pin->m_PinNum )
continue; continue;
{ {
@ -716,7 +741,7 @@ static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin )
/**********************************************************************/ /**********************************************************************/
static void FindOthersUnits( EDA_SchComponentStruct* Component ) static void FindOthersUnits( EDA_SchComponentStruct* Component_in, DrawSheetList* Sheet_in)
/**********************************************************************/ /**********************************************************************/
/* Recherche les autres parts du boitier auquel appartient la part Component, /* Recherche les autres parts du boitier auquel appartient la part Component,
@ -728,13 +753,15 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component )
EDA_SchComponentStruct* Component2; EDA_SchComponentStruct* Component2;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
LibEDA_BaseStruct* DEntry; LibEDA_BaseStruct* DEntry;
SCH_SCREEN* screen; DrawSheetList* sheet;
wxString str;
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
unsigned int i;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) bool found;
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
DrawList = screen->EEDrawList; DrawList = sheet->LastDrawList();
while( DrawList ) while( DrawList )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
@ -742,17 +769,24 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component )
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
Component2 = (EDA_SchComponentStruct*) DrawList; Component2 = (EDA_SchComponentStruct*) DrawList;
if( Component2->m_FlagControlMulti == 1 ) found = false;
break; for( i =0; i<Component2->m_UsedOnSheets.GetCount(); i++){
if( Component2->m_UsedOnSheets.Item(i) == *Sheet_in ){
if( Component2->m_Field[REFERENCE].m_Text.CmpNoCase( found = true;
Component->m_Field[REFERENCE].m_Text ) != 0 ) }
}
if( found ) break;
//if( Component2->m_FlagControlMulti == 1 ) //has it been used? (on this sheet?)
// break;
str = Component2->GetRef(sheet);
if( str.CmpNoCase( Component_in->GetRef(Sheet_in) ) != 0 )
break; break;
Entry = FindLibPart( Component2->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( Component2->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )
break; break;
if( Component2->m_Field[REFERENCE].m_Text[0] == '#' )
if( str[0] == '#' )
break; break;
if( Entry->m_Drawings != NULL ) if( Entry->m_Drawings != NULL )
@ -769,11 +803,12 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component )
&& (DEntry->m_Convert != Component2->m_Convert) ) && (DEntry->m_Convert != Component2->m_Convert) )
continue; continue;
{ {
AddPinToComponentPinList( Component2, (LibDrawPin*) DEntry ); AddPinToComponentPinList( Component2, sheet, (LibDrawPin*) DEntry );
} }
} }
} }
Component2->m_FlagControlMulti = 1; Component2->m_UsedOnSheets.Add(*Sheet_in);
//Component2->m_FlagControlMulti = 1; //mark it as used..
break; break;
default: default:
@ -832,7 +867,7 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
{ {
if( ObjNet[jj].GetNet() != NetCode ) if( ObjNet[jj].GetNet() != NetCode )
continue; continue;
if( ( ObjNet[jj].m_Type != NET_GLOBLABEL) if( ( ObjNet[jj].m_Type != NET_HIERLABEL)
&& ( ObjNet[jj].m_Type != NET_LABEL) && ( ObjNet[jj].m_Type != NET_LABEL)
&& ( ObjNet[jj].m_Type != NET_PINLABEL) ) && ( ObjNet[jj].m_Type != NET_PINLABEL) )
continue; continue;
@ -845,8 +880,13 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
if( !NetName.IsEmpty() ) if( !NetName.IsEmpty() )
{ {
NetcodeName += NetName; NetcodeName += NetName;
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ) // usual net name, add it the sheet number if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
NetcodeName << wxT( "_" ) << g_TabObjNet[jj].m_SheetNumber; // usual net name, add in the sheet path
NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
+ NetcodeName;
//NetcodeName << wxT("_") <<
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
}
} }
NetcodeName += wxT( "\"" ); NetcodeName += wxT( "\"" );
LastNetCode = NetCode; LastNetCode = NetCode;
@ -856,7 +896,7 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
continue; continue;
Cmp = (EDA_SchComponentStruct*) ObjNet[ii].m_Link; Cmp = (EDA_SchComponentStruct*) ObjNet[ii].m_Link;
CmpRef = Cmp->m_Field[REFERENCE].m_Text; CmpRef = Cmp->GetRef(&ObjNet[ii].m_SheetList); //is this correct?
if( CmpRef.StartsWith( wxT( "#" ) ) ) if( CmpRef.StartsWith( wxT( "#" ) ) )
continue; // Pseudo component (Like Power symbol) continue; // Pseudo component (Like Power symbol)
@ -919,7 +959,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
wxString msg; wxString msg;
wxString FootprintName; wxString FootprintName;
char Line[1024]; char Line[1024];
BASE_SCREEN* CurrScreen; DrawSheetList* sheet;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* Component; EDA_SchComponentStruct* Component;
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
@ -933,13 +973,13 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
/* Create netlist module section */ /* Create netlist module section */
ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/ ClearUsedFlags( frame ); /* Reset the flags FlagControlMulti in all schematic files*/
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
for( CurrScreen = ScreenList.GetFirst(); CurrScreen != NULL; CurrScreen = ScreenList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( DrawList = CurrScreen->EEDrawList; DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
{ {
DrawList = Component = FindNextComponentAndCreatPinList( DrawList ); DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet);
if( Component == NULL ) if( Component == NULL )
break; break;
@ -951,8 +991,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
else else
FootprintName = wxT( "$noname" ); FootprintName = wxT( "$noname" );
msg = Component->m_Field[REFERENCE].m_Text; msg = Component->GetRef(sheet);
msg.Replace( wxT( " " ), wxT( "_" ) );
fprintf( f, "%s ", CONV_TO_UTF8( StartCmpDesc ) ); fprintf( f, "%s ", CONV_TO_UTF8( StartCmpDesc ) );
fprintf( f, "%s", CONV_TO_UTF8( msg ) ); fprintf( f, "%s", CONV_TO_UTF8( msg ) );
@ -1007,7 +1046,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
{ {
if( ObjNet[jj].GetNet() != NetCode ) if( ObjNet[jj].GetNet() != NetCode )
continue; continue;
if( ( ObjNet[jj].m_Type != NET_GLOBLABEL) if( ( ObjNet[jj].m_Type != NET_HIERLABEL)
&& ( ObjNet[jj].m_Type != NET_LABEL) && ( ObjNet[jj].m_Type != NET_LABEL)
&& ( ObjNet[jj].m_Type != NET_PINLABEL) ) && ( ObjNet[jj].m_Type != NET_PINLABEL) )
continue; continue;
@ -1019,8 +1058,12 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
if( !NetName.IsEmpty() ) if( !NetName.IsEmpty() )
{ {
NetcodeName += NetName; NetcodeName += NetName;
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ) if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
NetcodeName << wxT( "_" ) << g_TabObjNet[jj].m_SheetNumber; NetcodeName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
+ NetcodeName;
//NetcodeName << wxT("_") <<
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
}
} }
else // this net has no name: create a default name $<net number> else // this net has no name: create a default name $<net number>
NetcodeName << wxT( "$" ) << NetCode; NetcodeName << wxT( "$" ) << NetCode;
@ -1037,8 +1080,8 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
continue; continue;
Cmp = (EDA_SchComponentStruct*) ObjNet[ii].m_Link; Cmp = (EDA_SchComponentStruct*) ObjNet[ii].m_Link;
wxString refstr = Cmp->GetRef(&(ObjNet[ii].m_SheetList));
if( Cmp->m_Field[REFERENCE].m_Text[0] == '#' ) if( refstr[0] == '#' )
continue; // Pseudo composant (symboles d'alims) continue; // Pseudo composant (symboles d'alims)
switch( print_ter ) switch( print_ter )
@ -1051,7 +1094,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
str_pinnum = CONV_FROM_UTF8( buf ); str_pinnum = CONV_FROM_UTF8( buf );
InitNetDescLine.Printf( wxT( "\n%s %s %.4s %s" ), InitNetDescLine.Printf( wxT( "\n%s %s %.4s %s" ),
InitNetDesc.GetData(), InitNetDesc.GetData(),
Cmp->m_Field[REFERENCE].m_Text.GetData(), refstr.GetData(),
str_pinnum.GetData(), NetcodeName.GetData() ); str_pinnum.GetData(), NetcodeName.GetData() );
} }
print_ter++; print_ter++;
@ -1061,14 +1104,14 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
fprintf( f, "%s\n", CONV_TO_UTF8( InitNetDescLine ) ); fprintf( f, "%s\n", CONV_TO_UTF8( InitNetDescLine ) );
fprintf( f, "%s %s %.4s\n", fprintf( f, "%s %s %.4s\n",
CONV_TO_UTF8( StartNetDesc ), CONV_TO_UTF8( StartNetDesc ),
CONV_TO_UTF8( Cmp->m_Field[REFERENCE].m_Text ), CONV_TO_UTF8( refstr ),
(char*) &ObjNet[ii].m_PinNum ); (char*) &ObjNet[ii].m_PinNum );
print_ter++; print_ter++;
break; break;
default: default:
fprintf( f, " %s %.4s\n", fprintf( f, " %s %.4s\n",
CONV_TO_UTF8( Cmp->m_Field[REFERENCE].m_Text ), CONV_TO_UTF8( refstr ),
(char*) &ObjNet[ii].m_PinNum ); (char*) &ObjNet[ii].m_PinNum );
break; break;
} }
@ -1085,7 +1128,9 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
continue; continue;
EDA_SchComponentStruct* tstcmp = EDA_SchComponentStruct* tstcmp =
(EDA_SchComponentStruct*) ObjNet[jj].m_Link; (EDA_SchComponentStruct*) ObjNet[jj].m_Link;
if( Cmp->m_Field[REFERENCE].m_Text != tstcmp->m_Field[REFERENCE].m_Text ) wxString p = Cmp->GetPath( &( ObjNet[ii].m_SheetList ) );
wxString tstp = tstcmp->GetPath( &( ObjNet[jj].m_SheetList ) );
if( p.Cmp(tstp) != 0 )
continue; continue;
if( ObjNet[jj].m_PinNum == ObjNet[ii].m_PinNum ) if( ObjNet[jj].m_PinNum == ObjNet[ii].m_PinNum )

View File

@ -15,16 +15,16 @@
/* Routines locales */ /* Routines locales */
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus ); static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
static void SheetLabelConnection( ObjetNetListStruct* SheetLabel ); static void SheetLabelConnect( ObjetNetListStruct* SheetLabel );
static int ListeObjetConnection( WinEDA_SchematicFrame* frame, static int ListeObjetConnection( WinEDA_SchematicFrame* frame,
SCH_SCREEN* screen, DrawSheetList* sheetlist,
ObjetNetListStruct* ObjNet ); ObjetNetListStruct* ObjNet );
static int ConvertBusToMembers( ObjetNetListStruct* ObjNet ); static int ConvertBusToMembers( ObjetNetListStruct* ObjNet );
static void PointToPointConnect( ObjetNetListStruct* RefObj, int IsBus, static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus,
int start ); int start );
static void SegmentToPointConnect( ObjetNetListStruct* Jonction, int IsBus, static void SegmentToPointConnect( ObjetNetListStruct* Jonction, int IsBus,
int start ); int start );
static void LabelConnection( ObjetNetListStruct* Label ); static void LabelConnect( ObjetNetListStruct* Label );
static int TriNetCode( const void* o1, const void* o2 ); static int TriNetCode( const void* o1, const void* o2 );
static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems ); static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems );
static void SetUnconnectedFlag( ObjetNetListStruct* ObjNet, int NbItems ); static void SetUnconnectedFlag( ObjetNetListStruct* ObjNet, int NbItems );
@ -37,7 +37,7 @@ static int s_PassNumber;
#if defined(DEBUG) #if defined(DEBUG)
#include <iostream>
const char* ShowType( NetObjetType aType ) const char* ShowType( NetObjetType aType )
{ {
const char* ret; const char* ret;
@ -48,8 +48,10 @@ const char* ShowType( NetObjetType aType )
case NET_BUS: ret = "bus"; break; case NET_BUS: ret = "bus"; break;
case NET_JONCTION: ret = "junction"; break; case NET_JONCTION: ret = "junction"; break;
case NET_LABEL: ret = "label"; break; case NET_LABEL: ret = "label"; break;
case NET_HIERLABEL: ret = "hierlabel"; break;
case NET_GLOBLABEL: ret = "glabel"; break; case NET_GLOBLABEL: ret = "glabel"; break;
case NET_BUSLABELMEMBER: ret = "buslblmember"; break; case NET_BUSLABELMEMBER: ret = "buslblmember"; break;
case NET_HIERBUSLABELMEMBER: ret = "hierbuslblmember"; break;
case NET_GLOBBUSLABELMEMBER: ret = "gbuslblmember"; break; case NET_GLOBBUSLABELMEMBER: ret = "gbuslblmember"; break;
case NET_SHEETBUSLABELMEMBER: ret = "sbuslblmember"; break; case NET_SHEETBUSLABELMEMBER: ret = "sbuslblmember"; break;
case NET_SHEETLABEL: ret = "sheetlabel"; break; case NET_SHEETLABEL: ret = "sheetlabel"; break;
@ -64,10 +66,11 @@ const char* ShowType( NetObjetType aType )
void ObjetNetListStruct::Show( std::ostream& out, int ndx ) void ObjetNetListStruct::Show( std::ostream& out, int ndx )
{ {
wxString path = m_SheetList.PathHumanReadable();
out << "<netItem ndx=\"" << ndx << '"' << out << "<netItem ndx=\"" << ndx << '"' <<
" type=\"" << ShowType(m_Type) << '"' << " type=\"" << ShowType(m_Type) << '"' <<
" netCode=\"" << GetNet() << '"' << " netCode=\"" << GetNet() << '"' <<
" sheet=\"" << m_SheetNumber << '"' << " sheet=\"" << CONV_TO_UTF8(path) << '"' <<
">\n"; ">\n";
out << " <start " << m_Start << "/> <end " << m_End << "/>\n"; out << " <start " << m_Start << "/> <end " << m_End << "/>\n";
@ -117,15 +120,18 @@ void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems )
case NET_JONCTION: case NET_JONCTION:
case NET_BUS: case NET_BUS:
case NET_LABEL: case NET_LABEL:
case NET_HIERLABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
case NET_PINLABEL: case NET_PINLABEL:
case NET_NOCONNECT: case NET_NOCONNECT:
break; break;
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
delete TabNetItems[i].m_Label; SAFE_DELETE( TabNetItems[i].m_Label );
//see the note in ConvertBustToMembers
break; break;
} }
} }
@ -137,16 +143,15 @@ void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems )
/*****************************************************/ /*****************************************************/
void* WinEDA_SchematicFrame::BuildNetListBase() void* WinEDA_SchematicFrame::BuildNetListBase()
/*****************************************************/ /*****************************************************/
/* Routine qui construit le tableau des elements connectes du projet /* Routine qui construit le tableau des elements connectes du projet
* met a jour: * met a jour:
* g_TabObjNet * g_TabObjNet
* g_NbrObjNet * g_NbrObjNet
*/ */
{ {
int NetNumber, SheetNumber; int NetNumber;
int i, istart, NetCode; int i, istart, NetCode;
SCH_SCREEN* screen; DrawSheetList* sheet;
wxString msg; wxString msg;
wxBusyCursor Busy; wxBusyCursor Busy;
@ -156,22 +161,19 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, LIGHTRED ); Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, LIGHTRED );
/* Build the screen list */ /* Build the sheet (not screen) list (flattened)*/
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetListList( NULL );
i=0;
/* 1ere passe : Comptage du nombre d'objet de Net */ /* 1ere passe : Comptage du nombre d'objet de Net */
g_NbrObjNet = 0; g_NbrObjNet = 0;
g_TabObjNet = NULL; /* Init pour le 1er passage dans ListeObjetConnection */ g_TabObjNet = NULL; /* Init pour le 1er passage dans ListeObjetConnection */
/* Update the sheet number, sheet count and date and count nelist items */ /* count nelist items */
ScreenSch->SetModify(); g_RootSheet->m_s->SetModify();
int kk = 1;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( sheet = SheetListList.GetFirst(); sheet != NULL; sheet = SheetListList.GetNext() )
{ {
screen->m_SheetNumber = kk++; g_NbrObjNet += ListeObjetConnection( this, sheet, NULL );
screen->m_NumberOfSheet = ScreenList.GetCount();
screen->m_Date = GenDate();
g_NbrObjNet += ListeObjetConnection( this, screen, NULL );
} }
if( g_NbrObjNet == 0 ) if( g_NbrObjNet == 0 )
@ -186,15 +188,16 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
return NULL; return NULL;
/* 2eme passe : Remplissage des champs des structures des objets de Net */ /* 2eme passe : Remplissage des champs des structures des objets de Net */
/* second pass: fill the fields of the structures in the Net */
s_PassNumber++; s_PassNumber++;
Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, RED ); Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, RED );
screen = ScreenList.GetFirst(); sheet = SheetListList.GetFirst();
for( ObjetNetListStruct* tabObjNet = g_TabObjNet; for( ObjetNetListStruct* tabObjNet = g_TabObjNet;
screen != NULL; screen = ScreenList.GetNext() ) sheet != NULL; sheet = SheetListList.GetNext() )
{ {
tabObjNet += ListeObjetConnection( this, screen, tabObjNet ); tabObjNet += ListeObjetConnection( this, sheet, tabObjNet );
} }
Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), RED ); Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), RED );
@ -209,14 +212,14 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
Affiche_1_Parametre( this, 18, _( "Conn" ), wxEmptyString, CYAN ); Affiche_1_Parametre( this, 18, _( "Conn" ), wxEmptyString, CYAN );
SheetNumber = g_TabObjNet[0].m_SheetNumber; sheet = &(g_TabObjNet[0].m_SheetList);
LastNetCode = LastBusNetCode = 1; LastNetCode = LastBusNetCode = 1;
for( i = istart = 0; i<g_NbrObjNet; i++ ) for( i = istart = 0; i<g_NbrObjNet; i++ )
{ {
if( g_TabObjNet[i].m_SheetNumber != SheetNumber ) if( g_TabObjNet[i].m_SheetList != *sheet )
{ {
SheetNumber = g_TabObjNet[i].m_SheetNumber; sheet = &(g_TabObjNet[i].m_SheetList);
istart = i; istart = i;
} }
@ -258,6 +261,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
break; break;
case NET_LABEL: case NET_LABEL:
case NET_HIERLABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
/* Controle des connexions type jonction ( Sans BUS ) */ /* Controle des connexions type jonction ( Sans BUS ) */
if( g_TabObjNet[i].GetNet() == 0 ) if( g_TabObjNet[i].GetNet() == 0 )
@ -283,6 +287,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
break; break;
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
/* Controle des connexions semblables a des sur BUS */ /* Controle des connexions semblables a des sur BUS */
if( g_TabObjNet[i].GetNet() == 0 ) if( g_TabObjNet[i].GetNet() == 0 )
@ -297,7 +302,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
#if 0 && defined(DEBUG) #if 0 && defined(DEBUG)
std::cout << "after sheet local\n"; std::cout << "\n\nafter sheet local\n\n";
dumpNetTable(); dumpNetTable();
#endif #endif
@ -327,16 +332,18 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
case NET_PINLABEL: case NET_PINLABEL:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
LabelConnection( g_TabObjNet + i ); LabelConnect( g_TabObjNet + i );
break; break;
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_HIERLABEL:
case NET_HIERBUSLABELMEMBER:
break; break;
} }
} }
#if 0 && defined(DEBUG) #if 0 && defined(DEBUG)
std::cout << "after sheet global\n"; std::cout << "\n\nafter sheet global\n\n";
dumpNetTable(); dumpNetTable();
#endif #endif
@ -349,7 +356,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
{ {
if( g_TabObjNet[i].m_Type == NET_SHEETLABEL if( g_TabObjNet[i].m_Type == NET_SHEETLABEL
|| g_TabObjNet[i].m_Type == NET_SHEETBUSLABELMEMBER ) || g_TabObjNet[i].m_Type == NET_SHEETBUSLABELMEMBER )
SheetLabelConnection( g_TabObjNet + i ); SheetLabelConnect( g_TabObjNet + i );
} }
/* Tri du Tableau des objets de Net par NetCode */ /* Tri du Tableau des objets de Net par NetCode */
@ -388,7 +395,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
/************************************************************* /*************************************************************
* Routine qui connecte les sous feuilles par les sheetLabels * * Routine qui connecte les sous feuilles par les sheetLabels *
**************************************************************/ **************************************************************/
static void SheetLabelConnection( ObjetNetListStruct* SheetLabel ) static void SheetLabelConnect( ObjetNetListStruct* SheetLabel )
{ {
int i; int i;
ObjetNetListStruct* ObjetNet; ObjetNetListStruct* ObjetNet;
@ -402,18 +409,18 @@ static void SheetLabelConnection( ObjetNetListStruct* SheetLabel )
* pour regroupement des NetCodes */ * pour regroupement des NetCodes */
for( i = 0, ObjetNet = g_TabObjNet; i < g_NbrObjNet; i++ ) for( i = 0, ObjetNet = g_TabObjNet; i < g_NbrObjNet; i++ )
{ {
if( ObjetNet[i].m_SheetNumber != SheetLabel->m_NumInclude ) if( ObjetNet[i].m_SheetList != SheetLabel->m_SheetListInclude )
continue; continue; //use SheetInclude, not the sheet!!
if( (ObjetNet[i].m_Type != NET_GLOBLABEL ) if( (ObjetNet[i].m_Type != NET_HIERLABEL )
&& (ObjetNet[i].m_Type != NET_GLOBBUSLABELMEMBER ) ) && (ObjetNet[i].m_Type != NET_HIERBUSLABELMEMBER ) )
continue; continue;
if( ObjetNet[i].GetNet() == SheetLabel->GetNet() ) if( ObjetNet[i].GetNet() == SheetLabel->GetNet() )
continue; continue; //already connected.
if( ObjetNet[i].m_Label->CmpNoCase( *SheetLabel->m_Label ) != 0 ) if( ObjetNet[i].m_Label->CmpNoCase( *SheetLabel->m_Label ) != 0 )
continue; continue; //different names.
/* Propagation du Netcode a tous les Objets de meme NetCode */ /* Propagation du Netcode a tous les Objets de meme NetCode */
if( ObjetNet[i].GetNet() ) if( ObjetNet[i].GetNet() )
@ -425,32 +432,35 @@ static void SheetLabelConnection( ObjetNetListStruct* SheetLabel )
/*****************************************************************************/ /*****************************************************************************/
static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* screen, static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetList* sheetlist,
ObjetNetListStruct* ObjNet ) ObjetNetListStruct* ObjNet )
/*****************************************************************************/ /*****************************************************************************/
/* Routine generant la liste des objets relatifs aux connection /* Routine generant la liste des objets relatifs aux connection
* entree: * entree:
* screen: pointeur sur l'ecran a traiter * sheetlist: pointer to a sheetlist.
* ObjNet: * ObjNet:
* si NULL: la routine compte seulement le nombre des objets * si NULL: la routine compte seulement le nombre des objets
* sinon: pointe le tableau a remplir * sinon: pointe le tableau a remplir
*/ */
{ {
int ii, NbrItem = 0, NumSheet; int ii, NbrItem = 0;
EDA_BaseStruct* DrawList; EDA_BaseStruct* DrawList;
EDA_SchComponentStruct* DrawLibItem; EDA_SchComponentStruct* DrawLibItem;
int TransMat[2][2], PartX, PartY, x2, y2; int TransMat[2][2], PartX, PartY, x2, y2;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
LibEDA_BaseStruct* DEntry; LibEDA_BaseStruct* DEntry;
DrawSheetLabelStruct* SheetLabel; DrawSheetLabelStruct* SheetLabel;
int NumInclude; DrawSheetList list;
NumSheet = screen->m_SheetNumber; DrawList = sheetlist->LastScreen()->EEDrawList;
DrawList = screen->EEDrawList;
for( ; DrawList; DrawList = DrawList->Pnext ) for( ; DrawList; DrawList = DrawList->Pnext )
{ {
if( ObjNet ){
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
//used for DrawSheetLabels
}
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
@ -463,8 +473,6 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
break; break;
ObjNet[NbrItem].m_Comp = STRUCT; ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Screen = screen;
ObjNet[NbrItem].m_SheetNumber = NumSheet;
ObjNet[NbrItem].m_Start = STRUCT->m_Start; ObjNet[NbrItem].m_Start = STRUCT->m_Start;
ObjNet[NbrItem].m_End = STRUCT->m_End; ObjNet[NbrItem].m_End = STRUCT->m_End;
@ -486,9 +494,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
if( ObjNet ) if( ObjNet )
{ {
ObjNet[NbrItem].m_Comp = STRUCT; ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Screen = screen;
ObjNet[NbrItem].m_Type = NET_JONCTION; ObjNet[NbrItem].m_Type = NET_JONCTION;
ObjNet[NbrItem].m_SheetNumber = NumSheet;
ObjNet[NbrItem].m_Start = STRUCT->m_Pos; ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start; ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
} }
@ -501,9 +507,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
if( ObjNet ) if( ObjNet )
{ {
ObjNet[NbrItem].m_Comp = STRUCT; ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Screen = screen;
ObjNet[NbrItem].m_Type = NET_NOCONNECT; ObjNet[NbrItem].m_Type = NET_NOCONNECT;
ObjNet[NbrItem].m_SheetNumber = NumSheet;
ObjNet[NbrItem].m_Start = STRUCT->m_Pos; ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start; ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
} }
@ -517,14 +521,14 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
if( ObjNet ) if( ObjNet )
{ {
ObjNet[NbrItem].m_Comp = STRUCT; ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Screen = screen;
ObjNet[NbrItem].m_Type = NET_LABEL; ObjNet[NbrItem].m_Type = NET_LABEL;
if( STRUCT->m_Layer == LAYER_GLOBLABEL ) if( STRUCT->m_Layer == LAYER_GLOBLABEL )
ObjNet[NbrItem].m_Type = NET_GLOBLABEL; ObjNet[NbrItem].m_Type = NET_GLOBLABEL;
if( STRUCT->m_Layer == LAYER_HIERLABEL )
ObjNet[NbrItem].m_Type = NET_HIERLABEL;
ObjNet[NbrItem].m_Label = &STRUCT->m_Text; ObjNet[NbrItem].m_Label = &STRUCT->m_Text;
ObjNet[NbrItem].m_SheetNumber = NumSheet;
ObjNet[NbrItem].m_Start = STRUCT->m_Pos; ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start; ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
@ -536,20 +540,21 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) DrawList ) #define STRUCT ( (DrawLabelStruct*) DrawList )
ii = IsBusLabel( STRUCT->m_Text ); ii = IsBusLabel( STRUCT->m_Text );
if( ObjNet ) if( ObjNet )
{ {
ObjNet[NbrItem].m_Comp = STRUCT; ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Screen = screen;
ObjNet[NbrItem].m_Type = NET_LABEL; ObjNet[NbrItem].m_Type = NET_LABEL;
if( STRUCT->m_Layer == LAYER_GLOBLABEL ) if( STRUCT->m_Layer == LAYER_GLOBLABEL )
ObjNet[NbrItem].m_Type = NET_GLOBLABEL; ObjNet[NbrItem].m_Type = NET_GLOBLABEL;
if( STRUCT->m_Layer == LAYER_HIERLABEL )
ObjNet[NbrItem].m_Type = NET_HIERLABEL;
ObjNet[NbrItem].m_Label = &STRUCT->m_Text; ObjNet[NbrItem].m_Label = &STRUCT->m_Text;
ObjNet[NbrItem].m_SheetNumber = NumSheet;
ObjNet[NbrItem].m_Start = STRUCT->m_Pos; ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start; ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
@ -601,13 +606,12 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
if( ObjNet ) if( ObjNet )
{ {
ObjNet[NbrItem].m_Comp = DEntry; ObjNet[NbrItem].m_Comp = DEntry;
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_Type = NET_PIN; ObjNet[NbrItem].m_Type = NET_PIN;
ObjNet[NbrItem].m_Link = DrawLibItem; ObjNet[NbrItem].m_Link = DrawLibItem;
ObjNet[NbrItem].m_Screen = screen;
ObjNet[NbrItem].m_ElectricalType = Pin->m_PinType; ObjNet[NbrItem].m_ElectricalType = Pin->m_PinType;
ObjNet[NbrItem].m_PinNum = Pin->m_PinNum; ObjNet[NbrItem].m_PinNum = Pin->m_PinNum;
ObjNet[NbrItem].m_Label = &Pin->m_PinName; ObjNet[NbrItem].m_Label = &Pin->m_PinName;
ObjNet[NbrItem].m_SheetNumber = NumSheet;
ObjNet[NbrItem].m_Start.x = x2; ObjNet[NbrItem].m_Start.x = x2;
ObjNet[NbrItem].m_Start.y = y2; ObjNet[NbrItem].m_Start.y = y2;
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start; ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
@ -621,9 +625,8 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
if( ObjNet ) if( ObjNet )
{ {
ObjNet[NbrItem].m_Comp = NULL; ObjNet[NbrItem].m_Comp = NULL;
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_Type = NET_PINLABEL; ObjNet[NbrItem].m_Type = NET_PINLABEL;
ObjNet[NbrItem].m_Screen = screen;
ObjNet[NbrItem].m_SheetNumber = NumSheet;
ObjNet[NbrItem].m_Label = &Pin->m_PinName; ObjNet[NbrItem].m_Label = &Pin->m_PinName;
ObjNet[NbrItem].m_Start.x = x2; ObjNet[NbrItem].m_Start.x = x2;
ObjNet[NbrItem].m_Start.y = y2; ObjNet[NbrItem].m_Start.y = y2;
@ -645,8 +648,8 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawSheetStruct*) DrawList ) #define STRUCT ( (DrawSheetStruct*) DrawList )
NumInclude = STRUCT->m_SheetNumber; list = *sheetlist;
list.Push(STRUCT);
SheetLabel = STRUCT->m_Label; SheetLabel = STRUCT->m_Label;
for( ; SheetLabel != NULL; for( ; SheetLabel != NULL;
SheetLabel = (DrawSheetLabelStruct*) SheetLabel->Pnext ) SheetLabel = (DrawSheetLabelStruct*) SheetLabel->Pnext )
@ -655,13 +658,12 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
if( ObjNet ) if( ObjNet )
{ {
ObjNet[NbrItem].m_Comp = SheetLabel; ObjNet[NbrItem].m_Comp = SheetLabel;
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_Link = DrawList; ObjNet[NbrItem].m_Link = DrawList;
ObjNet[NbrItem].m_Type = NET_SHEETLABEL; ObjNet[NbrItem].m_Type = NET_SHEETLABEL;
ObjNet[NbrItem].m_Screen = screen;
ObjNet[NbrItem].m_ElectricalType = SheetLabel->m_Shape; ObjNet[NbrItem].m_ElectricalType = SheetLabel->m_Shape;
ObjNet[NbrItem].m_Label = &SheetLabel->m_Text; ObjNet[NbrItem].m_Label = &SheetLabel->m_Text;
ObjNet[NbrItem].m_SheetNumber = NumSheet; ObjNet[NbrItem].m_SheetListInclude = list;
ObjNet[NbrItem].m_NumInclude = NumInclude;
ObjNet[NbrItem].m_Start = SheetLabel->m_Pos; ObjNet[NbrItem].m_Start = SheetLabel->m_Pos;
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start; ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
@ -712,7 +714,7 @@ static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems )
{ {
if( (Label->m_Type == NET_SHEETBUSLABELMEMBER) if( (Label->m_Type == NET_SHEETBUSLABELMEMBER)
|| (Label->m_Type == NET_BUSLABELMEMBER) || (Label->m_Type == NET_BUSLABELMEMBER)
|| (Label->m_Type == NET_GLOBBUSLABELMEMBER) ) || (Label->m_Type == NET_HIERBUSLABELMEMBER) )
{ {
if( Label->GetNet() == 0 ) if( Label->GetNet() == 0 )
{ {
@ -724,7 +726,7 @@ static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems )
{ {
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER) if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
|| (LabelInTst->m_Type == NET_BUSLABELMEMBER) || (LabelInTst->m_Type == NET_BUSLABELMEMBER)
|| (LabelInTst->m_Type == NET_GLOBBUSLABELMEMBER) ) || (LabelInTst->m_Type == NET_HIERBUSLABELMEMBER) )
{ {
if( LabelInTst->m_BusNetCode != Label->m_BusNetCode ) if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
continue; continue;
@ -741,8 +743,6 @@ static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems )
} }
} }
} }
/**************************************************/ /**************************************************/
int IsBusLabel( const wxString& LabelDrawList ) int IsBusLabel( const wxString& LabelDrawList )
/**************************************************/ /**************************************************/
@ -830,7 +830,9 @@ static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )
int NumItem, BusMember; int NumItem, BusMember;
wxString BufLine; wxString BufLine;
if( BusLabel->m_Type == NET_GLOBLABEL ) if( BusLabel->m_Type == NET_HIERLABEL )
BusLabel->m_Type = NET_HIERBUSLABELMEMBER;
else if( BusLabel->m_Type == NET_GLOBLABEL )
BusLabel->m_Type = NET_GLOBBUSLABELMEMBER; BusLabel->m_Type = NET_GLOBBUSLABELMEMBER;
else if( BusLabel->m_Type == NET_SHEETLABEL ) else if( BusLabel->m_Type == NET_SHEETLABEL )
BusLabel->m_Type = NET_SHEETBUSLABELMEMBER; BusLabel->m_Type = NET_SHEETBUSLABELMEMBER;
@ -881,6 +883,9 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
if( OldNetCode == NewNetCode ) if( OldNetCode == NewNetCode )
return; return;
#ifdef DEBUG
//printf("replacing net %d with %d\n", OldNetCode,NewNetCode);
#endif
if( IsBus == 0 ) /* Propagation du NetCode */ if( IsBus == 0 ) /* Propagation du NetCode */
{ {
@ -922,7 +927,7 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
* *
* L'objet Ref doit avoir un NetCode valide. * L'objet Ref doit avoir un NetCode valide.
* *
* La liste des objets est supposee classe par NumSheet Croissants, * La liste des objets est supposee classe par SheetPath Croissants,
* et la recherche se fait a partir de l'element start, 1er element * et la recherche se fait a partir de l'element start, 1er element
* de la feuille de schema * de la feuille de schema
* ( il ne peut y avoir connexion physique entre elements de differentes sheets) * ( il ne peut y avoir connexion physique entre elements de differentes sheets)
@ -936,14 +941,16 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
netCode = Ref->GetNet(); netCode = Ref->GetNet();
for( i = start; i < g_NbrObjNet; i++ ) for( i = start; i < g_NbrObjNet; i++ )
{ {
if( netTable[i].m_SheetNumber > Ref->m_SheetNumber )
break; if( netTable[i].m_SheetList != Ref->m_SheetList ) //used to be > (why?)
continue;
switch( netTable[i].m_Type ) switch( netTable[i].m_Type )
{ {
case NET_SEGMENT: case NET_SEGMENT:
case NET_PIN: case NET_PIN:
case NET_LABEL: case NET_LABEL:
case NET_HIERLABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
case NET_SHEETLABEL: case NET_SHEETLABEL:
case NET_PINLABEL: case NET_PINLABEL:
@ -964,6 +971,7 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case NET_BUS: case NET_BUS:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
break; break;
} }
@ -975,14 +983,15 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
netCode = Ref->m_BusNetCode; netCode = Ref->m_BusNetCode;
for( i = start; i<g_NbrObjNet; i++ ) for( i = start; i<g_NbrObjNet; i++ )
{ {
if( netTable[i].m_SheetNumber > Ref->m_SheetNumber ) if( netTable[i].m_SheetList != Ref->m_SheetList )
break; continue;
switch( netTable[i].m_Type ) switch( netTable[i].m_Type )
{ {
case NET_SEGMENT: case NET_SEGMENT:
case NET_PIN: case NET_PIN:
case NET_LABEL: case NET_LABEL:
case NET_HIERLABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
case NET_SHEETLABEL: case NET_SHEETLABEL:
case NET_PINLABEL: case NET_PINLABEL:
@ -992,6 +1001,7 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case NET_BUS: case NET_BUS:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
case NET_JONCTION: case NET_JONCTION:
if( Ref->m_Start == netTable[i].m_Start if( Ref->m_Start == netTable[i].m_Start
@ -1031,8 +1041,8 @@ static void SegmentToPointConnect( ObjetNetListStruct* Jonction,
for( i = start; i < g_NbrObjNet; i++ ) for( i = start; i < g_NbrObjNet; i++ )
{ {
if( Segment[i].m_SheetNumber > Jonction->m_SheetNumber ) if( Segment[i].m_SheetList != Jonction->m_SheetList )
break; continue;
if( IsBus == 0 ) if( IsBus == 0 )
{ {
@ -1074,7 +1084,7 @@ static void SegmentToPointConnect( ObjetNetListStruct* Jonction,
/***************************************************************** /*****************************************************************
* Function which connects the groups of object which have the same label * Function which connects the groups of object which have the same label
*******************************************************************/ *******************************************************************/
static void LabelConnection( ObjetNetListStruct* LabelRef ) static void LabelConnect( ObjetNetListStruct* LabelRef )
{ {
if( LabelRef->GetNet() == 0 ) if( LabelRef->GetNet() == 0 )
return; return;
@ -1086,12 +1096,17 @@ static void LabelConnection( ObjetNetListStruct* LabelRef )
if( netTable[i].GetNet() == LabelRef->GetNet() ) if( netTable[i].GetNet() == LabelRef->GetNet() )
continue; continue;
if( netTable[i].m_SheetNumber != LabelRef->m_SheetNumber ) if( netTable[i].m_SheetList != LabelRef->m_SheetList )
{ {
if( netTable[i].m_Type != NET_PINLABEL ) if( netTable[i].m_Type != NET_PINLABEL
&& netTable[i].m_Type != NET_GLOBLABEL
&& netTable[i].m_Type != NET_GLOBBUSLABELMEMBER)
continue; continue;
} }
//regular labels are sheet-local;
//NET_HIERLABEL are used to connect sheets.
//there are no true global labels yet,
//though I've (tried) to implement them in this file.
if( netTable[i].m_Type == NET_LABEL if( netTable[i].m_Type == NET_LABEL
|| netTable[i].m_Type == NET_GLOBLABEL || netTable[i].m_Type == NET_GLOBLABEL
|| netTable[i].m_Type == NET_BUSLABELMEMBER || netTable[i].m_Type == NET_BUSLABELMEMBER
@ -1100,10 +1115,7 @@ static void LabelConnection( ObjetNetListStruct* LabelRef )
{ {
if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 ) if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )
continue; continue;
// Propagation du Netcode a tous les Objets de meme NetCode
/* Ici 2 labels identiques */
/* Propagation du Netcode a tous les Objets de meme NetCode */
if( netTable[i].GetNet() ) if( netTable[i].GetNet() )
PropageNetCode( netTable[i].GetNet(), LabelRef->GetNet(), 0 ); PropageNetCode( netTable[i].GetNet(), LabelRef->GetNet(), 0 );
else else
@ -1112,7 +1124,6 @@ static void LabelConnection( ObjetNetListStruct* LabelRef )
} }
} }
/****************************************************************************/ /****************************************************************************/
static int TriNetCode( const void* o1, const void* o2 ) static int TriNetCode( const void* o1, const void* o2 )
/****************************************************************************/ /****************************************************************************/
@ -1127,7 +1138,6 @@ static int TriNetCode( const void* o1, const void* o2 )
return Objet1->GetNet() - Objet2->GetNet(); return Objet1->GetNet() - Objet2->GetNet();
} }
/*****************************************************************************/ /*****************************************************************************/
static int TriBySheet( const void* o1, const void* o2 ) static int TriBySheet( const void* o1, const void* o2 )
/*****************************************************************************/ /*****************************************************************************/
@ -1138,11 +1148,9 @@ static int TriBySheet( const void* o1, const void* o2 )
{ {
ObjetNetListStruct* Objet1 = (ObjetNetListStruct*) o1; ObjetNetListStruct* Objet1 = (ObjetNetListStruct*) o1;
ObjetNetListStruct* Objet2 = (ObjetNetListStruct*) o2; ObjetNetListStruct* Objet2 = (ObjetNetListStruct*) o2;
return Objet1->m_SheetList.Cmp(Objet2->m_SheetList);
return Objet1->m_SheetNumber - Objet2->m_SheetNumber;
} }
/**********************************************************************/ /**********************************************************************/
static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems ) static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems )
/**********************************************************************/ /**********************************************************************/
@ -1202,12 +1210,14 @@ static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems )
{ {
case NET_SEGMENT: case NET_SEGMENT:
case NET_LABEL: case NET_LABEL:
case NET_HIERLABEL:
case NET_GLOBLABEL: case NET_GLOBLABEL:
case NET_SHEETLABEL: case NET_SHEETLABEL:
case NET_PINLABEL: case NET_PINLABEL:
case NET_BUS: case NET_BUS:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_GLOBBUSLABELMEMBER:
case NET_JONCTION: case NET_JONCTION:
break; break;

View File

@ -39,10 +39,12 @@ enum NetObjetType { /* Type des objets de Net */
NET_JONCTION, NET_JONCTION,
NET_LABEL, NET_LABEL,
NET_GLOBLABEL, NET_GLOBLABEL,
NET_HIERLABEL, //on a screen to indicate connection to a higher-level sheet
NET_SHEETLABEL, //on a drawscreen element to indicate connection to a lower-level sheet.
NET_BUSLABELMEMBER, NET_BUSLABELMEMBER,
NET_GLOBBUSLABELMEMBER, NET_GLOBBUSLABELMEMBER,
NET_HIERBUSLABELMEMBER,
NET_SHEETBUSLABELMEMBER, NET_SHEETBUSLABELMEMBER,
NET_SHEETLABEL,
NET_PINLABEL, NET_PINLABEL,
NET_PIN, NET_PIN,
NET_NOCONNECT NET_NOCONNECT
@ -64,9 +66,9 @@ public:
void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
* Pour les Pins: pointeur sur le composant */ * Pour les Pins: pointeur sur le composant */
int m_Flag; /* flag pour calculs internes */ int m_Flag; /* flag pour calculs internes */
SCH_SCREEN* m_Screen; /* Ecran d'appartenance */ DrawSheetList m_SheetList;
NetObjetType m_Type; NetObjetType m_Type;
int m_ElectricalType; /* Pour Pins et sheet labels: type electrique */ int m_ElectricalType;/* Pour Pins et sheet labels: type electrique */
private: private:
int m_NetCode; /* pour elements simples */ int m_NetCode; /* pour elements simples */
public: public:
@ -74,8 +76,7 @@ public:
int m_Member; /* pour les labels type BUSWIRE ( labels de bus eclate ) int m_Member; /* pour les labels type BUSWIRE ( labels de bus eclate )
* numero de membre */ * numero de membre */
IsConnectType m_FlagOfConnection; IsConnectType m_FlagOfConnection;
int m_SheetNumber; /* Sheet number for this item */ DrawSheetList m_SheetListInclude; /* sheet that the hierarchal label connects to.*/
int m_NumInclude; /* Numero de sous schema correpondant a la sheet (Gestion des GLabels et Pin Sheet)*/
long m_PinNum; /* numero de pin( 4 octets -> 4 codes ascii) */ long m_PinNum; /* numero de pin( 4 octets -> 4 codes ascii) */
const wxString* m_Label; /* Tous types Labels:pointeur sur la wxString definissant le label */ const wxString* m_Label; /* Tous types Labels:pointeur sur la wxString definissant le label */
wxPoint m_Start, m_End; wxPoint m_Start, m_End;
@ -89,8 +90,22 @@ public:
int GetNet() const { return m_NetCode; } int GetNet() const { return m_NetCode; }
}; };
/* Structures pour memo et liste des elements */
typedef struct ListLabel
{
int m_LabelType;
void * m_Label;
char m_SheetPath[32];
} ListLabel;
typedef struct ListComponent
{
EDA_SchComponentStruct * m_Comp;
char m_Ref[32];
//have to store it here since the object refrerences will be duplicated.
DrawSheetList m_SheetList; //composed of UIDs
} ListComponent;
/* Structure decrivant 1 composant de la schematique (pour annotation ) */ /* Structure decrivant 1 composant de la schematique (pour *annotation* ) */
struct CmpListStruct struct CmpListStruct
{ {
public: public:
@ -98,14 +113,15 @@ public:
int m_NbParts; /* Nombre de parts par boitier */ int m_NbParts; /* Nombre de parts par boitier */
bool m_PartsLocked; // For multi part components: True if the part cannot be changed bool m_PartsLocked; // For multi part components: True if the part cannot be changed
int m_Unit; /* Numero de part */ int m_Unit; /* Numero de part */
int m_Sheet; /* Numero de hierarchie */ DrawSheetList m_SheetList;
unsigned long m_TimeStamp; /* Signature temporelle */ unsigned long m_TimeStamp; /* unique identification number */
int m_IsNew; /* != 0 pour composants non annotes */ int m_IsNew; /* != 0 pour composants non annotes */
char m_TextValue[32]; /* Valeur */ char m_TextValue[32]; /* Valeur */
char m_TextRef[32]; /* Reference ( hors numero ) */ char m_TextRef[32]; /* Reference ( hors numero ) */
int m_NumRef; /* Numero de reference */ int m_NumRef; /* Numero de reference */
int m_Flag; /* flag pour calculs internes */ int m_Flag; /* flag pour calculs internes */
wxPoint m_Pos; /* position components */ wxPoint m_Pos; /* position components */
char m_Path[128]; // the 'path' of the object in the sheet hierarchy.
}; };

View File

@ -539,7 +539,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
g_NetFormat = CurrPage->m_IdNetType; g_NetFormat = CurrPage->m_IdNetType;
/* Calculate the netlist filename */ /* Calculate the netlist filename */
FullFileName = ScreenSch->m_FileName; FullFileName = g_RootSheet->m_s->m_FileName;
switch( g_NetFormat ) switch( g_NetFormat )
{ {
@ -558,7 +558,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
Mask = wxT( "*" ) + FileExt + wxT( "*" ); Mask = wxT( "*" ) + FileExt + wxT( "*" );
ChangeFileNameExt( FullFileName, FileExt ); ChangeFileNameExt( FullFileName, FileExt );
FullFileName = FullFileName.AfterLast('/');
FullFileName = EDA_FileSelector( _( "Netlist files:" ), FullFileName = EDA_FileSelector( _( "Netlist files:" ),
wxEmptyString, /* Defaut path */ wxEmptyString, /* Defaut path */
FullFileName, /* Defaut filename */ FullFileName, /* Defaut filename */
@ -581,7 +581,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
} }
/* Cleanup the entire hierarchy */ /* Cleanup the entire hierarchy */
EDA_ScreenList ScreenList( NULL ); EDA_ScreenList ScreenList;
for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{ {
bool ModifyWires; bool ModifyWires;
@ -649,7 +649,7 @@ void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event )
CommandLine = g_SimulatorCommandLine.AfterFirst( ' ' ); CommandLine = g_SimulatorCommandLine.AfterFirst( ' ' );
/* Calculate the netlist filename */ /* Calculate the netlist filename */
NetlistFullFileName = ScreenSch->m_FileName; NetlistFullFileName = g_RootSheet->m_s->m_FileName;
ChangeFileNameExt( NetlistFullFileName, wxT( ".cir" ) ); ChangeFileNameExt( NetlistFullFileName, wxT( ".cir" ) );
AddDelimiterString( NetlistFullFileName ); AddDelimiterString( NetlistFullFileName );
CommandLine += wxT( " " ) + NetlistFullFileName; CommandLine += wxT( " " ) + NetlistFullFileName;

View File

@ -22,11 +22,11 @@ static wxArrayString s_PowerNameList;
void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/**********************************************************************************/ /**********************************************************************************/
/* Traite les commandes declenchée par le bouton gauche de la souris, /* Traite les commandes declench<EFBFBD>e par le bouton gauche de la souris,
* quand un outil est deja selectionné * quand un outil est deja selectionn<EFBFBD>
*/ */
{ {
EDA_BaseStruct* DrawStruct = m_CurrentScreen->GetCurItem(); EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) ) if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{ {
@ -39,6 +39,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
@ -47,8 +48,8 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
case DRAW_PART_TEXT_STRUCT_TYPE: case DRAW_PART_TEXT_STRUCT_TYPE:
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
return; return;
case SCREEN_STRUCT_TYPE: case SCREEN_STRUCT_TYPE:
@ -91,14 +92,14 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
InstallNextScreen( (DrawSheetStruct*) DrawStruct ); InstallNextScreen( (DrawSheetStruct*) DrawStruct );
} }
else else
InstallPreviousScreen(); InstallPreviousSheet();
break; break;
case ID_NOCONN_BUTT: case ID_NOCONN_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
g_ItemToRepeat = CreateNewNoConnectStruct( DC ); g_ItemToRepeat = CreateNewNoConnectStruct( DC );
m_CurrentScreen->SetCurItem( g_ItemToRepeat ); GetScreen()->SetCurItem( g_ItemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
@ -106,14 +107,14 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
break; break;
case ID_JUNCTION_BUTT: case ID_JUNCTION_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
g_ItemToRepeat = CreateNewJunctionStruct( DC, m_CurrentScreen->m_Curseur, TRUE ); g_ItemToRepeat = CreateNewJunctionStruct( DC, GetScreen()->m_Curseur, TRUE );
m_CurrentScreen->SetCurItem( g_ItemToRepeat ); GetScreen()->SetCurItem( g_ItemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
@ -121,7 +122,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
break; break;
case ID_WIRETOBUS_ENTRY_BUTT: case ID_WIRETOBUS_ENTRY_BUTT:
@ -132,23 +133,23 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
CreateBusEntry( DC, CreateBusEntry( DC,
(m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT) ? (m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT) ?
WIRE_TO_BUS : BUS_TO_BUS ); WIRE_TO_BUS : BUS_TO_BUS );
m_CurrentScreen->SetCurItem( DrawStruct ); GetScreen()->SetCurItem( DrawStruct );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
break; break;
case ID_SCHEMATIC_DELETE_ITEM_BUTT: case ID_SCHEMATIC_DELETE_ITEM_BUTT:
LocateAndDeleteItem( this, DC ); LocateAndDeleteItem( this, DC );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
break; break;
case ID_WIRE_BUTT: case ID_WIRE_BUTT:
@ -169,7 +170,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_TEXT_COMMENT_BUTT: case ID_TEXT_COMMENT_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
m_CurrentScreen->SetCurItem( CreateNewText( DC, LAYER_NOTES ) ); GetScreen()->SetCurItem( CreateNewText( DC, LAYER_NOTES ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
@ -182,42 +183,59 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_LABEL_BUTT: case ID_LABEL_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
m_CurrentScreen->SetCurItem( CreateNewText( DC, LAYER_LOCLABEL ) ); GetScreen()->SetCurItem( CreateNewText( DC, LAYER_LOCLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
} }
break; break;
case ID_GLABEL_BUTT: case ID_GLABEL_BUTT:
case ID_HIERLABEL_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
m_CurrentScreen->SetCurItem( CreateNewText( DC, LAYER_GLOBLABEL ) ); if(m_ID_current_state == ID_GLABEL_BUTT)
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_GLOBLABEL ) );
if(m_ID_current_state == ID_HIERLABEL_BUTT)
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_HIERLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
}
break;
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_HIERLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
{
DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, DC );
} }
break; break;
case ID_SHEET_SYMBOL_BUTT: case ID_SHEET_SYMBOL_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
m_CurrentScreen->SetCurItem( CreateSheet( DC ) ); GetScreen()->SetCurItem( CreateSheet( DC ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else else
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
} }
break; break;
@ -233,24 +251,24 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
&& (DrawStruct->m_Flags == 0) ) && (DrawStruct->m_Flags == 0) )
{ {
if( m_ID_current_state == ID_IMPORT_GLABEL_BUTT ) if( m_ID_current_state == ID_IMPORT_GLABEL_BUTT )
m_CurrentScreen->SetCurItem( GetScreen()->SetCurItem(
Import_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) ); Import_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
else else
m_CurrentScreen->SetCurItem( GetScreen()->SetCurItem(
Create_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) ); Create_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
} }
else if( (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE) else if( (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE)
&& (DrawStruct->m_Flags != 0) ) && (DrawStruct->m_Flags != 0) )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
} }
break; break;
case ID_COMPONENT_BUTT: case ID_COMPONENT_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
m_CurrentScreen->SetCurItem( Load_Component( DC, wxEmptyString, GetScreen()->SetCurItem( Load_Component( DC, wxEmptyString,
s_CmpNameList, TRUE ) ); s_CmpNameList, TRUE ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
@ -258,14 +276,14 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
} }
break; break;
case ID_PLACE_POWER_BUTT: case ID_PLACE_POWER_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
m_CurrentScreen->SetCurItem( GetScreen()->SetCurItem(
Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) ); Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
@ -273,7 +291,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
} }
break; break;
@ -294,14 +312,14 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/***************************************************************************/ /***************************************************************************/
/* Appelé sur un double click: /* Appel<EFBFBD> sur un double click:
* pour un ément editable (textes, composant): * pour un <EFBFBD>l<EFBFBD>ment editable (textes, composant):
* appel de l'editeur correspondant. * appel de l'editeur correspondant.
* pour une connexion en cours: * pour une connexion en cours:
* termine la connexion * termine la connexion
*/ */
{ {
EDA_BaseStruct* DrawStruct = m_CurrentScreen->GetCurItem(); EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
switch( m_ID_current_state ) switch( m_ID_current_state )
@ -315,7 +333,7 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
break; break;
// Element localisé // Element localis<EFBFBD>
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
@ -330,6 +348,7 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
EditSchematicText( (DrawTextStruct*) DrawStruct, DC ); EditSchematicText( (DrawTextStruct*) DrawStruct, DC );
break; break;

View File

@ -56,6 +56,7 @@ static void AddMenusForPinSheet( wxMenu* PopMenu, DrawSheetLabelStruct* PinSheet
static void AddMenusForText( wxMenu* PopMenu, DrawTextStruct* Text ); static void AddMenusForText( wxMenu* PopMenu, DrawTextStruct* Text );
static void AddMenusForLabel( wxMenu* PopMenu, DrawLabelStruct* Label ); static void AddMenusForLabel( wxMenu* PopMenu, DrawLabelStruct* Label );
static void AddMenusForGLabel( wxMenu* PopMenu, DrawGlobalLabelStruct* GLabel ); static void AddMenusForGLabel( wxMenu* PopMenu, DrawGlobalLabelStruct* GLabel );
static void AddMenusForHLabel( wxMenu* PopMenu, DrawHierLabelStruct* GLabel );
static void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component ); static void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component );
static void AddMenusForComponentField( wxMenu* PopMenu, PartTextStruct* Field ); static void AddMenusForComponentField( wxMenu* PopMenu, PartTextStruct* Field );
static void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction, static void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
@ -82,13 +83,13 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu ) wxMenu* PopMenu )
/*****************************************************************/ /*****************************************************************/
/* Prepare le menu PullUp affiché par un click sur le bouton droit /* Prepare le menu PullUp affich<EFBFBD> par un click sur le bouton droit
* de la souris. * de la souris.
* Ce menu est ensuite complété par la liste des commandes de ZOOM * Ce menu est ensuite compl<EFBFBD>t<EFBFBD> par la liste des commandes de ZOOM
*/ */
{ {
EDA_BaseStruct* DrawStruct = m_CurrentScreen->GetCurItem(); EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
@ -108,7 +109,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
{ {
DrawSheetLabelStruct* slabel; DrawSheetLabelStruct* slabel;
slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct, slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct,
m_CurrentScreen->m_Curseur ); GetScreen()->m_Curseur );
if( slabel ) if( slabel )
DrawStruct = slabel; DrawStruct = slabel;
} }
@ -138,7 +139,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
if( DrawStruct == NULL ) if( DrawStruct == NULL )
{ {
if( m_CurrentScreen != ScreenSch ) if( GetSheet()->Last() != g_RootSheet )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ), leave_sheet_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ), leave_sheet_xpm );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
@ -146,7 +147,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
return true; return true;
} }
m_CurrentScreen->SetCurItem( DrawStruct ); GetScreen()->SetCurItem( DrawStruct );
int flags = DrawStruct->m_Flags; int flags = DrawStruct->m_Flags;
bool is_new = (flags & IS_NEW) ? TRUE : FALSE; bool is_new = (flags & IS_NEW) ? TRUE : FALSE;
@ -191,6 +192,10 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
AddMenusForGLabel( PopMenu, (DrawGlobalLabelStruct*) DrawStruct ); AddMenusForGLabel( PopMenu, (DrawGlobalLabelStruct*) DrawStruct );
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
AddMenusForHLabel( PopMenu, (DrawHierLabelStruct*) DrawStruct );
break;
case DRAW_PART_TEXT_STRUCT_TYPE: case DRAW_PART_TEXT_STRUCT_TYPE:
{ {
AddMenusForComponentField( PopMenu, (PartTextStruct*) DrawStruct ); AddMenusForComponentField( PopMenu, (PartTextStruct*) DrawStruct );
@ -198,7 +203,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
break; break;
// Many fields are inside a component. If this is the case, add the component menu // Many fields are inside a component. If this is the case, add the component menu
EDA_SchComponentStruct* Component = LocateSmallestComponent( GetScreen() ); EDA_SchComponentStruct* Component = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( Component ) if( Component )
{ {
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
@ -378,6 +383,28 @@ void AddMenusForGLabel( wxMenu* PopMenu, DrawGlobalLabelStruct* GLabel )
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type,
ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm ); ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm );
} }
/*******************************************************************/
void AddMenusForHLabel( wxMenu* PopMenu, DrawHierLabelStruct* HLabel )
/*******************************************************************/
/* Add menu commands for a hierarchal Label
*/
{
wxMenu* menu_change_type = new wxMenu;
if( !HLabel->m_Flags )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, _( "Move Hlabel" ), move_text_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, _( "Rotate HLabel (R)" ), rotate_glabel_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, _( "Edit HLabel" ), edit_text_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Hlabel" ), delete_text_xpm );
// add menu change type text (to label, glabel, text):
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
_( "Change to Label" ), glabel2label_xpm );
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
_( "Change to Text" ), glabel2text_xpm );
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type,
ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm );
}
/*****************************************************************/ /*****************************************************************/
@ -442,14 +469,14 @@ void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
if( !is_new ) if( !is_new )
{ {
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen()->EEDrawList, if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(),
WIREITEM | BUSITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) ) WIREITEM | BUSITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );
} }
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "delete junction" ), delete_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "delete junction" ), delete_xpm );
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen()->EEDrawList, if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(),
WIREITEM | BUSITEM ) ) WIREITEM | BUSITEM ) )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete node" ), delete_node_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete node" ), delete_node_xpm );
@ -482,7 +509,7 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _(
"Delete connection" ), delete_connection_xpm ); "Delete connection" ), delete_connection_xpm );
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen()->EEDrawList, if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(),
WIREITEM | BUSITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) ) WIREITEM | BUSITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );

View File

@ -54,7 +54,7 @@ static int LastPinType = PIN_INPUT,
/*************************************************************************/ /*************************************************************************/
void WinEDA_PinPropertiesFrame::PinPropertiesAccept(wxCommandEvent& event) void WinEDA_PinPropertiesFrame::PinPropertiesAccept(wxCommandEvent& event)
/*************************************************************************/ /*************************************************************************/
/* Met a jour les differents parametres pour le composant en cours d'édition /* Met a jour les differents parametres pour le composant en cours d'<EFBFBD>dition
*/ */
{ {
wxString msg; wxString msg;
@ -282,7 +282,7 @@ wxPoint startPos;
startPos.x = OldPos.x; startPos.x = OldPos.x;
startPos.y = -OldPos.y; startPos.y = -OldPos.y;
DrawPanel->CursorOff(DC); DrawPanel->CursorOff(DC);
m_CurrentScreen->m_Curseur = startPos; GetScreen()->m_Curseur = startPos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
CurrentPin->Display_Infos_DrawEntry(this); CurrentPin->Display_Infos_DrawEntry(this);
@ -785,7 +785,7 @@ bool selected = (MasterPin->m_Selected & IS_SELECTED) != 0;
/************************************************************************/ /************************************************************************/
void WinEDA_LibeditFrame::RepeatPinItem(wxDC * DC, LibDrawPin * SourcePin) void WinEDA_LibeditFrame::RepeatPinItem(wxDC * DC, LibDrawPin * SourcePin)
/************************************************************************/ /************************************************************************/
/* Creation d'une nouvelle pin par copie de la précédente ( fct REPEAT) */ /* Creation d'une nouvelle pin par copie de la pr<EFBFBD>c<EFBFBD>dente ( fct REPEAT) */
{ {
LibDrawPin * Pin; LibDrawPin * Pin;
wxString msg; wxString msg;

View File

@ -379,7 +379,7 @@ int orient, color = -1;
} }
SetCurrentLineWidth(-1); SetCurrentLineWidth(-1);
//not sure what to do here in terms of plotting components that may have multiple REFERENCE entries.
if( !IsMulti || (FieldNumber != REFERENCE) ) if( !IsMulti || (FieldNumber != REFERENCE) )
{ {
PlotGraphicText( g_PlotFormat, wxPoint(px, py), color, Field->m_Text, PlotGraphicText( g_PlotFormat, wxPoint(px, py), color, Field->m_Text,
@ -520,6 +520,7 @@ int HalfSize;
switch ( Struct->Type() ) switch ( Struct->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
Text = ((DrawTextStruct*)Struct)->m_Text; Text = ((DrawTextStruct*)Struct)->m_Text;
@ -529,8 +530,9 @@ int HalfSize;
pX = ((DrawTextStruct*)Struct)->m_Pos.x; pX = ((DrawTextStruct*)Struct)->m_Pos.x;
pY = ((DrawTextStruct*)Struct)->m_Pos.y; pY = ((DrawTextStruct*)Struct)->m_Pos.y;
offset = TXTMARGE; offset = TXTMARGE;
if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
offset += Size.x; // We must also draw the Glabel graphic symbol Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
offset += Size.x; // We must draw the Glabel graphic symbol
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
color = ReturnLayerColor(((DrawTextStruct*)Struct)->m_Layer); color = ReturnLayerColor(((DrawTextStruct*)Struct)->m_Layer);
break; break;
@ -545,7 +547,8 @@ int HalfSize;
switch(Orient) switch(Orient)
{ {
case 0: /* Orientation horiz normale */ case 0: /* Orientation horiz normale */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
PlotGraphicText(g_PlotFormat, wxPoint(pX - offset, pY), PlotGraphicText(g_PlotFormat, wxPoint(pX - offset, pY),
color, Text, TEXT_ORIENT_HORIZ, Size, color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER); GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER);
@ -556,7 +559,8 @@ int HalfSize;
break; break;
case 1: /* Orientation vert UP */ case 1: /* Orientation vert UP */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
PlotGraphicText(g_PlotFormat, wxPoint(pX, pY + offset), PlotGraphicText(g_PlotFormat, wxPoint(pX, pY + offset),
color, Text, TEXT_ORIENT_VERT, Size, color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP);
@ -567,7 +571,8 @@ int HalfSize;
break; break;
case 2: /* Horiz Orientation - Right justified */ case 2: /* Horiz Orientation - Right justified */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY), PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY),
color, Text, TEXT_ORIENT_HORIZ, Size, color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
@ -578,7 +583,8 @@ int HalfSize;
break; break;
case 3: /* Orientation vert BOTTOM */ case 3: /* Orientation vert BOTTOM */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
PlotGraphicText(g_PlotFormat, wxPoint(pX, pY - offset), PlotGraphicText(g_PlotFormat, wxPoint(pX, pY - offset),
color, Text, TEXT_ORIENT_VERT, Size, color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);
@ -590,7 +596,8 @@ int HalfSize;
} }
/* Trace du symbole associe au label global */ /* Trace du symbole associe au label global */
if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
Struct->Type() == DRAW_HIER_LABEL_STRUCT_TYPE )
{ {
int jj, imax; int jj, imax;
HalfSize = Size.x / 2; HalfSize = Size.x / 2;

View File

@ -477,9 +477,9 @@ void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN * screen,
{ {
Ki_PageDescr * PlotSheet; Ki_PageDescr * PlotSheet;
if( screen == NULL ) screen = ActiveScreen; if( screen == NULL ) screen = m_Parent->GetScreen();
PlotSheet = screen->m_CurrentSheet; PlotSheet = screen->m_CurrentSheetDesc;
SheetSize = PlotSheet->m_Size; SheetSize = PlotSheet->m_Size;
SheetOffset = PlotSheet->m_Offset; SheetOffset = PlotSheet->m_Offset;
@ -499,10 +499,10 @@ int margin;
g_PlotFormat = PLOT_FORMAT_HPGL; g_PlotFormat = PLOT_FORMAT_HPGL;
/* Build the screen list */ /* Build the screen list */
EDA_ScreenList ScreenList(NULL); EDA_ScreenList ScreenList;
if ( Select_PlotAll == TRUE ) screen = ScreenList.GetFirst(); if ( Select_PlotAll == TRUE ) screen = ScreenList.GetFirst();
else screen = ActiveScreen; else screen = m_Parent->GetScreen();
for ( ; screen != NULL; screen = ScreenList.GetNext() ) for ( ; screen != NULL; screen = ScreenList.GetNext() )
{ {
ReturnSheetDims(screen, SheetSize, SheetOffset); ReturnSheetDims(screen, SheetSize, SheetOffset);
@ -511,7 +511,7 @@ int margin;
g_PlotScaleY = Scale_Y * SCALE_HPGL ; g_PlotScaleY = Scale_Y * SCALE_HPGL ;
margin = 400; // Margin in mils margin = 400; // Margin in mils
PlotSheet = screen->m_CurrentSheet; PlotSheet = screen->m_CurrentSheetDesc;
g_PlotScaleX = g_PlotScaleX * (SheetSize.x - 2 * margin)/ PlotSheet->m_Size.x; g_PlotScaleX = g_PlotScaleX * (SheetSize.x - 2 * margin)/ PlotSheet->m_Size.x;
g_PlotScaleY = g_PlotScaleY * (SheetSize.y - 2 * margin) / PlotSheet->m_Size.y; g_PlotScaleY = g_PlotScaleY * (SheetSize.y - 2 * margin) / PlotSheet->m_Size.y;
@ -636,6 +636,7 @@ wxString msg;
case DRAW_TEXT_STRUCT_TYPE : case DRAW_TEXT_STRUCT_TYPE :
case DRAW_LABEL_STRUCT_TYPE : case DRAW_LABEL_STRUCT_TYPE :
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
case DRAW_HIER_LABEL_STRUCT_TYPE :
PlotTextStruct(DrawList); PlotTextStruct(DrawList);
break; break;

View File

@ -328,13 +328,13 @@ wxPoint plot_offset;
g_PlotFormat = PLOT_FORMAT_POST; g_PlotFormat = PLOT_FORMAT_POST;
/* Build the screen list */ /* Build the screen list */
EDA_ScreenList ScreenList(NULL); EDA_ScreenList ScreenList;
if ( AllPages == TRUE ) screen = ScreenList.GetFirst(); if ( AllPages == TRUE ) screen = ScreenList.GetFirst();
else screen = ActiveScreen; else screen = ActiveScreen;
for ( ; screen != NULL; screen = ScreenList.GetNext() ) for ( ; screen != NULL; screen = ScreenList.GetNext() )
{ {
PlotSheet = screen->m_CurrentSheet; PlotSheet = screen->m_CurrentSheetDesc;
RealSheet = &g_Sheet_A4; RealSheet = &g_Sheet_A4;
if ( pagesize == PAGE_SIZE_AUTO ) RealSheet = PlotSheet; if ( pagesize == PAGE_SIZE_AUTO ) RealSheet = PlotSheet;
else if ( pagesize == PAGE_SIZE_A ) RealSheet = &g_Sheet_A; else if ( pagesize == PAGE_SIZE_A ) RealSheet = &g_Sheet_A;
@ -472,6 +472,7 @@ wxPoint StartPos, EndPos;
case DRAW_TEXT_STRUCT_TYPE : case DRAW_TEXT_STRUCT_TYPE :
case DRAW_LABEL_STRUCT_TYPE : case DRAW_LABEL_STRUCT_TYPE :
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
case DRAW_HIER_LABEL_STRUCT_TYPE :
PlotTextStruct(DrawList); PlotTextStruct(DrawList);
break; break;

View File

@ -239,7 +239,7 @@ class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct
public: public:
int m_Layer; int m_Layer;
int m_Shape; int m_Shape;
bool m_IsDangling; // TRUE si non connecté bool m_IsDangling; // TRUE si non connect<EFBFBD>
public: public:
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString, DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
@ -280,8 +280,8 @@ public:
class DrawGlobalLabelStruct : public DrawTextStruct class DrawGlobalLabelStruct : public DrawTextStruct
{ {
public: public:
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), DrawGlobalLabelStruct(const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString ); const wxString& text = wxEmptyString);
~DrawGlobalLabelStruct() { } ~DrawGlobalLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 ); int Color = -1 );
@ -291,7 +291,20 @@ public:
return wxT( "DrawGlobalLabel" ); return wxT( "DrawGlobalLabel" );
} }
}; };
class DrawHierLabelStruct : public DrawTextStruct
{
public:
DrawHierLabelStruct(const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString);
~DrawHierLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawHierLabel" );
}
};
#define MAX_LAYERS 44 #define MAX_LAYERS 44
class LayerStruct class LayerStruct

View File

@ -1,4 +1,4 @@
/*****************************************/ //*****************************************/
/* prototypage des fonctions de EESchema */ /* prototypage des fonctions de EESchema */
/*****************************************/ /*****************************************/
void FreeLibraryEntry(LibCmpEntry * Entry); void FreeLibraryEntry(LibCmpEntry * Entry);
@ -10,11 +10,9 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
const wxString& ReturnDefaultFieldName( int aFieldNdx ); const wxString& ReturnDefaultFieldName( int aFieldNdx );
/***************/ /***************/
/* FILE_IO.CPP */ /* FILE_IO.CPP */
/***************/ /***************/
void SaveProject(WinEDA_SchematicFrame * frame);
/****************/ /****************/
@ -125,9 +123,9 @@ EDA_SchComponentStruct * LocateSmallestComponent( SCH_SCREEN * Screen );
/* Recherche du plus petit (en surface) composant pointe par la souris */ /* Recherche du plus petit (en surface) composant pointe par la souris */
EDA_BaseStruct * PickStruct(EDA_Rect & block, EDA_BaseStruct * PickStruct(EDA_Rect & block,
EDA_BaseStruct *DrawList, int SearchMask ); BASE_SCREEN* screen, int SearchMask );
EDA_BaseStruct * PickStruct(const wxPoint & refpos, EDA_BaseStruct * PickStruct(const wxPoint & refpos,
EDA_BaseStruct *DrawList, int SearchMask ); BASE_SCREEN* screen, int SearchMask);
/* 2 functions EDA_BaseStruct * PickStruct: /* 2 functions EDA_BaseStruct * PickStruct:
Search in block, or Serach at location pos Search in block, or Serach at location pos
@ -189,6 +187,7 @@ int distance(int dx, int dy, int spot_cX, int spot_cY, int seuil);
segment vertical segment vertical
segment quelconque */ segment quelconque */
/***************/ /***************/
/* EEREDRAW.CPP */ /* EEREDRAW.CPP */
/***************/ /***************/
@ -303,7 +302,7 @@ void ReAnnotatePowerSymbolsOnly();
void InstallAnnotateFrame(WinEDA_SchematicFrame * parent, wxPoint &pos); void InstallAnnotateFrame(WinEDA_SchematicFrame * parent, wxPoint &pos);
int CheckAnnotate(WinEDA_SchematicFrame * frame, bool OneSheetOnly); int CheckAnnotate(WinEDA_SchematicFrame * frame, bool OneSheetOnly);
/* Retourne le nombre de composants non annotes ou erronés /* Retourne le nombre de composants non annotes ou erron<EFBFBD>s
Si OneSheetOnly : recherche sur le schema courant Si OneSheetOnly : recherche sur le schema courant
else: recherche sur toute la hierarchie */ else: recherche sur toute la hierarchie */
@ -328,7 +327,6 @@ void PlotTextStruct(EDA_BaseStruct *Struct);
/* DELSHEET.CPP */ /* DELSHEET.CPP */
/***************/ /***************/
void DeleteSubHierarchy(DrawSheetStruct * Sheet, bool confirm_deletion); void DeleteSubHierarchy(DrawSheetStruct * Sheet, bool confirm_deletion);
void ClearDrawList(EDA_BaseStruct *DrawList, bool confirm_deletion); /* free the draw list DrawList and the subhierarchies */
bool ClearProjectDrawList(SCH_SCREEN * FirstWindow, bool confirm_deletion); bool ClearProjectDrawList(SCH_SCREEN * FirstWindow, bool confirm_deletion);
/* free the draw list screen->EEDrawList and the subhierarchies /* free the draw list screen->EEDrawList and the subhierarchies
clear the screen datas (filenames ..) clear the screen datas (filenames ..)
@ -411,7 +409,8 @@ bool LibArchive(wxWindow * frame, const wxString & ArchFullFileName);
/* GENLISTE.CPP */ /* GENLISTE.CPP */
/***************/ /***************/
void InstallToolsFrame(WinEDA_DrawFrame *parent, wxPoint &pos); void InstallToolsFrame(WinEDA_DrawFrame *parent, wxPoint &pos);
int GenListeCmp( EDA_BaseStruct ** List ); struct ListComponent;
int GenListeCmp( ListComponent * List );
/**************/ /**************/
/* CLEANUP.CPP */ /* CLEANUP.CPP */

View File

@ -31,18 +31,18 @@ static void SaveLayers(FILE *f);
*****************************************************************************/ *****************************************************************************/
bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave) bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
{ {
wxString msg; wxString msg;
wxString Name, BakName; wxString Name, BakName;
const wxChar **LibNames; const wxChar **LibNames;
const char * layer, *width; const char * layer, *width;
int ii, shape; int ii, shape;
bool Failed = FALSE; bool Failed = FALSE;
EDA_BaseStruct *Phead; EDA_BaseStruct *Phead;
Ki_PageDescr * PlotSheet; Ki_PageDescr * PlotSheet;
FILE *f; FILE *f;
wxString dirbuf; wxString dirbuf;
if ( screen == NULL ) screen = (SCH_SCREEN*) ActiveScreen; if ( screen == NULL ) screen = (SCH_SCREEN*)GetScreen();
/* If no name exists in the window yet - save as new. */ /* If no name exists in the window yet - save as new. */
if( screen->m_FileName.IsEmpty() ) FileSave = FILE_SAVE_NEW; if( screen->m_FileName.IsEmpty() ) FileSave = FILE_SAVE_NEW;
@ -58,8 +58,7 @@ wxString dirbuf;
{ {
ChangeFileNameExt(BakName, wxT(".bak")); ChangeFileNameExt(BakName, wxT(".bak"));
wxRemoveFile(BakName); /* delete Old .bak file */ wxRemoveFile(BakName); /* delete Old .bak file */
if( ! wxRenameFile(Name, BakName) ) if( ! wxRenameFile(Name, BakName) ){
{
DisplayError(this, wxT("Warning: unable to rename old file"), 10); DisplayError(this, wxT("Warning: unable to rename old file"), 10);
} }
} }
@ -122,11 +121,11 @@ wxString dirbuf;
SaveLayers(f); SaveLayers(f);
/* Sauvegarde des dimensions du schema, des textes du cartouche.. */ /* Sauvegarde des dimensions du schema, des textes du cartouche.. */
PlotSheet = screen->m_CurrentSheet; PlotSheet = screen->m_CurrentSheetDesc;
fprintf(f,"$Descr %s %d %d\n",CONV_TO_UTF8(PlotSheet->m_Name), fprintf(f,"$Descr %s %d %d\n",CONV_TO_UTF8(PlotSheet->m_Name),
PlotSheet->m_Size.x, PlotSheet->m_Size.y); PlotSheet->m_Size.x, PlotSheet->m_Size.y);
fprintf(f,"Sheet %d %d\n",screen->m_SheetNumber, screen->m_NumberOfSheet); fprintf(f,"Sheet %d %d\n",screen->m_ScreenNumber, screen->m_NumberOfScreen);
fprintf(f,"Title \"%s\"\n",CONV_TO_UTF8(screen->m_Title)); fprintf(f,"Title \"%s\"\n",CONV_TO_UTF8(screen->m_Title));
fprintf(f,"Date \"%s\"\n",CONV_TO_UTF8(screen->m_Date)); fprintf(f,"Date \"%s\"\n",CONV_TO_UTF8(screen->m_Date));
fprintf(f,"Rev \"%s\"\n",CONV_TO_UTF8(screen->m_Revision)); fprintf(f,"Rev \"%s\"\n",CONV_TO_UTF8(screen->m_Revision));
@ -258,7 +257,6 @@ wxString dirbuf;
Failed = TRUE; Failed = TRUE;
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: /* Its a Global label item. */ case DRAW_GLOBAL_LABEL_STRUCT_TYPE: /* Its a Global label item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawGlobalLabelStruct *) Phead) #define STRUCT ((DrawGlobalLabelStruct *) Phead)
@ -271,6 +269,18 @@ wxString dirbuf;
Failed = TRUE; Failed = TRUE;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE: /* Its a Global label item. */
#undef STRUCT
#define STRUCT ((DrawHierLabelStruct *) Phead)
shape = STRUCT->m_Shape;
if (fprintf(f, "Text HLabel %-4d %-4d %-4d %-4d %s\n%s\n",
STRUCT->m_Pos.x, STRUCT->m_Pos.y,
STRUCT->m_Orient, STRUCT->m_Size.x,
SheetLabelType[shape],
CONV_TO_UTF8(STRUCT->m_Text)) == EOF)
Failed = TRUE;
break;
case DRAW_MARKER_STRUCT_TYPE: /* Its a marker item. */ case DRAW_MARKER_STRUCT_TYPE: /* Its a marker item. */
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawMarkerStruct *) Phead) #define STRUCT ((DrawMarkerStruct *) Phead)
@ -322,18 +332,27 @@ int ii, Failed = FALSE;
char Name1[256], Name2[256]; char Name1[256], Name2[256];
int hjustify, vjustify; int hjustify, vjustify;
strcpy(Name1, CONV_TO_UTF8(LibItemStruct->m_Field[REFERENCE].m_Text)); //this is redundant with the AR entries below, but it makes the
for (ii = 0; ii < (int)strlen(Name1); ii++) //files backwards-compatible.
if(LibItemStruct->m_References.GetCount() > 0)
strncpy(Name1, CONV_TO_UTF8(LibItemStruct->m_References[0]), sizeof(Name1));
else{
if(LibItemStruct->m_Field[REFERENCE].m_Text.IsEmpty())
strncpy(Name1, CONV_TO_UTF8(LibItemStruct->m_PrefixString),sizeof(Name1));
else
strncpy(Name1, CONV_TO_UTF8(LibItemStruct->m_Field[REFERENCE].m_Text),sizeof(Name1));
}
for (ii = 0; ii < (int)strlen(Name1); ii++){
if (Name1[ii] <= ' ') Name1[ii] = '~'; if (Name1[ii] <= ' ') Name1[ii] = '~';
}
if ( ! LibItemStruct->m_ChipName.IsEmpty() ) if ( ! LibItemStruct->m_ChipName.IsEmpty() )
{ {
strcpy(Name2, CONV_TO_UTF8(LibItemStruct->m_ChipName)); strncpy(Name2, CONV_TO_UTF8(LibItemStruct->m_ChipName),sizeof(Name2));
for (ii = 0; ii < (int)strlen(Name2); ii++) for (ii = 0; ii < (int)strlen(Name2); ii++)
if (Name2[ii] <= ' ') Name2[ii] = '~'; if (Name2[ii] <= ' ') Name2[ii] = '~';
} }
else strcpy(Name2, NULL_STRING); else strncpy(Name2, NULL_STRING,sizeof(Name2));
fprintf(f, "$Comp\n"); fprintf(f, "$Comp\n");
@ -358,7 +377,25 @@ int hjustify, vjustify;
{ {
Failed = TRUE; return(Failed); Failed = TRUE; return(Failed);
} }
unsigned int i;
for(i=0; i< LibItemStruct->m_References.GetCount(); i++){
/*format:
AR Path="/140/2" Ref="C99"
where 140 is the uid of the contianing sheet
and 2 is the timestamp of this component.
(timestamps are actually 8 hex chars)
Ref is the conventional component reference for this 'path'
*/
/*printf("AR Path=\"%s\" Ref=\"%s\" \n",
CONV_TO_UTF8( LibItemStruct->m_Paths[i]),
CONV_TO_UTF8( LibItemStruct->m_References[i] ) ); */
if( fprintf(f, "AR Path=\"%s\" Ref=\"%s\" \n",
CONV_TO_UTF8( LibItemStruct->m_Paths[i]),
CONV_TO_UTF8( LibItemStruct->m_References[i] ) ) == EOF )
{
Failed = TRUE; break;
}
}
for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
{ {
PartTextStruct * field = & LibItemStruct->m_Field[ii]; PartTextStruct * field = & LibItemStruct->m_Field[ii];
@ -437,8 +474,12 @@ DrawSheetLabelStruct * SheetLabel;
if (fprintf(f, "S %-4d %-4d %-4d %-4d\n", if (fprintf(f, "S %-4d %-4d %-4d %-4d\n",
SheetStruct->m_Pos.x,SheetStruct->m_Pos.y, SheetStruct->m_Pos.x,SheetStruct->m_Pos.y,
SheetStruct->m_Size.x,SheetStruct->m_Size.y) == EOF) SheetStruct->m_Size.x,SheetStruct->m_Size.y) == EOF){
{ Failed = TRUE; return(Failed);
}
//save the unique timestamp, like other shematic parts.
if( fprintf(f, "U %8.8lX\n", SheetStruct->m_TimeStamp) == EOF ){
Failed = TRUE; return(Failed); Failed = TRUE; return(Failed);
} }

View File

@ -114,7 +114,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; // Do nothing: break; // Do nothing:
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE ) if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE )
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = DrawPanel-> DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = DrawPanel->
m_PanelDefaultCursor ) ); m_PanelDefaultCursor ) );
@ -123,11 +123,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
/* ne devrait pas etre execute, sauf bug: */ /* ne devrait pas etre execute, sauf bug: */
if( m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE ) if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE )
{ {
m_CurrentScreen->BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
m_CurrentScreen->BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
m_CurrentScreen->BlockLocate.m_BlockDrawStruct = NULL; GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
} }
break; break;
@ -166,7 +166,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_LOAD_ONE_SHEET: case ID_LOAD_ONE_SHEET:
LoadOneSheet( GetScreen(), wxEmptyString ); //how is this different from above?
//LoadOneSheet( GetSheet(), wxEmptyString );
break; break;
case ID_LOAD_FILE_1: case ID_LOAD_FILE_1:
@ -202,9 +203,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_TO_PCB: case ID_TO_PCB:
{ {
wxString Line; wxString Line;
if( ScreenSch->m_FileName != wxEmptyString ) if( g_RootSheet->m_s->m_FileName != wxEmptyString )
{ {
Line = ScreenSch->m_FileName; Line = GetScreen()->m_FileName;
AddDelimiterString( Line ); AddDelimiterString( Line );
ChangeFileNameExt( Line, wxEmptyString ); ChangeFileNameExt( Line, wxEmptyString );
ExecuteFile( this, PCBNEW_EXE, Line ); ExecuteFile( this, PCBNEW_EXE, Line );
@ -217,9 +218,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_TO_CVPCB: case ID_TO_CVPCB:
{ {
wxString Line; wxString Line;
if( ScreenSch->m_FileName != wxEmptyString ) if( g_RootSheet->m_s->m_FileName != wxEmptyString )
{ {
Line = ScreenSch->m_FileName; Line = g_RootSheet->m_s->m_FileName;
AddDelimiterString( Line ); AddDelimiterString( Line );
ChangeFileNameExt( Line, wxEmptyString ); ChangeFileNameExt( Line, wxEmptyString );
ExecuteFile( this, CVPCB_EXE, Line ); ExecuteFile( this, CVPCB_EXE, Line );
@ -248,7 +249,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case wxID_CUT: case wxID_CUT:
if( m_CurrentScreen->BlockLocate.m_Command != BLOCK_MOVE ) if( GetScreen()->BlockLocate.m_Command != BLOCK_MOVE )
break; break;
HandleBlockEndByPopUp( BLOCK_DELETE, &dc ); HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
@ -256,7 +257,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case wxID_PASTE: case wxID_PASTE:
HandleBlockBegin( &dc, BLOCK_PASTE, m_CurrentScreen->m_Curseur ); HandleBlockBegin( &dc, BLOCK_PASTE, GetScreen()->m_Curseur );
break; break;
case ID_GET_ANNOTATE: case ID_GET_ANNOTATE:
@ -311,6 +312,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
SetToolID( id, wxCURSOR_PENCIL, _( "Add Global label" ) ); SetToolID( id, wxCURSOR_PENCIL, _( "Add Global label" ) );
break; break;
case ID_HIERLABEL_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Hierarchal label" ) );
break;
case ID_TEXT_COMMENT_BUTT: case ID_TEXT_COMMENT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) ); SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
break; break;
@ -346,13 +351,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ENTRY_SELECT_SLASH: case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
SetBusEntryShape( &dc, SetBusEntryShape( &dc,
(DrawBusEntryStruct*) m_CurrentScreen->GetCurItem(), '/' ); (DrawBusEntryStruct*) GetScreen()->GetCurItem(), '/' );
break; break;
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH: case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
SetBusEntryShape( &dc, SetBusEntryShape( &dc,
(DrawBusEntryStruct*) m_CurrentScreen->GetCurItem(), '\\' ); (DrawBusEntryStruct*) GetScreen()->GetCurItem(), '\\' );
break; break;
case ID_NO_SELECT_BUTT: case ID_NO_SELECT_BUTT:
@ -370,85 +375,83 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_EDIT_TEXT: case ID_POPUP_SCH_EDIT_TEXT:
EditSchematicText( EditSchematicText((DrawTextStruct*) GetScreen()->GetCurItem(), &dc );
(DrawTextStruct*) m_CurrentScreen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_ROTATE_TEXT: case ID_POPUP_SCH_ROTATE_TEXT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ChangeTextOrient( ChangeTextOrient((DrawTextStruct*) GetScreen()->GetCurItem(), &dc );
(DrawTextStruct*) m_CurrentScreen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (DrawTextStruct*) m_CurrentScreen->GetCurItem(), ConvertTextType( (DrawTextStruct*) GetScreen()->GetCurItem(),
&dc, DRAW_LABEL_STRUCT_TYPE ); &dc, DRAW_LABEL_STRUCT_TYPE );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (DrawTextStruct*) m_CurrentScreen->GetCurItem(), ConvertTextType( (DrawTextStruct*) GetScreen()->GetCurItem(),
&dc, DRAW_GLOBAL_LABEL_STRUCT_TYPE ); &dc, DRAW_GLOBAL_LABEL_STRUCT_TYPE );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (DrawTextStruct*) m_CurrentScreen->GetCurItem(), ConvertTextType( (DrawTextStruct*) GetScreen()->GetCurItem(),
&dc, DRAW_TEXT_STRUCT_TYPE ); &dc, DRAW_TEXT_STRUCT_TYPE );
break; break;
case ID_POPUP_SCH_SET_SHAPE_TEXT: case ID_POPUP_SCH_SET_SHAPE_TEXT:
// Non utilisé // Non utilis<EFBFBD>
break; break;
case ID_POPUP_SCH_ROTATE_FIELD: case ID_POPUP_SCH_ROTATE_FIELD:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
RotateCmpField( (PartTextStruct*) m_CurrentScreen->GetCurItem(), &dc ); RotateCmpField( (PartTextStruct*) GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_FIELD: case ID_POPUP_SCH_EDIT_FIELD:
EditCmpFieldText( (PartTextStruct*) m_CurrentScreen->GetCurItem(), &dc ); EditCmpFieldText( (PartTextStruct*) GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_DELETE_NODE: case ID_POPUP_SCH_DELETE_NODE:
case ID_POPUP_SCH_DELETE_CONNECTION: case ID_POPUP_SCH_DELETE_CONNECTION:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DeleteConnection( &dc, id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE ); DeleteConnection( &dc, id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE );
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc ); TestDanglingEnds( GetScreen()->EEDrawList, &dc );
break; break;
case ID_POPUP_SCH_BREAK_WIRE: case ID_POPUP_SCH_BREAK_WIRE:
{ {
DrawPickedStruct* ListForUndo; DrawPickedStruct* ListForUndo;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ListForUndo = BreakSegment( (SCH_SCREEN*) m_CurrentScreen, ListForUndo = BreakSegment( (SCH_SCREEN*) GetScreen(),
m_CurrentScreen->m_Curseur, TRUE ); GetScreen()->m_Curseur, TRUE );
if( ListForUndo ) if( ListForUndo )
SaveCopyInUndoList( ListForUndo, IS_NEW | IS_CHANGED ); SaveCopyInUndoList( ListForUndo, IS_NEW | IS_CHANGED );
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc ); TestDanglingEnds( GetScreen()->EEDrawList, &dc );
} }
break; break;
case ID_POPUP_SCH_DELETE_CMP: case ID_POPUP_SCH_DELETE_CMP:
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
case ID_POPUP_SCH_DELETE: case ID_POPUP_SCH_DELETE:
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
DeleteStruct( this->DrawPanel, &dc, m_CurrentScreen->GetCurItem() ); DeleteStruct( this->DrawPanel, &dc, GetScreen()->GetCurItem() );
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc ); TestDanglingEnds( GetScreen()->EEDrawList, &dc );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
break; break;
case ID_SCHEMATIC_DELETE_ITEM_BUTT: case ID_SCHEMATIC_DELETE_ITEM_BUTT:
@ -457,43 +460,43 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_END_SHEET: case ID_POPUP_SCH_END_SHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
m_CurrentScreen->GetCurItem()->Place( this, &dc ); GetScreen()->GetCurItem()->Place( this, &dc );
break; break;
case ID_POPUP_SCH_RESIZE_SHEET: case ID_POPUP_SCH_RESIZE_SHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ReSizeSheet( (DrawSheetStruct*) ReSizeSheet( (DrawSheetStruct*)
m_CurrentScreen->GetCurItem(), &dc ); GetScreen()->GetCurItem(), &dc );
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc ); TestDanglingEnds( GetScreen()->EEDrawList, &dc );
break; break;
case ID_POPUP_SCH_EDIT_SHEET: case ID_POPUP_SCH_EDIT_SHEET:
EditSheet( (DrawSheetStruct*) EditSheet( (DrawSheetStruct*)
m_CurrentScreen->GetCurItem(), &dc ); GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_CLEANUP_SHEET: case ID_POPUP_SCH_CLEANUP_SHEET:
( (DrawSheetStruct*) ( (DrawSheetStruct*)
m_CurrentScreen->GetCurItem() )->CleanupSheet( this, &dc ); GetScreen()->GetCurItem() )->CleanupSheet( this, &dc );
break; break;
case ID_POPUP_SCH_EDIT_PINSHEET: case ID_POPUP_SCH_EDIT_PINSHEET:
Edit_PinSheet( (DrawSheetLabelStruct*) Edit_PinSheet( (DrawSheetLabelStruct*)
m_CurrentScreen->GetCurItem(), &dc ); GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_MOVE_PINSHEET: case ID_POPUP_SCH_MOVE_PINSHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMove_PinSheet( (DrawSheetLabelStruct*) StartMove_PinSheet( (DrawSheetLabelStruct*)
m_CurrentScreen->GetCurItem(), &dc ); GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_DRAG_CMP_REQUEST: case ID_POPUP_SCH_DRAG_CMP_REQUEST:
case ID_POPUP_SCH_MOVE_CMP_REQUEST: case ID_POPUP_SCH_MOVE_CMP_REQUEST:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
case ID_POPUP_SCH_MOVE_ITEM_REQUEST: case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
@ -505,17 +508,17 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
} }
} }
else Process_Move_Item( m_CurrentScreen->GetCurItem(), &dc ); else Process_Move_Item( GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_CMP: case ID_POPUP_SCH_EDIT_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
InstallCmpeditFrame( this, pos, InstallCmpeditFrame( this, pos,
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem() ); (EDA_SchComponentStruct*) GetScreen()->GetCurItem() );
break; break;
case ID_POPUP_SCH_MIROR_X_CMP: case ID_POPUP_SCH_MIROR_X_CMP:
@ -525,9 +528,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ORIENT_NORMAL_CMP: case ID_POPUP_SCH_ORIENT_NORMAL_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
{ {
int option; int option;
@ -552,10 +555,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( m_CurrentScreen->GetCurItem()->m_Flags == 0 ) if( GetScreen()->GetCurItem()->m_Flags == 0 )
SaveCopyInUndoList( m_CurrentScreen->GetCurItem(), IS_CHANGED ); SaveCopyInUndoList( GetScreen()->GetCurItem(), IS_CHANGED );
CmpRotationMiroir( CmpRotationMiroir(
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), (EDA_SchComponentStruct*) GetScreen()->GetCurItem(),
&dc, option ); &dc, option );
break; break;
} }
@ -567,47 +570,47 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_EDIT_VALUE_CMP: case ID_POPUP_SCH_EDIT_VALUE_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
EditComponentValue( EditComponentValue(
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), &dc ); (EDA_SchComponentStruct*) GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_REF_CMP: case ID_POPUP_SCH_EDIT_REF_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
EditComponentReference( EditComponentReference(
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), &dc ); (EDA_SchComponentStruct*) GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP: case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
EditComponentFootprint( EditComponentFootprint(
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), &dc ); (EDA_SchComponentStruct*) GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_CONVERT_CMP: case ID_POPUP_SCH_EDIT_CONVERT_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertPart( ConvertPart(
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), (EDA_SchComponentStruct*) GetScreen()->GetCurItem(),
&dc ); &dc );
break; break;
@ -615,9 +618,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
{ {
EDA_SchComponentStruct* olditem, * newitem; EDA_SchComponentStruct* olditem, * newitem;
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
olditem = (EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(); olditem = (EDA_SchComponentStruct*) GetScreen()->GetCurItem();
if( olditem == NULL ) if( olditem == NULL )
break; break;
newitem = olditem->GenCopy(); newitem = olditem->GenCopy();
@ -658,13 +661,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_SELECT_UNIT26: case ID_POPUP_SCH_SELECT_UNIT26:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
SelPartUnit( SelPartUnit(
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), (EDA_SchComponentStruct*) GetScreen()->GetCurItem(),
id + 1 - ID_POPUP_SCH_SELECT_UNIT1, id + 1 - ID_POPUP_SCH_SELECT_UNIT1,
&dc ); &dc );
break; break;
@ -672,14 +675,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_DISPLAYDOC_CMP: case ID_POPUP_SCH_DISPLAYDOC_CMP:
// Ensure the struct is a component (could be a piece of a component, like Field, text..) // Ensure the struct is a component (could be a piece of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
{ {
EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry;
LibEntry = FindLibPart( ( (EDA_SchComponentStruct*) LibEntry = FindLibPart( ( (EDA_SchComponentStruct*)
m_CurrentScreen->GetCurItem() )->m_ChipName, GetScreen()->GetCurItem() )->m_ChipName,
wxEmptyString, FIND_ALIAS ); wxEmptyString, FIND_ALIAS );
if( LibEntry && LibEntry->m_DocFile != wxEmptyString ) if( LibEntry && LibEntry->m_DocFile != wxEmptyString )
GetAssociatedDocument( this, g_RealLibDirBuffer, LibEntry->m_DocFile ); GetAssociatedDocument( this, g_RealLibDirBuffer, LibEntry->m_DocFile );
@ -688,7 +691,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ENTER_SHEET: case ID_POPUP_SCH_ENTER_SHEET:
{ {
EDA_BaseStruct* DrawStruct = m_CurrentScreen->GetCurItem(); EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
{ {
InstallNextScreen( (DrawSheetStruct*) DrawStruct ); InstallNextScreen( (DrawSheetStruct*) DrawStruct );
@ -697,7 +700,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_LEAVE_SHEET: case ID_POPUP_SCH_LEAVE_SHEET:
InstallPreviousScreen(); InstallPreviousSheet();
break; break;
case ID_POPUP_CLOSE_CURRENT_TOOL: case ID_POPUP_CLOSE_CURRENT_TOOL:
@ -746,22 +749,22 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ADD_JUNCTION: case ID_POPUP_SCH_ADD_JUNCTION:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
m_CurrentScreen->SetCurItem( GetScreen()->SetCurItem(
CreateNewJunctionStruct( &dc, m_CurrentScreen->m_Curseur, TRUE ) ); CreateNewJunctionStruct( &dc, GetScreen()->m_Curseur, TRUE ) );
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc ); TestDanglingEnds( GetScreen()->EEDrawList, &dc );
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
break; break;
case ID_POPUP_SCH_ADD_LABEL: case ID_POPUP_SCH_ADD_LABEL:
case ID_POPUP_SCH_ADD_GLABEL: case ID_POPUP_SCH_ADD_GLABEL:
m_CurrentScreen->SetCurItem( CreateNewText( &dc, GetScreen()->SetCurItem( CreateNewText( &dc,
id == ID_POPUP_SCH_ADD_LABEL ? id == ID_POPUP_SCH_ADD_LABEL ?
LAYER_LOCLABEL : LAYER_GLOBLABEL ) ); LAYER_LOCLABEL : LAYER_GLOBLABEL ) );
if( m_CurrentScreen->GetCurItem() ) if( GetScreen()->GetCurItem() )
{ {
m_CurrentScreen->GetCurItem()->Place( this, &dc ); GetScreen()->GetCurItem()->Place( this, &dc );
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc ); TestDanglingEnds( GetScreen()->EEDrawList, &dc );
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
} }
break; break;
@ -812,6 +815,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( EDA_BaseStruct* DrawStruct,
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
StartMoveTexte( (DrawTextStruct*) DrawStruct, DC ); StartMoveTexte( (DrawTextStruct*) DrawStruct, DC );
break; break;

View File

@ -90,6 +90,7 @@ void SwapData( EDA_BaseStruct* Item )
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
@ -285,7 +286,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
GetScreen()->AddItemToUndoList( NewList ); GetScreen()->AddItemToUndoList( NewList );
/* Clear redo list, because after new save there is no redo to do */ /* Clear redo list, because after new save there is no redo to do */
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList ); ((SCH_SCREEN*)GetScreen())->ClearUndoORRedoList( GetScreen()->m_RedoList );
GetScreen()->m_RedoList = NULL; GetScreen()->m_RedoList = NULL;
} }
@ -361,7 +362,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
while( PickedList ) while( PickedList )
{ {
item = PickedList->m_Image; item = PickedList->m_Image;
GetScreen()->RemoveFromDrawList( item ); ((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( item );
item->m_Flags = IS_DELETED; item->m_Flags = IS_DELETED;
PickedList->m_PickedStruct = item; PickedList->m_PickedStruct = item;
PickedList->m_Flags = IS_DELETED; PickedList->m_Flags = IS_DELETED;
@ -371,7 +372,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
else else
{ {
FirstItem = List->m_Image; FirstItem = List->m_Image;
GetScreen()->RemoveFromDrawList( FirstItem ); ((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( FirstItem );
FirstItem->m_Flags = IS_DELETED; FirstItem->m_Flags = IS_DELETED;
List->m_Son = FirstItem; List->m_Son = FirstItem;
} }
@ -406,7 +407,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
case IS_WIRE_IMAGE: case IS_WIRE_IMAGE:
/* Exchange the current wires and the oild wires */ /* Exchange the current wires and the oild wires */
List->m_Son = GetScreen()->ExtractWires( FALSE ); List->m_Son = ((SCH_SCREEN*)GetScreen())->ExtractWires( FALSE );
while( FirstItem ) while( FirstItem )
{ {
EDA_BaseStruct* nextitem = FirstItem->Pnext; EDA_BaseStruct* nextitem = FirstItem->Pnext;
@ -436,7 +437,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
case IS_NEW: case IS_NEW:
item = PickedList->m_Image; item = PickedList->m_Image;
GetScreen()->RemoveFromDrawList( item ); ((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( item );
item->m_Flags = IS_DELETED; item->m_Flags = IS_DELETED;
PickedList->m_PickedStruct = item; PickedList->m_PickedStruct = item;
PickedList->m_Flags = IS_DELETED; PickedList->m_Flags = IS_DELETED;
@ -516,7 +517,7 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
FirstItem = List->m_Son; FirstItem = List->m_Son;
CmdType = List->m_Flags; CmdType = List->m_Flags;
delete List; SAFE_DELETE( List );
if( FirstItem == NULL ) if( FirstItem == NULL )
continue; continue;
@ -541,18 +542,22 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
{ {
if( (item->m_Flags & IS_NEW) == 0 ) if( (item->m_Flags & IS_NEW) == 0 )
{ {
printf("schematic undo_redo.cpp: undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n");
/*
sheet->EEDrawList = NULL; sheet->EEDrawList = NULL;
sheet->m_UndoList = NULL; sheet->m_UndoList = NULL;
sheet->m_RedoList = NULL; sheet->m_RedoList = NULL;
*/
} }
} }
} }
if( (item->m_Flags & IS_NEW) == 0 ) if( (item->m_Flags & IS_NEW) == 0 ){
delete item; SAFE_DELETE( item );
}
} }
DrawPickedStruct* wrapper = PickedList; DrawPickedStruct* wrapper = PickedList;
PickedList = PickedList->Next(); PickedList = PickedList->Next();
delete wrapper; SAFE_DELETE( wrapper );
} }
} }
else // This is a single item: deleted copy else // This is a single item: deleted copy
@ -578,14 +583,18 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
{ {
if( (FirstItem->m_Flags & IS_NEW) == 0 ) if( (FirstItem->m_Flags & IS_NEW) == 0 )
{ {
printf("schematic undo_redo.cpp undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n");
/*
sheet->EEDrawList = NULL; sheet->EEDrawList = NULL;
sheet->m_UndoList = NULL; sheet->m_UndoList = NULL;
sheet->m_RedoList = NULL; sheet->m_RedoList = NULL;
*/
} }
} }
} }
if( (FirstItem->m_Flags & IS_NEW) == 0 ) if( (FirstItem->m_Flags & IS_NEW) == 0 ){
delete FirstItem; SAFE_DELETE( FirstItem );
}
} }
} }
} }

View File

@ -95,6 +95,7 @@ BEGIN_EVENT_TABLE(WinEDA_SchematicFrame, wxFrame)
EVT_TOOL_RCLICKED(ID_LABEL_BUTT, WinEDA_SchematicFrame::ToolOnRightClick) EVT_TOOL_RCLICKED(ID_LABEL_BUTT, WinEDA_SchematicFrame::ToolOnRightClick)
EVT_TOOL_RCLICKED(ID_GLABEL_BUTT, WinEDA_SchematicFrame::ToolOnRightClick) EVT_TOOL_RCLICKED(ID_GLABEL_BUTT, WinEDA_SchematicFrame::ToolOnRightClick)
EVT_TOOL_RCLICKED(ID_HIERLABEL_BUTT, WinEDA_SchematicFrame::ToolOnRightClick)
EVT_MENU_RANGE(ID_POPUP_START_RANGE, ID_POPUP_END_RANGE, EVT_MENU_RANGE(ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
WinEDA_SchematicFrame::Process_Special_Functions ) WinEDA_SchematicFrame::Process_Special_Functions )
@ -115,7 +116,7 @@ END_EVENT_TABLE()
/* Constructor */ /* Constructor */
/****************/ /****************/
WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *parent, WinEDA_SchematicFrame::WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *parent,
const wxString & title, const wxPoint& pos, const wxSize& size, long style) : const wxString & title, const wxPoint& pos, const wxSize& size, long style) :
WinEDA_DrawFrame(father, SCHEMATIC_FRAME, parent, title, pos, size, style) WinEDA_DrawFrame(father, SCHEMATIC_FRAME, parent, title, pos, size, style)
{ {
@ -124,6 +125,9 @@ WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *par
m_Draw_Axis = FALSE; // TRUE to show axis m_Draw_Axis = FALSE; // TRUE to show axis
m_Draw_Grid = g_ShowGrid; // TRUE to show a grid m_Draw_Grid = g_ShowGrid; // TRUE to show a grid
m_Draw_Sheet_Ref = TRUE; // TRUE to show sheet references m_Draw_Sheet_Ref = TRUE; // TRUE to show sheet references
m_CurrentSheet = new DrawSheetList();
CreateScreens();
// Give an icon // Give an icon
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@ -132,7 +136,6 @@ WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *par
SetIcon(wxICON(icon_eeschema)); SetIcon(wxICON(icon_eeschema));
#endif #endif
m_CurrentScreen = ScreenSch;
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
/* Get config */ /* Get config */
GetSettings(); GetSettings();
@ -156,28 +159,79 @@ WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *par
WinEDA_SchematicFrame::~WinEDA_SchematicFrame() WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
{ {
m_Parent->m_SchematicFrame = NULL; m_Parent->m_SchematicFrame = NULL;
m_CurrentScreen = ScreenSch; SAFE_DELETE( g_RootSheet );
SAFE_DELETE( m_CurrentSheet ); //a DrawSheetList, on the heap.
m_CurrentSheet = NULL;
}
/***************/
/* utility functions */
/***************/
DrawSheetList* WinEDA_SchematicFrame::GetSheet()
{
return m_CurrentSheet;
}
BASE_SCREEN* WinEDA_SchematicFrame::GetScreen()
{
return m_CurrentSheet->LastScreen();
}
void WinEDA_SchematicFrame::SetScreen(SCH_SCREEN* screen)
{
//find it in the hierarchy, and set it.
//there is ambiguity in this function (there may be several
//instances of a given sheet, but irregardless it is useful
//for printing etc.
DrawSheetList sheetlist;
if(g_RootSheet->LocatePathOfScreen(screen, &sheetlist)){
*m_CurrentSheet = sheetlist;
m_CurrentSheet->UpdateAllScreenReferences();
}
}
wxString WinEDA_SchematicFrame::GetScreenDesc()
{
wxString s = m_CurrentSheet->PathHumanReadable();
return s;
}
/******************************/
void WinEDA_SchematicFrame::CreateScreens()
/******************************/
{
/* creation des ecrans Sch , Lib */
if( g_RootSheet == NULL ){
g_RootSheet = new DrawSheetStruct();
}
if( g_RootSheet->m_s == NULL ){
g_RootSheet->m_s = new SCH_SCREEN( SCHEMATIC_FRAME );
g_RootSheet->m_s->m_RefCount++;
}
g_RootSheet->m_s->m_FileName = g_DefaultSchematicFileName;
g_RootSheet->m_s->m_Date = GenDate();
m_CurrentSheet->Clear();
m_CurrentSheet->Push(g_RootSheet);
if( ScreenLib == NULL )
ScreenLib = new SCH_SCREEN( LIBEDITOR_FRAME );
ScreenLib->SetZoom( 4 );
ScreenLib->m_UndoRedoCountMax = 10;
} }
/**************************************************************/ /**************************************************************/
void WinEDA_SchematicFrame::OnCloseWindow(wxCloseEvent & Event) void WinEDA_SchematicFrame::OnCloseWindow(wxCloseEvent & Event)
/**************************************************************/ /**************************************************************/
{ {
SCH_SCREEN * screen; DrawSheetList* sheet;
if ( m_Parent->m_LibeditFrame ) // Can close component editor ? if ( m_Parent->m_LibeditFrame ) // Can close component editor ?
{ {
if ( ! m_Parent->m_LibeditFrame->Close() ) return; if ( ! m_Parent->m_LibeditFrame->Close() ) return;
} }
screen = ScreenSch ; EDA_SheetList sheets( g_RootSheet );
while( screen )
{ for(sheet = sheets.GetFirst(); sheet != NULL; sheet = sheets.GetNext() ){
if(screen->IsModify()) break; if(sheet->LastScreen() && sheet->LastScreen()->IsModify()) break;
screen = (SCH_SCREEN*)screen->Pnext;
} }
if ( screen ) if ( sheet )
{ {
unsigned ii; unsigned ii;
wxMessageDialog dialog(this, _("Schematic modified, Save before exit ?"), wxMessageDialog dialog(this, _("Schematic modified, Save before exit ?"),
@ -194,25 +248,24 @@ SCH_SCREEN * screen;
case wxID_OK: case wxID_OK:
case wxID_YES: case wxID_YES:
SaveProject(this); SaveProject();
break; break;
} }
} }
screen = ScreenSch ; for(sheet = sheets.GetFirst(); sheet != NULL; sheet = sheets.GetNext() ){
while( screen ) // Clear "flag modify" to avoid alert messages when closing sub sheets if(sheet->LastScreen()){
{ sheet->LastScreen()->ClrModify();
screen->ClrModify(); }
screen = (SCH_SCREEN*)screen->Pnext;
} }
if ( ! ScreenSch->m_FileName.IsEmpty() && (ScreenSch->EEDrawList != NULL) ) if ( ! GetScreen()->m_FileName.IsEmpty() && (GetScreen()->EEDrawList != NULL) )
SetLastProject(ScreenSch->m_FileName); SetLastProject(GetScreen()->m_FileName);
ClearProjectDrawList(ScreenSch, TRUE); ClearProjectDrawList(g_RootSheet->m_s, TRUE);
/* allof sub sheets are deleted, only the main sheet is useable */ /* allof sub sheets are deleted, only the main sheet is useable */
m_CurrentScreen = ActiveScreen = ScreenSch; m_CurrentSheet->Clear();
SaveSettings(); SaveSettings();
@ -231,7 +284,7 @@ void WinEDA_SchematicFrame::SetToolbars()
{ {
if( m_HToolBar ) if( m_HToolBar )
{ {
if ( m_CurrentScreen->BlockLocate.m_Command == BLOCK_MOVE ) if ( GetScreen() && GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
{ {
m_HToolBar->EnableTool(wxID_CUT,TRUE); m_HToolBar->EnableTool(wxID_CUT,TRUE);
m_HToolBar->EnableTool(wxID_COPY,TRUE); m_HToolBar->EnableTool(wxID_COPY,TRUE);
@ -246,7 +299,7 @@ void WinEDA_SchematicFrame::SetToolbars()
else m_HToolBar->EnableTool(wxID_PASTE,FALSE); else m_HToolBar->EnableTool(wxID_PASTE,FALSE);
wxMenuBar * menuBar = GetMenuBar(); wxMenuBar * menuBar = GetMenuBar();
if ( GetScreen()->m_RedoList ) if ( GetScreen() && GetScreen()->m_RedoList )
{ {
m_HToolBar->EnableTool(ID_SCHEMATIC_REDO,TRUE); m_HToolBar->EnableTool(ID_SCHEMATIC_REDO,TRUE);
menuBar->Enable(ID_SCHEMATIC_REDO,TRUE); menuBar->Enable(ID_SCHEMATIC_REDO,TRUE);
@ -256,7 +309,7 @@ void WinEDA_SchematicFrame::SetToolbars()
m_HToolBar->EnableTool(ID_SCHEMATIC_REDO,FALSE); m_HToolBar->EnableTool(ID_SCHEMATIC_REDO,FALSE);
menuBar->Enable(ID_SCHEMATIC_REDO,FALSE); menuBar->Enable(ID_SCHEMATIC_REDO,FALSE);
} }
if ( GetScreen()->m_UndoList ) if ( GetScreen() && GetScreen()->m_UndoList )
{ {
m_HToolBar->EnableTool(ID_SCHEMATIC_UNDO,TRUE); m_HToolBar->EnableTool(ID_SCHEMATIC_UNDO,TRUE);
menuBar->Enable(ID_SCHEMATIC_UNDO,TRUE); menuBar->Enable(ID_SCHEMATIC_UNDO,TRUE);
@ -300,17 +353,17 @@ int dx, dy, ii,jj ;
int bestzoom; int bestzoom;
wxSize size; wxSize size;
dx = m_CurrentScreen->m_CurrentSheet->m_Size.x; dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
dy = m_CurrentScreen->m_CurrentSheet->m_Size.y; dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
ii = dx / size.x; ii = dx / size.x;
jj = dy / size.y; jj = dy / size.y;
bestzoom = MAX(ii, jj) + 1; bestzoom = MAX(ii, jj) + 1;
m_CurrentScreen->SetZoom(ii); GetScreen()->SetZoom(ii);
m_CurrentScreen->m_Curseur.x = dx / 2; GetScreen()->m_Curseur.x = dx / 2;
m_CurrentScreen->m_Curseur.y = dy / 2; GetScreen()->m_Curseur.y = dy / 2;
return(bestzoom); return(bestzoom);
} }

View File

@ -292,12 +292,21 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
{ {
m_CurrentSheet->m_FileName = FileName; m_CurrentSheet->m_FileName = FileName;
if( wxFileExists( FileName ) ) /* do we reload the data from the existing file */ if( wxFileExists( FileName ) )//do we reload the data from the existing file
{ {
msg.Printf( _( "A file named %s exists, load it ?" ), FileName.GetData() ); msg.Printf( _( "A file named %s exists, load it ?" ), FileName.GetData() );
if( IsOK( this, msg ) ) if( IsOK( this, msg ) )
{ {
m_Parent->LoadOneSheet( m_CurrentSheet, FileName ); //LoadOneSheet clears the EEDrawList,
//we do not need to delete & recreate the SCH_SCREEN obj
m_CurrentSheet->m_FileName = FileName;
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);
} }
} }
} }
@ -355,15 +364,19 @@ DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
{ {
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
DrawSheetStruct* Sheet = new DrawSheetStruct( m_CurrentScreen->m_Curseur ); DrawSheetStruct* Sheet = new DrawSheetStruct( GetScreen()->m_Curseur );
Sheet->m_Flags = IS_NEW | IS_RESIZED; Sheet->m_Flags = IS_NEW | IS_RESIZED;
Sheet->m_TimeStamp = GetTimeStamp(); Sheet->m_TimeStamp = GetTimeStamp();
Sheet->m_Parent = m_CurrentScreen; Sheet->m_Parent = GetScreen();
Sheet->m_s = NULL;
s_SheetMindx = SHEET_MIN_WIDTH; s_SheetMindx = SHEET_MIN_WIDTH;
s_SheetMindy = SHEET_MIN_HEIGHT; s_SheetMindy = SHEET_MIN_HEIGHT;
m_CurrentScreen->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->ManageCurseur = DeplaceSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet;
@ -424,7 +437,7 @@ void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC )
return; return;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = Sheet->m_Pos; GetScreen()->m_Curseur = Sheet->m_Pos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
s_OldPos = Sheet->m_Pos; s_OldPos = Sheet->m_Pos;
@ -438,14 +451,14 @@ void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC )
/********************************************************/ /********************************************************/
/*** Routine de deplacement Sheet, lie au curseur. */ /* Routine de deplacement (move) Sheet, lie au curseur.*/
/* Appele par GeneralControle grace a ManageCurseur. */ /* Appele par GeneralControle grace a ManageCurseur. */
/********************************************************/ /********************************************************/
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
wxPoint move_vector; wxPoint move_vector;
DrawSheetLabelStruct* SheetLabel; DrawSheetLabelStruct* SheetLabel;
BASE_SCREEN* screen = panel->m_Parent->m_CurrentScreen; BASE_SCREEN* screen = panel->m_Parent->GetScreen();
DrawSheetStruct* Sheet = (DrawSheetStruct*) DrawSheetStruct* Sheet = (DrawSheetStruct*)
screen->GetCurItem(); screen->GetCurItem();
@ -479,41 +492,13 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
/****************************************************************/
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->m_CurrentScreen->SetCurItem( NULL );
frame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL;
RedrawOneStruct( frame->DrawPanel, DC, this, g_XorMode );
delete this;
return;
}
if( wxFileExists( m_FileName ) )
{
( (WinEDA_SchematicFrame*) frame )->LoadOneSheet(
this, m_FileName );
}
}
EDA_BaseStruct::Place( frame, DC );
}
/****************************************/ /****************************************/
/* Routine de sortie du Menu de Sheet */ /* Routine de sortie du Menu de Sheet */
/****************************************/ /****************************************/
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC ) static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->m_Parent->m_CurrentScreen; SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->m_Parent->GetScreen();
DrawSheetStruct* Sheet = (DrawSheetStruct*) Screen->GetCurItem(); DrawSheetStruct* Sheet = (DrawSheetStruct*) Screen->GetCurItem();
if( Sheet == NULL ) if( Sheet == NULL )
@ -523,7 +508,7 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
if( Sheet->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */ if( Sheet->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
{ {
RedrawOneStruct( Panel, DC, Sheet, g_XorMode ); RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
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 */
{ {
@ -536,7 +521,7 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
else if( Sheet->m_Flags & IS_MOVED )/* move en cours: on l'annule */ else if( Sheet->m_Flags & IS_MOVED )/* move en cours: on l'annule */
{ {
wxPoint curspos = Screen->m_Curseur; wxPoint curspos = Screen->m_Curseur;
Panel->m_Parent->m_CurrentScreen->m_Curseur = s_OldPos; Panel->m_Parent->GetScreen()->m_Curseur = s_OldPos;
DeplaceSheet( Panel, DC, TRUE ); DeplaceSheet( Panel, DC, TRUE );
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
Sheet->m_Flags = 0; Sheet->m_Flags = 0;
@ -551,46 +536,6 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
/********************************************************************/
void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC )
/********************************************************************/
/* Delete pinsheets which are not corresponding to a Global label
* if DC != NULL, redraw Sheet
*/
{
DrawSheetLabelStruct* Pinsheet, * NextPinsheet;
if( !IsOK( frame, _( "Ok to cleanup this sheet" ) ) )
return;
Pinsheet = m_Label;
while( Pinsheet )
{
/* Search Glabel corresponding to this Pinsheet */
EDA_BaseStruct* DrawStruct = EEDrawList;
DrawGlobalLabelStruct* GLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{
if( DrawStruct->Type() != DRAW_GLOBAL_LABEL_STRUCT_TYPE )
continue;
GLabel = (DrawGlobalLabelStruct*) DrawStruct;
if( Pinsheet->m_Text.CmpNoCase( GLabel->m_Text ) == 0 )
break; // Found!
GLabel = NULL;
}
NextPinsheet = (DrawSheetLabelStruct*) Pinsheet->Pnext;
if( GLabel == NULL ) // Glabel not found: delete pinsheet
{
frame->GetScreen()->SetModify();
frame->DeleteSheetLabel( DC, Pinsheet );
}
Pinsheet = NextPinsheet;
}
}
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
@ -609,5 +554,4 @@ void WinEDA_SheetPropertiesFrame::OnCancelClick( wxCommandEvent& event )
void WinEDA_SheetPropertiesFrame::OnOkClick( wxCommandEvent& event ) void WinEDA_SheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
{ {
SheetPropertiesAccept( event ); SheetPropertiesAccept( event );
EndModal( 1 );
} }

View File

@ -117,7 +117,7 @@ public:
////@end WinEDA_SheetPropertiesFrame member variables ////@end WinEDA_SheetPropertiesFrame member variables
WinEDA_SchematicFrame * m_Parent; WinEDA_SchematicFrame * m_Parent;
DrawSheetStruct * m_CurrentSheet; DrawSheetStruct* m_CurrentSheet;
}; };
#endif #endif

View File

@ -150,7 +150,7 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
if( SheetLabel->m_Flags & IS_NEW ) if( SheetLabel->m_Flags & IS_NEW )
{ /* Nouveau Placement en cours, on l'efface */ { /* Nouveau Placement en cours, on l'efface */
RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode ); RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode );
delete SheetLabel; SAFE_DELETE( SheetLabel );
} }
else else
{ {
@ -356,21 +356,21 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S
{ {
EDA_BaseStruct* DrawStruct; EDA_BaseStruct* DrawStruct;
DrawSheetLabelStruct* NewSheetLabel, * SheetLabel = NULL; DrawSheetLabelStruct* NewSheetLabel, * SheetLabel = NULL;
DrawGlobalLabelStruct* GLabel = NULL; DrawHierLabelStruct* HLabel = NULL;
DrawStruct = Sheet->EEDrawList; DrawStruct = Sheet->m_s->EEDrawList;
GLabel = NULL; HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStruct->Type() != DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_HIER_LABEL_STRUCT_TYPE )
continue; continue;
GLabel = (DrawGlobalLabelStruct*) DrawStruct; HLabel = (DrawHierLabelStruct*) DrawStruct;
/* Ici un G-Label a ete trouve: y a t-il un SheetLabel correspondant */ /* Ici un G-Label a ete trouve: y a t-il un SheetLabel correspondant */
SheetLabel = Sheet->m_Label; SheetLabel = Sheet->m_Label;
for( ; SheetLabel != NULL; SheetLabel = (DrawSheetLabelStruct*) SheetLabel->Pnext ) for( ; SheetLabel != NULL; SheetLabel = (DrawSheetLabelStruct*) SheetLabel->Pnext )
{ {
if( SheetLabel->m_Text.CmpNoCase( GLabel->m_Text ) == 0 ) if( SheetLabel->m_Text.CmpNoCase( HLabel->m_Text ) == 0 )
{ {
break; break;
} }
@ -381,20 +381,20 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S
break; break;
} }
if( (GLabel == NULL ) || SheetLabel ) if( (HLabel == NULL ) || SheetLabel )
{ {
DisplayError( this, _( "No New Global Label found" ), 10 ); DisplayError( this, _( "No New Hierarchal Label found" ), 10 );
return NULL; return NULL;
} }
/* Ici G-Label n'a pas de SheetLabel corresp, on va le creer */ /* Ici H-Label n'a pas de SheetLabel corresp, on va le creer */
GetScreen()->SetModify(); GetScreen()->SetModify();
/* Creation en memoire */ /* Creation en memoire */
NewSheetLabel = new DrawSheetLabelStruct( Sheet, wxPoint( 0, 0 ), GLabel->m_Text ); NewSheetLabel = new DrawSheetLabelStruct( Sheet, wxPoint( 0, 0 ), HLabel->m_Text );
NewSheetLabel->m_Flags = IS_NEW; NewSheetLabel->m_Flags = IS_NEW;
NewSheetLabel->m_Size = NetSheetTextSize; NewSheetLabel->m_Size = NetSheetTextSize;
CurrentTypeLabel = NewSheetLabel->m_Shape = GLabel->m_Shape; CurrentTypeLabel = NewSheetLabel->m_Shape = HLabel->m_Shape;
GetScreen()->SetCurItem( NewSheetLabel ); GetScreen()->SetCurItem( NewSheetLabel );
DrawPanel->ManageCurseur = Move_PinSheet; DrawPanel->ManageCurseur = Move_PinSheet;

View File

@ -100,7 +100,7 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
} }
CurrentLibEntry->SortDrawItems(); CurrentLibEntry->SortDrawItems();
m_Parent->m_CurrentScreen->SetModify(); m_Parent->GetScreen()->SetModify();
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, 0, 0,
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, CurrentUnit, g_XorMode );
@ -150,7 +150,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
else else
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, 0, 0,
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, CurrentUnit, g_XorMode );
delete CurrentDrawItem; SAFE_DELETE( CurrentDrawItem );
} }
else else
{ {
@ -164,8 +164,6 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
CurrentDrawItem->m_Flags = 0; CurrentDrawItem->m_Flags = 0;
} }
CurrentDrawItem = NULL;
} }
@ -226,8 +224,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
LibDrawArc* Arc = new LibDrawArc(); LibDrawArc* Arc = new LibDrawArc();
CurrentDrawItem = Arc; CurrentDrawItem = Arc;
ArcStartX = ArcEndX = m_CurrentScreen->m_Curseur.x; ArcStartX = ArcEndX = GetScreen()->m_Curseur.x;
ArcStartY = ArcEndY = -m_CurrentScreen->m_Curseur.y; ArcStartY = ArcEndY = -( GetScreen()->m_Curseur.y );
StateDrawArc = 1; StateDrawArc = 1;
Arc->m_Fill = FlSymbol_Fill; Arc->m_Fill = FlSymbol_Fill;
Arc->m_Width = g_LibSymbolDefaultLineWidth; Arc->m_Width = g_LibSymbolDefaultLineWidth;
@ -239,8 +237,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
LibDrawCircle* Circle = new LibDrawCircle(); LibDrawCircle* Circle = new LibDrawCircle();
CurrentDrawItem = Circle; CurrentDrawItem = Circle;
Circle->m_Pos.x = m_CurrentScreen->m_Curseur.x; Circle->m_Pos.x = GetScreen()->m_Curseur.x;
Circle->m_Pos.y = -m_CurrentScreen->m_Curseur.y; Circle->m_Pos.y = -( GetScreen()->m_Curseur.y );
Circle->m_Fill = FlSymbol_Fill; Circle->m_Fill = FlSymbol_Fill;
Circle->m_Width = g_LibSymbolDefaultLineWidth; Circle->m_Width = g_LibSymbolDefaultLineWidth;
} }
@ -251,8 +249,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
LibDrawSquare* Square = new LibDrawSquare(); LibDrawSquare* Square = new LibDrawSquare();
CurrentDrawItem = Square; CurrentDrawItem = Square;
Square->m_Pos.x = m_CurrentScreen->m_Curseur.x; Square->m_Pos.x = GetScreen()->m_Curseur.x;
Square->m_Pos.y = -m_CurrentScreen->m_Curseur.y; Square->m_Pos.y = -( GetScreen()->m_Curseur.y );
Square->m_End = Square->m_Pos; Square->m_End = Square->m_Pos;
Square->m_Fill = FlSymbol_Fill; Square->m_Fill = FlSymbol_Fill;
Square->m_Width = g_LibSymbolDefaultLineWidth; Square->m_Width = g_LibSymbolDefaultLineWidth;
@ -267,8 +265,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
polyline->n = 2; polyline->n = 2;
ptpoly = (int*) MyZMalloc( 4 * sizeof(int) ); ptpoly = (int*) MyZMalloc( 4 * sizeof(int) );
polyline->PolyList = ptpoly; polyline->PolyList = ptpoly;
ptpoly[0] = ptpoly[2] = m_CurrentScreen->m_Curseur.x; ptpoly[0] = ptpoly[2] = GetScreen()->m_Curseur.x;
ptpoly[1] = ptpoly[3] = -m_CurrentScreen->m_Curseur.y; ptpoly[1] = ptpoly[3] = -( GetScreen()->m_Curseur.y );
polyline->m_Fill = FlSymbol_Fill; polyline->m_Fill = FlSymbol_Fill;
polyline->m_Width = g_LibSymbolDefaultLineWidth; polyline->m_Width = g_LibSymbolDefaultLineWidth;
} }
@ -279,8 +277,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
LibDrawSegment* Segment = new LibDrawSegment(); LibDrawSegment* Segment = new LibDrawSegment();
CurrentDrawItem = Segment; CurrentDrawItem = Segment;
Segment->m_Pos.x = m_CurrentScreen->m_Curseur.x; Segment->m_Pos.x = GetScreen()->m_Curseur.x;
Segment->m_Pos.y = -m_CurrentScreen->m_Curseur.y; Segment->m_Pos.y = -( GetScreen()->m_Curseur.y );
Segment->m_End = Segment->m_Pos; Segment->m_End = Segment->m_Pos;
Segment->m_Width = g_LibSymbolDefaultLineWidth; Segment->m_Width = g_LibSymbolDefaultLineWidth;
} }
@ -293,12 +291,12 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
CurrentDrawItem = Text; CurrentDrawItem = Text;
Text->m_Size.x = Text->m_Size.y = g_LastTextSize; Text->m_Size.x = Text->m_Size.y = g_LastTextSize;
Text->m_Horiz = g_LastTextOrient; Text->m_Horiz = g_LastTextOrient;
Text->m_Pos.x = m_CurrentScreen->m_Curseur.x; Text->m_Pos.x = GetScreen()->m_Curseur.x;
Text->m_Pos.y = -m_CurrentScreen->m_Curseur.y; Text->m_Pos.y = -( GetScreen()->m_Curseur.y );
EditSymbolText( NULL, Text ); EditSymbolText( NULL, Text );
if( Text->m_Text.IsEmpty() ) if( Text->m_Text.IsEmpty() )
{ {
delete Text; SAFE_DELETE( Text );
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
@ -364,7 +362,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
wxPoint pos = m_CurrentScreen->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
( (LibDrawPolyline*) CurrentDrawItem )->AddPoint( pos ); ( (LibDrawPolyline*) CurrentDrawItem )->AddPoint( pos );
} }
break; break;
@ -385,7 +383,7 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool era
/* Redraw the graphoc shape while moving /* Redraw the graphoc shape while moving
*/ */
{ {
BASE_SCREEN* Screen = panel->m_Parent->m_CurrentScreen; BASE_SCREEN* Screen = panel->m_Parent->GetScreen();
int mx, my; int mx, my;
/* Erase shape in the old positon*/ /* Erase shape in the old positon*/
@ -483,7 +481,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
SetCursor( wxCURSOR_HAND ); SetCursor( wxCURSOR_HAND );
CurrentDrawItem->m_Flags |= IS_MOVED; CurrentDrawItem->m_Flags |= IS_MOVED;
StartCursor = m_CurrentScreen->m_Curseur; StartCursor = GetScreen()->m_Curseur;
switch( CurrentDrawItem->Type() ) switch( CurrentDrawItem->Type() )
{ {
@ -515,7 +513,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
; ;
} }
ItemPreviousPos = m_CurrentScreen->m_Curseur; ItemPreviousPos = GetScreen()->m_Curseur;
DrawPanel->ManageCurseur = RedrawWhileMovingCursor; DrawPanel->ManageCurseur = RedrawWhileMovingCursor;
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn; DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn;
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
@ -531,7 +529,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
int DrawMode = g_XorMode; int DrawMode = g_XorMode;
int* ptpoly; int* ptpoly;
int dx, dy; int dx, dy;
BASE_SCREEN* Screen = panel->m_Parent->m_CurrentScreen; BASE_SCREEN* Screen = panel->m_Parent->GetScreen();
int mx = Screen->m_Curseur.x, int mx = Screen->m_Curseur.x,
my = Screen->m_Curseur.y; my = Screen->m_Curseur.y;
@ -722,7 +720,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
CurrentDrawItem->m_Flags = 0; CurrentDrawItem->m_Flags = 0;
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
@ -834,11 +832,11 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
{ {
Poly->n--; Poly->n--;
ptpoly = Poly->PolyList + ( 2 * (Poly->n - 1) ); ptpoly = Poly->PolyList + ( 2 * (Poly->n - 1) );
if( (ptpoly[0] != m_CurrentScreen->m_Curseur.x) if( (ptpoly[0] != GetScreen()->m_Curseur.x)
|| (ptpoly[1] != -m_CurrentScreen->m_Curseur.y) ) || (ptpoly[1] != -GetScreen()->m_Curseur.y) )
{ {
ptpoly[0] = m_CurrentScreen->m_Curseur.x; ptpoly[0] = GetScreen()->m_Curseur.x;
ptpoly[1] = -m_CurrentScreen->m_Curseur.y; ptpoly[1] = -( GetScreen()->m_Curseur.y);
break; break;
} }
} }

View File

@ -114,7 +114,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( wxDC* DC )
} }
SuppressDuplicateDrawItem( CurrentLibEntry ); SuppressDuplicateDrawItem( CurrentLibEntry );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
// Move (and place ) the new draw items: // Move (and place ) the new draw items:
HandleBlockBegin( DC, -1, GetScreen()->m_Curseur ); HandleBlockBegin( DC, -1, GetScreen()->m_Curseur );
@ -434,14 +434,14 @@ void WinEDA_LibeditFrame::PlaceAncre()
EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry;
LibEDA_BaseStruct* DrawEntry; LibEDA_BaseStruct* DrawEntry;
dx = -m_CurrentScreen->m_Curseur.x; dx = -( GetScreen()->m_Curseur.x );
dy = m_CurrentScreen->m_Curseur.y; dy = GetScreen()->m_Curseur.y;
LibEntry = CurrentLibEntry; LibEntry = CurrentLibEntry;
if( LibEntry == NULL ) if( LibEntry == NULL )
return; return;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
LibEntry->m_Name.m_Pos.x += dx; LibEntry->m_Name.m_Pos.y += dy; LibEntry->m_Name.m_Pos.x += dx; LibEntry->m_Name.m_Pos.y += dy;
LibEntry->m_Prefix.m_Pos.x += dx; LibEntry->m_Prefix.m_Pos.y += dy; LibEntry->m_Prefix.m_Pos.x += dx; LibEntry->m_Prefix.m_Pos.y += dy;
@ -510,7 +510,7 @@ void WinEDA_LibeditFrame::PlaceAncre()
} }
/* Redraw the symbol */ /* Redraw the symbol */
m_CurrentScreen->m_Curseur.x = m_CurrentScreen->m_Curseur.y = 0; GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
Recadre_Trace( TRUE ); Recadre_Trace( TRUE );
m_CurrentScreen->SetRefreshReq(); GetScreen()->SetRefreshReq();
} }

View File

@ -294,7 +294,7 @@ int DrawMode = g_XorMode;
new WinEDA_bodytext_PropertiesFrame(this); new WinEDA_bodytext_PropertiesFrame(this);
frame->ShowModal(); frame->Destroy(); frame->ShowModal(); frame->Destroy();
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
/* Affichage nouveau texte */ /* Affichage nouveau texte */
if( ((LibDrawText*)DrawItem)->m_Text && DC) if( ((LibDrawText*)DrawItem)->m_Text && DC)
@ -328,7 +328,7 @@ LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
DrawItem->m_Horiz = TEXT_ORIENT_VERT; DrawItem->m_Horiz = TEXT_ORIENT_VERT;
else DrawItem->m_Horiz = TEXT_ORIENT_HORIZ; else DrawItem->m_Horiz = TEXT_ORIENT_HORIZ;
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
/* Redraw item with new orient */ /* Redraw item with new orient */
if ( DrawPanel->ManageCurseur == NULL) if ( DrawPanel->ManageCurseur == NULL)

View File

@ -203,6 +203,10 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
BITMAP( add_glabel_xpm ), BITMAP( add_glabel_xpm ),
_( "Add global label" ), wxITEM_CHECK ); _( "Add global label" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString,
BITMAP( add_glabel_xpm ),
_( "Add hierarchal label" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString,
BITMAP( add_junction_xpm ), BITMAP( add_junction_xpm ),
_( "Add junction" ), wxITEM_CHECK ); _( "Add junction" ), wxITEM_CHECK );
@ -214,7 +218,7 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
m_VToolBar->AddTool( ID_IMPORT_GLABEL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_IMPORT_GLABEL_BUTT, wxEmptyString,
BITMAP( import_glabel_xpm ), BITMAP( import_glabel_xpm ),
_( "import glabel from sheet & create pinsheet" ), wxITEM_CHECK ); _( "import hierarchal label from sheet & create pinsheet" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_SHEET_LABEL_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_SHEET_LABEL_BUTT, wxEmptyString,
BITMAP( add_hierar_pin_xpm ), BITMAP( add_hierar_pin_xpm ),

View File

@ -71,7 +71,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame(wxWindow * father, WinEDA_App *parent,
if ( m_Semaphore ) SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP); if ( m_Semaphore ) SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP);
m_CurrentScreen = new SCH_SCREEN(VIEWER_FRAME); m_CurrentScreen = new SCH_SCREEN(VIEWER_FRAME);
m_CurrentScreen->SetZoom(16); GetScreen()->SetZoom(16);
if ( Library == NULL ) if ( Library == NULL )
{ {
@ -108,7 +108,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame(wxWindow * father, WinEDA_App *parent,
WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame() WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
{ {
delete m_CurrentScreen; SAFE_DELETE( m_CurrentScreen );
m_Parent->m_ViewlibFrame = NULL; m_Parent->m_ViewlibFrame = NULL;
} }
@ -185,8 +185,8 @@ EDA_LibComponentStruct * CurrentLibEntry = NULL;
if( CurrentLibEntry == NULL ) if( CurrentLibEntry == NULL )
{ {
bestzoom = 16; bestzoom = 16;
m_CurrentScreen->m_Curseur.x = 0; GetScreen()->m_Curseur.x = 0;
m_CurrentScreen->m_Curseur.y = 0; GetScreen()->m_Curseur.y = 0;
return(bestzoom); return(bestzoom);
} }
@ -205,8 +205,8 @@ EDA_LibComponentStruct * CurrentLibEntry = NULL;
if(bestzoom > ii ) break; if(bestzoom > ii ) break;
} }
m_CurrentScreen->m_Curseur = BoundaryBox.Centre(); GetScreen()->m_Curseur = BoundaryBox.Centre();
m_CurrentScreen->m_Curseur.y = - m_CurrentScreen->m_Curseur.y; GetScreen()->m_Curseur.y = -( GetScreen()->m_Curseur.y );
return(bestzoom); return(bestzoom);
} }
@ -236,8 +236,8 @@ bool found = FALSE;
free (ListNames); free (ListNames);
/* Librairie courante peut etre non retrouvée en liste /* Librairie courante peut etre non retrouv<EFBFBD>e en liste
(peut etre effacée lors d'une modification de configuration) */ (peut etre effac<EFBFBD>e lors d'une modification de configuration) */
if ( ! found ) if ( ! found )
{ {
g_CurrentViewLibraryName.Empty(); g_CurrentViewLibraryName.Empty();
@ -262,7 +262,7 @@ LibraryStruct *Library = FindLibrary(g_CurrentViewLibraryName.GetData());
ii = 0; ii = 0;
g_CurrentViewComponentName.Empty(); g_CurrentViewComponentName.Empty();
g_ViewConvert = 1; /* Vue normal / convert */ g_ViewConvert = 1; /* Vue normal / convert */
g_ViewUnit = 1; /* unité a afficher (A, B ..) */ g_ViewUnit = 1; /* unit<EFBFBD> a afficher (A, B ..) */
if ( Library ) if ( Library )
LibEntry = (EDA_LibComponentStruct *) PQFirst(&Library->m_Entries, FALSE); LibEntry = (EDA_LibComponentStruct *) PQFirst(&Library->m_Entries, FALSE);
while( LibEntry ) while( LibEntry )

View File

@ -66,7 +66,8 @@ void Affiche_Infos_Piste( WinEDA_BasePcbFrame* frame, TRACK* pt_piste )
{ {
int d_index, ii = -1; int d_index, ii = -1;
D_CODE* pt_D_code; D_CODE* pt_D_code;
int layer = frame->GetScreen()->m_Active_Layer;
int layer = ((PCB_SCREEN*)(frame->GetScreen()))->m_Active_Layer;
wxString msg; wxString msg;
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();

View File

@ -55,8 +55,8 @@ Outils et D_CODES
D_CODES: D_CODES:
D01 ... D9 = codes d'action: D01 ... D9 = codes d'action:
D01 = activation de lumiere (baisser de plume) lors du déplacement D01 = activation de lumiere (baisser de plume) lors du d<EFBFBD>placement
D02 = extinction de lumiere (lever de plume) lors du déplacement D02 = extinction de lumiere (lever de plume) lors du d<EFBFBD>placement
D03 = Flash D03 = Flash
D09 = VAPE Flash D09 = VAPE Flash
@ -107,7 +107,7 @@ void GERBER_Descr::ResetDefaultValues()
m_ImageNegative = FALSE; // TRUE = Negative image m_ImageNegative = FALSE; // TRUE = Negative image
m_GerbMetric = FALSE; // FALSE = Inches, TRUE = metric m_GerbMetric = FALSE; // FALSE = Inches, TRUE = metric
m_Relative = FALSE; // FALSE = absolute Coord, RUE = relative Coord m_Relative = FALSE; // FALSE = absolute Coord, RUE = relative Coord
m_NoTrailingZeros = FALSE; // True: zeros a droite supprimés m_NoTrailingZeros = FALSE; // True: zeros a droite supprim<EFBFBD>s
m_MirorA = FALSE; // True: miror / axe A (X) m_MirorA = FALSE; // True: miror / axe A (X)
m_MirorB = FALSE; // True: miror / axe B (Y) m_MirorB = FALSE; // True: miror / axe B (Y)
m_As_DCode = FALSE; // TRUE = DCodes in file (FALSE = no DCode-> m_As_DCode = FALSE; // TRUE = DCodes in file (FALSE = no DCode->
@ -158,7 +158,7 @@ int ii, jj;
void GERBER_Descr::InitToolTable() void GERBER_Descr::InitToolTable()
/******************************/ /******************************/
/* Creation du tableau des MAX_TOOLS DCodes utilisables, si il n'existe pas, /* Creation du tableau des MAX_TOOLS DCodes utilisables, si il n'existe pas,
et Init des DCodes à une valeur raisonnable et Init des DCodes <EFBFBD> une valeur raisonnable
*/ */
{ {
int count; int count;
@ -237,7 +237,7 @@ char Line[2000];
wxString msg; wxString msg;
D_CODE * pt_Dcode; D_CODE * pt_Dcode;
FILE * dest; FILE * dest;
int layer = GetScreen()->m_Active_Layer; int layer = GetPCBScreen()->m_Active_Layer;
D_CODE ** ListeDCode; D_CODE ** ListeDCode;
@ -369,7 +369,7 @@ D_CODE * pt_Dcode; /* Pointeur sur le D code*/
track->m_End = track->m_Start; // m_Start = m_End = Spot center track->m_End = track->m_Start; // m_Start = m_End = Spot center
switch (pt_Dcode->m_Shape) switch (pt_Dcode->m_Shape)
{ {
case GERB_LINE : // ne devrait pas etre utilisé ici case GERB_LINE : // ne devrait pas etre utilis<EFBFBD> ici
case GERB_CIRCLE : /* spot rond (for GERBER)*/ case GERB_CIRCLE : /* spot rond (for GERBER)*/
track->m_Shape = S_SPOT_CIRCLE; track->m_Shape = S_SPOT_CIRCLE;
break ; break ;
@ -430,7 +430,7 @@ D_CODE * pt_D_code ;
wxString Line; wxString Line;
WinEDA_TextFrame * List; WinEDA_TextFrame * List;
int scale = 10000; int scale = 10000;
int curr_layer = GetScreen()->m_Active_Layer; int curr_layer = GetPCBScreen()->m_Active_Layer;
int layer; int layer;
GERBER_Descr * DcodeList; GERBER_Descr * DcodeList;
@ -471,7 +471,7 @@ GERBER_Descr * DcodeList;
if (ii < 0) return; if (ii < 0) return;
#if 0 #if 0
// Mise en surbrillance des éléments correspondant au DCode sélectionné // Mise en surbrillance des <EFBFBD>l<EFBFBD>ments correspondant au DCode s<>lectionn<6E>
if(Etat_Surbrillance) Hight_Light(DrawPanel, DC); if(Etat_Surbrillance) Hight_Light(DrawPanel, DC);
net_code_Surbrillance = (GetScreen()->m_Active_Layer<< 16) + ii; net_code_Surbrillance = (GetScreen()->m_Active_Layer<< 16) + ii;
Hight_Light(DrawPanel, DC); Hight_Light(DrawPanel, DC);

View File

@ -19,8 +19,8 @@ static void Process_Move_Item( WinEDA_GerberFrame* frame,
void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/************************************************************************/ /************************************************************************/
/* Traite les commandes declenchée par le bouton gauche de la souris, /* Traite les commandes declench<EFBFBD>e par le bouton gauche de la souris,
* quand un outil est deja selectionné * quand un outil est deja selectionn<EFBFBD>
*/ */
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
@ -84,7 +84,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
*/ */
{ {
int id = event.GetId(); int id = event.GetId();
int layer = GetScreen()->m_Active_Layer; int layer = GetPCBScreen()->m_Active_Layer;
GERBER_Descr* gerber_layer = g_GERBER_Descr_List[layer]; GERBER_Descr* gerber_layer = g_GERBER_Descr_List[layer];
wxPoint pos; wxPoint pos;
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
@ -95,7 +95,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
pos.y += 20; pos.y += 20;
switch( id ) // Arret eventuel de la commande de déplacement en cours switch( id ) // Arret eventuel de la commande de d<EFBFBD>placement en cours
{ {
case wxID_CUT: case wxID_CUT:
case wxID_COPY: case wxID_COPY:
@ -126,7 +126,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor ); SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
break; break;
default: // Arret dea commande de déplacement en cours default: // Arret dea commande de d<EFBFBD>placement en cours
if( DrawPanel->ManageCurseur if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur ) && DrawPanel->ForceCloseManageCurseur )
{ {
@ -226,7 +226,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
{ {
GetScreen()->m_Active_Layer = m_SelLayerBox->GetChoice(); ((PCB_SCREEN*)GetScreen())->m_Active_Layer = m_SelLayerBox->GetChoice();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
} }
@ -287,7 +287,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS: case ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS:
if( gerber_layer ) if( gerber_layer )
Delete_DCode_Items( &dc, gerber_layer->m_Selected_Tool, GetScreen()->m_Active_Layer ); Delete_DCode_Items( &dc, gerber_layer->m_Selected_Tool, ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
break; break;
default: default:
@ -326,8 +326,8 @@ static void Process_Move_Item( WinEDA_GerberFrame* frame,
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/**************************************************************************/ /**************************************************************************/
/* Appelé sur un double click: /* Appel<EFBFBD> sur un double click:
* pour un ément editable (textes, composant): * pour un <EFBFBD>l<EFBFBD>ment editable (textes, composant):
* appel de l'editeur correspondant. * appel de l'editeur correspondant.
* pour une connexion en cours: * pour une connexion en cours:
* termine la connexion * termine la connexion
@ -349,7 +349,7 @@ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
break; break;
// Element localisé // Element localis<EFBFBD>
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
default: default:

View File

@ -41,10 +41,10 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
case ID_MENU_INC_LAYER_AND_APPEND_FILE: case ID_MENU_INC_LAYER_AND_APPEND_FILE:
case ID_INC_LAYER_AND_APPEND_FILE: case ID_INC_LAYER_AND_APPEND_FILE:
{ {
int layer = GetScreen()->m_Active_Layer; int layer = GetPCBScreen()->m_Active_Layer;
GetScreen()->m_Active_Layer++; ((PCB_SCREEN*)GetScreen())->m_Active_Layer++;
if( !LoadOneGerberFile( wxEmptyString, &dc, 0 ) ) if( !LoadOneGerberFile( wxEmptyString, &dc, 0 ) )
GetScreen()->m_Active_Layer = layer; ((PCB_SCREEN*)GetScreen())->m_Active_Layer = layer;
SetToolbars(); SetToolbars();
} }
break; break;

View File

@ -114,7 +114,7 @@ BEGIN_EVENT_TABLE(WinEDA_GerberFrame, wxFrame)
WinEDA_GerberFrame::OnSelectOptionToolbar) WinEDA_GerberFrame::OnSelectOptionToolbar)
// PopUp Menu traités dans drawpanel.cpp // PopUp Menu trait<EFBFBD>s dans drawpanel.cpp
END_EVENT_TABLE() END_EVENT_TABLE()
@ -131,7 +131,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame(wxWindow * father, WinEDA_App *parent,
m_AboutTitle = g_GerbviewAboutTitle; m_AboutTitle = g_GerbviewAboutTitle;
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessiné m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin<EFBFBD>
m_Ident = GERBER_FRAME; m_Ident = GERBER_FRAME;
m_ZoomMaxValue = 1024; m_ZoomMaxValue = 1024;
if ( DrawPanel ) DrawPanel->m_Block_Enable = TRUE; if ( DrawPanel ) DrawPanel->m_Block_Enable = TRUE;
@ -189,7 +189,7 @@ PCB_SCREEN * screen;
} }
/* Reselection de l'ecran de base, /* Reselection de l'ecran de base,
pour les evenements de refresh générés par wxWindows */ pour les evenements de refresh g<EFBFBD>n<EFBFBD>r<EFBFBD>s par wxWindows */
m_CurrentScreen = ActiveScreen = ScreenPcb; m_CurrentScreen = ActiveScreen = ScreenPcb;
SaveSettings(); SaveSettings();
@ -203,7 +203,7 @@ void WinEDA_GerberFrame::SetToolbars()
* Set the tools state for the toolbars, accordint to display options * Set the tools state for the toolbars, accordint to display options
*/ */
{ {
int layer = GetScreen()->m_Active_Layer; int layer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
GERBER_Descr * Gerber_layer_descr = g_GERBER_Descr_List[layer]; GERBER_Descr * Gerber_layer_descr = g_GERBER_Descr_List[layer];
if( m_HToolBar == NULL ) return; if( m_HToolBar == NULL ) return;
@ -231,9 +231,9 @@ GERBER_Descr * Gerber_layer_descr = g_GERBER_Descr_List[layer];
} }
if ( m_SelLayerBox->GetSelection() != GetScreen()->m_Active_Layer ) if ( m_SelLayerBox->GetSelection() != ((PCB_SCREEN*)GetScreen())->m_Active_Layer )
{ {
m_SelLayerBox->SetSelection( GetScreen()->m_Active_Layer ); m_SelLayerBox->SetSelection( ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
} }
if ( Gerber_layer_descr ) if ( Gerber_layer_descr )

View File

@ -137,13 +137,13 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_SWITCH_LAYER_TO_PREVIOUS: case HK_SWITCH_LAYER_TO_PREVIOUS:
if( GetScreen()->m_Active_Layer > 0 ) if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer > 0 )
GetScreen()->m_Active_Layer--; ((PCB_SCREEN*)GetScreen())->m_Active_Layer--;
break; break;
case HK_SWITCH_LAYER_TO_NEXT: case HK_SWITCH_LAYER_TO_NEXT:
if( GetScreen()->m_Active_Layer < 31 ) if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer < 31 )
GetScreen()->m_Active_Layer++; ((PCB_SCREEN*)GetScreen())->m_Active_Layer++;
break; break;
} }
} }

View File

@ -75,7 +75,7 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
/* Init parametres de gestion des ecrans PAD et PCB */ /* Init parametres de gestion des ecrans PAD et PCB */
m_CurrentScreen = ActiveScreen = ScreenPcb; m_CurrentScreen = ActiveScreen = ScreenPcb;
GetScreen()->Init(); GetPCBScreen()->Init();
return TRUE; return TRUE;
} }
@ -104,7 +104,7 @@ void WinEDA_GerberFrame::Erase_Segments_Pcb( bool all_layers, bool query )
{ {
BOARD_ITEM* PtStruct; BOARD_ITEM* PtStruct;
BOARD_ITEM* PtNext; BOARD_ITEM* PtNext;
int layer = GetScreen()->m_Active_Layer; int layer = GetPCBScreen()->m_Active_Layer;
if( all_layers ) if( all_layers )
layer = -1; layer = -1;
@ -189,7 +189,7 @@ void WinEDA_GerberFrame::Erase_Textes_Pcb( bool query )
void WinEDA_GerberFrame::Erase_Current_Layer( bool query ) void WinEDA_GerberFrame::Erase_Current_Layer( bool query )
/*********************************************************/ /*********************************************************/
{ {
int layer = GetScreen()->m_Active_Layer; int layer = GetPCBScreen()->m_Active_Layer;
wxString msg; wxString msg;
msg.Printf( _( "Delete Layer %d" ), layer + 1 ); msg.Printf( _( "Delete Layer %d" ), layer + 1 );

View File

@ -38,7 +38,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
/*************************************************************/ /*************************************************************/
/* Fonction de localisation generale /* Fonction de localisation generale
* Affiche les caract de la stucture localisée et retourne un pointeur * Affiche les caract de la stucture localis<EFBFBD>e et retourne un pointeur
* sur celle-ci * sur celle-ci
*/ */
{ {
@ -48,7 +48,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
int layer; int layer;
/* Localistion des pistes et vias, avec priorite aux vias */ /* Localistion des pistes et vias, avec priorite aux vias */
layer = GetScreen()->m_Active_Layer; layer = GetPCBScreen()->m_Active_Layer;
Track = Locate_Pistes( m_Pcb->m_Track, -1, typeloc ); Track = Locate_Pistes( m_Pcb->m_Track, -1, typeloc );
if( Track != NULL ) if( Track != NULL )
{ {
@ -80,7 +80,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
} }
if( ( TrackLocate = Locate_Zone( (TRACK*) m_Pcb->m_Zone, if( ( TrackLocate = Locate_Zone( (TRACK*) m_Pcb->m_Zone,
GetScreen()->m_Active_Layer, typeloc ) ) != NULL ) GetPCBScreen()->m_Active_Layer, typeloc ) ) != NULL )
{ {
TrackLocate->Display_Infos( this ); TrackLocate->Display_Infos( this );
return TrackLocate; return TrackLocate;

View File

@ -53,8 +53,8 @@
* D_CODES: * D_CODES:
* *
* D01 ... D9 = codes d'action: * D01 ... D9 = codes d'action:
* D01 = activation de lumiere (baisser de plume) lors du déplacement * D01 = activation de lumiere (baisser de plume) lors du d<EFBFBD>placement
* D02 = extinction de lumiere (lever de plume) lors du déplacement * D02 = extinction de lumiere (lever de plume) lors du d<EFBFBD>placement
* D03 = Flash * D03 = Flash
* D09 = VAPE Flash * D09 = VAPE Flash
* D51 = precede par G54 -> Select VAPE * D51 = precede par G54 -> Select VAPE
@ -91,11 +91,11 @@
* *
* Representation interne: * Representation interne:
* *
* Les lignes sont représentées par des TRACKS standards * Les lignes sont repr<EFBFBD>sent<EFBFBD>es par des TRACKS standards
* Les Flash sont représentées par des DRAWSEGMENTS * Les Flash sont repr<EFBFBD>sent<EFBFBD>es par des DRAWSEGMENTS
* - ronds ou ovales: DRAWSEGMENTS * - ronds ou ovales: DRAWSEGMENTS
* - rectangles: DRAWSEGMENTS * - rectangles: DRAWSEGMENTS
* la reference aux D-CODES est placée dans le membre GetNet() * la reference aux D-CODES est plac<EFBFBD>e dans le membre GetNet()
*/ */
@ -126,7 +126,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
wxPoint pos; wxPoint pos;
int error = 0; int error = 0;
layer = GetScreen()->m_Active_Layer; layer = GetPCBScreen()->m_Active_Layer;
if( g_GERBER_Descr_List[layer] == NULL ) if( g_GERBER_Descr_List[layer] == NULL )
{ {

View File

@ -56,8 +56,8 @@
* D_CODES: * D_CODES:
* *
* D01 ... D9 = codes d'action: * D01 ... D9 = codes d'action:
* D01 = activation de lumiere (baisser de plume) lors du déplacement * D01 = activation de lumiere (baisser de plume) lors du d<EFBFBD>placement
* D02 = extinction de lumiere (lever de plume) lors du déplacement * D02 = extinction de lumiere (lever de plume) lors du d<EFBFBD>placement
* D03 = Flash * D03 = Flash
* D09 = VAPE Flash * D09 = VAPE Flash
* D51 = precede par G54 -> Select VAPE * D51 = precede par G54 -> Select VAPE
@ -107,7 +107,7 @@ static void Append_1_Flash_ROND_GERBER( int Dcode_tool,
track->Insert( frame->m_Pcb, NULL ); track->Insert( frame->m_Pcb, NULL );
track->SetLayer( frame->GetScreen()->m_Active_Layer ); track->SetLayer( frame->GetPCBScreen()->m_Active_Layer );
track->m_Width = diametre; track->m_Width = diametre;
track->m_Start = track->m_End = pos; track->m_Start = track->m_End = pos;
NEGATE( track->m_Start.y ); NEGATE( track->m_Start.y );
@ -140,7 +140,7 @@ static void Append_1_Flash_GERBER( int Dcode_index,
track->Insert( frame->m_Pcb, NULL ); track->Insert( frame->m_Pcb, NULL );
track->SetLayer( frame->GetScreen()->m_Active_Layer ); track->SetLayer( frame->GetPCBScreen()->m_Active_Layer );
track->m_Width = width; track->m_Width = width;
track->m_Start = track->m_End = pos; track->m_Start = track->m_End = pos;
NEGATE( track->m_Start.y ); NEGATE( track->m_Start.y );
@ -150,7 +150,7 @@ static void Append_1_Flash_GERBER( int Dcode_index,
if( forme == PAD_OVAL ) if( forme == PAD_OVAL )
track->m_Shape = S_SPOT_OVALE; track->m_Shape = S_SPOT_OVALE;
else else
track->m_Shape = S_SPOT_RECT; // donc rectangle ou carré track->m_Shape = S_SPOT_RECT; // donc rectangle ou carr<EFBFBD>
len >>= 1; len >>= 1;
if( size.x > size.y ) // ovale / rect horizontal if( size.x > size.y ) // ovale / rect horizontal
@ -181,7 +181,7 @@ static void Append_1_Line_GERBER( int Dcode_index,
track->Insert( frame->m_Pcb, NULL ); track->Insert( frame->m_Pcb, NULL );
track->SetLayer( frame->GetScreen()->m_Active_Layer ); track->SetLayer( frame->GetPCBScreen()->m_Active_Layer );
track->m_Width = largeur; track->m_Width = largeur;
track->m_Start = startpoint; track->m_Start = startpoint;
NEGATE( track->m_Start.y ); NEGATE( track->m_Start.y );
@ -203,10 +203,10 @@ static void Append_1_SEG_ARC_GERBER( int Dcode_index,
/* creation d'un arc: /* creation d'un arc:
* si multiquadrant == TRUE arc de 0 a 360 degres * si multiquadrant == TRUE arc de 0 a 360 degres
* et rel_center est la coordonnée du centre relativement au startpoint * et rel_center est la coordonn<EFBFBD>e du centre relativement au startpoint
* *
* si multiquadrant == FALSE arc de 0 à 90 entierement contenu dans le meme quadrant * si multiquadrant == FALSE arc de 0 <EFBFBD> 90 entierement contenu dans le meme quadrant
* et rel_center est la coordonnée du centre relativement au startpoint, * et rel_center est la coordonn<EFBFBD>e du centre relativement au startpoint,
* mais en VALEUR ABSOLUE et le signe des valeurs x et y de rel_center doit * mais en VALEUR ABSOLUE et le signe des valeurs x et y de rel_center doit
* etre deduit de cette limite de 90 degres * etre deduit de cette limite de 90 degres
* *
@ -220,7 +220,7 @@ static void Append_1_SEG_ARC_GERBER( int Dcode_index,
track->Insert( frame->m_Pcb, NULL ); track->Insert( frame->m_Pcb, NULL );
track->m_Shape = S_ARC; track->m_Shape = S_ARC;
track->SetLayer( frame->GetScreen()->m_Active_Layer ); track->SetLayer( frame->GetPCBScreen()->m_Active_Layer );
track->m_Width = largeur; track->m_Width = largeur;
if( multiquadrant ) if( multiquadrant )
@ -294,10 +294,10 @@ static void Append_1_SEG_ARC_GERBER( int Dcode_index,
/**************************************************/ /**************************************************/
/* Routines utilisées en lecture de ficher gerber */ /* Routines utilis<EFBFBD>es en lecture de ficher gerber */
/**************************************************/ /**************************************************/
/* ces routines lisent la chaine de texte pointée par Text. /* ces routines lisent la chaine de texte point<EFBFBD>e par Text.
* Apres appel, Text pointe le debut de la sequence non lue * Apres appel, Text pointe le debut de la sequence non lue
*/ */
@ -436,7 +436,7 @@ wxPoint GERBER_Descr::ReadIJCoord( char*& Text )
/************************************************/ /************************************************/
/* Retourne la coord type InnJnn courante pointee par Text (InnnnJmmmm) /* Retourne la coord type InnJnn courante pointee par Text (InnnnJmmmm)
* Ces coordonnées sont relatives, donc si une coord est absente, sa valeur * Ces coordonn<EFBFBD>es sont relatives, donc si une coord est absente, sa valeur
* par defaut est 0 * par defaut est 0
*/ */
{ {
@ -741,7 +741,7 @@ bool GERBER_Descr::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
edge_poly->Insert( frame->m_Pcb, last ); edge_poly->Insert( frame->m_Pcb, last );
edge_poly->SetLayer( frame->GetScreen()->m_Active_Layer ); edge_poly->SetLayer( frame->GetPCBScreen()->m_Active_Layer );
edge_poly->m_Width = 1; edge_poly->m_Width = 1;
edge_poly->m_Start = m_PreviousPos; edge_poly->m_Start = m_PreviousPos;
NEGATE( edge_poly->m_Start.y ); NEGATE( edge_poly->m_Start.y );
@ -850,7 +850,7 @@ bool GERBER_Descr::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
PAD_RECT ); PAD_RECT );
break; break;
default: // Special (Macro) : Non implanté default: // Special (Macro) : Non implant<EFBFBD>
break; break;
} }

View File

@ -200,7 +200,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
if( GetScreen() ) if( GetScreen() )
{ {
layer = GetScreen()->m_Active_Layer; layer = GetPCBScreen()->m_Active_Layer;
gerber_layer = g_GERBER_Descr_List[layer]; gerber_layer = g_GERBER_Descr_List[layer];
} }
@ -313,7 +313,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
m_SelLayerBox = new WinEDAChoiceBox( m_HToolBar, ID_TOOLBARH_PCB_SELECT_LAYER, m_SelLayerBox = new WinEDAChoiceBox( m_HToolBar, ID_TOOLBARH_PCB_SELECT_LAYER,
wxDefaultPosition, wxSize( 150, -1 ), choices ); wxDefaultPosition, wxSize( 150, -1 ), choices );
m_SelLayerBox->SetSelection( GetScreen()->m_Active_Layer ); m_SelLayerBox->SetSelection( GetPCBScreen()->m_Active_Layer );
m_HToolBar->AddControl( m_SelLayerBox ); m_HToolBar->AddControl( m_SelLayerBox );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();

View File

@ -64,7 +64,7 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/* Trace le PCB, et les elements complementaires ( axes, grille .. ) /* Trace le PCB, et les elements complementaires ( axes, grille .. )
*/ */
{ {
PCB_SCREEN* screen = GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
if( !m_Pcb ) if( !m_Pcb )
return; return;

View File

@ -50,6 +50,7 @@ enum KICAD_T {
DRAW_TEXT_STRUCT_TYPE, DRAW_TEXT_STRUCT_TYPE,
DRAW_LABEL_STRUCT_TYPE, DRAW_LABEL_STRUCT_TYPE,
DRAW_GLOBAL_LABEL_STRUCT_TYPE, DRAW_GLOBAL_LABEL_STRUCT_TYPE,
DRAW_HIER_LABEL_STRUCT_TYPE,
DRAW_LIB_ITEM_STRUCT_TYPE, DRAW_LIB_ITEM_STRUCT_TYPE,
DRAW_PICK_ITEM_STRUCT_TYPE, DRAW_PICK_ITEM_STRUCT_TYPE,
DRAW_SEGMENT_STRUCT_TYPE, DRAW_SEGMENT_STRUCT_TYPE,

View File

@ -340,7 +340,7 @@ COMMON_GLOBL int g_GridColor
#endif #endif
; ;
/* Current used screen: */ /* Current used screen: (not used in eeshema)*/
COMMON_GLOBL BASE_SCREEN* ActiveScreen; COMMON_GLOBL BASE_SCREEN* ActiveScreen;

View File

@ -277,7 +277,7 @@ class wxSVGFileDC : public wxDC
void SetFont(const wxFont& font) ; void SetFont(const wxFont& font) ;
void SetLogicalFunction(int WXUNUSED(function)) void SetLogicalFunction(int WXUNUSED(function))
{ wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetLogicalFunction Call implemented")); return ; }; { /*wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetLogicalFunction Call implemented")); */ return ; };
void SetLogicalScale( double x, double y ) ; void SetLogicalScale( double x, double y ) ;

View File

@ -58,7 +58,7 @@ public:
WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size ); WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size );
~WinEDA_DrawPanel() { } ~WinEDA_DrawPanel() { }
/****************************/ /****************************/
BASE_SCREEN* GetScreen() { return m_Parent->m_CurrentScreen; } virtual BASE_SCREEN* GetScreen() { return m_Parent->GetScreen(); }
void PrepareGraphicContext( wxDC* DC ); void PrepareGraphicContext( wxDC* DC );
wxPoint CalcAbsolutePosition( const wxPoint& rel_pos ); wxPoint CalcAbsolutePosition( const wxPoint& rel_pos );
@ -196,8 +196,8 @@ public:
DrawBlockStruct BlockLocate; /* Bock description for block commands */ DrawBlockStruct BlockLocate; /* Bock description for block commands */
/* Page description */ /* Page description */
Ki_PageDescr* m_CurrentSheet; Ki_PageDescr* m_CurrentSheetDesc;
int m_SheetNumber, m_NumberOfSheet;/* gestion hierarchie: numero de sousfeuille int m_ScreenNumber, m_NumberOfScreen;/* gestion hierarchie: numero de sousfeuille
* et nombre de feuilles. Root: SheetNumber = 1 */ * et nombre de feuilles. Root: SheetNumber = 1 */
wxString m_FileName; wxString m_FileName;
wxString m_Title; /* titre de la feuille */ wxString m_Title; /* titre de la feuille */

Some files were not shown because too many files have changed in this diff Show More