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:
parent
27bd742a8a
commit
c5cd85027b
|
@ -11,6 +11,7 @@
|
|||
#
|
||||
# CMAKE_VERBOSE_MAKEFILE ON/OFF (OPTIONAL)
|
||||
# Turns ON/OFF verbose build messages.
|
||||
# you can also pass VERBOSE=1 to make for the same effect.
|
||||
#
|
||||
# CMAKE_INSTALL_PREFIX (OPTIONAL)
|
||||
#
|
||||
|
|
|
@ -6,6 +6,19 @@ Please add newer entries at the top, list the date and your name with
|
|||
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>
|
||||
================================================================================
|
||||
+eeschema
|
||||
|
@ -13,7 +26,6 @@ email address.
|
|||
+all
|
||||
Russian translation update.
|
||||
|
||||
|
||||
2008-Feb-11 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
+pcbnew
|
||||
|
|
|
@ -49,7 +49,7 @@ BASE_SCREEN::~BASE_SCREEN()
|
|||
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_Grid = wxSize( 50, 50 ); /* pas de la grille */
|
||||
m_UserGrid = g_UserGrid; /* pas de la grille "utilisateur" */
|
||||
|
@ -63,18 +63,18 @@ void BASE_SCREEN::InitDatas()
|
|||
{
|
||||
case SCHEMATIC_FRAME:
|
||||
m_Center = FALSE;
|
||||
m_CurrentSheet = &g_Sheet_A4;
|
||||
m_CurrentSheetDesc = &g_Sheet_A4;
|
||||
break;
|
||||
|
||||
default:
|
||||
case CVPCB_DISPLAY_FRAME:
|
||||
case MODULE_EDITOR_FRAME:
|
||||
case PCB_FRAME:
|
||||
m_CurrentSheet = &g_Sheet_A4;
|
||||
m_CurrentSheetDesc = &g_Sheet_A4;
|
||||
break;
|
||||
|
||||
case GERBER_FRAME:
|
||||
m_CurrentSheet = &g_Sheet_GERBER;
|
||||
m_CurrentSheetDesc = &g_Sheet_GERBER;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -158,15 +158,15 @@ wxSize BASE_SCREEN::ReturnPageSize()
|
|||
{
|
||||
default:
|
||||
case SCHEMATIC_FRAME:
|
||||
PageSize = m_CurrentSheet->m_Size;
|
||||
PageSize = m_CurrentSheetDesc->m_Size;
|
||||
break;
|
||||
|
||||
case GERBER_FRAME:
|
||||
case CVPCB_DISPLAY_FRAME:
|
||||
case MODULE_EDITOR_FRAME:
|
||||
case PCB_FRAME:
|
||||
PageSize.x = m_CurrentSheet->m_Size.x * (PCB_INTERNAL_UNIT / 1000);
|
||||
PageSize.y = m_CurrentSheet->m_Size.y * (PCB_INTERNAL_UNIT / 1000);
|
||||
PageSize.x = m_CurrentSheetDesc->m_Size.x * (PCB_INTERNAL_UNIT / 1000);
|
||||
PageSize.y = m_CurrentSheetDesc->m_Size.y * (PCB_INTERNAL_UNIT / 1000);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,9 @@ std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
|
|||
void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
|
||||
{
|
||||
// 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;
|
||||
|
@ -195,9 +197,9 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& 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";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -122,6 +122,9 @@ void WinEDA_BasicFrame::PrintMsg(const wxString & text)
|
|||
/******************************************************/
|
||||
{
|
||||
SetStatusText(text);
|
||||
#ifdef DEBUG
|
||||
printf("%s\n", (const char*)text.mb_str() );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
|
@ -80,7 +80,7 @@ void PlotWorkSheet(int format_plot, BASE_SCREEN * screen)
|
|||
*/
|
||||
{
|
||||
#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;
|
||||
wxSize PageSize;
|
||||
wxPoint pos, ref;
|
||||
|
@ -234,11 +234,11 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
|
|||
break;
|
||||
|
||||
case WS_SIZESHEET:
|
||||
msg += screen->m_CurrentSheet->m_Name;
|
||||
msg += screen->m_CurrentSheetDesc->m_Name;
|
||||
break;
|
||||
|
||||
case WS_IDENTSHEET:
|
||||
msg << screen->m_SheetNumber << wxT("/") << screen->m_NumberOfSheet;
|
||||
msg << screen->m_ScreenNumber << wxT("/") << screen->m_NumberOfScreen;
|
||||
break;
|
||||
|
||||
case WS_COMPANY_NAME:
|
||||
|
|
|
@ -40,7 +40,7 @@ void WinEDA_DrawFrame::CopyToClipboard(wxCommandEvent& event)
|
|||
|
||||
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) );
|
||||
|
||||
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
||||
|
|
|
@ -505,7 +505,7 @@ void SetRealLibraryPath( const wxString& shortlibname )
|
|||
* Sinon g_UserLibDirBuffer = /usr/share/kicad/shortlibname/
|
||||
*
|
||||
* Remarque:
|
||||
* Les \ sont remplacés par / (a la mode Unix)
|
||||
* Les \ sont remplac<EFBFBD>s par / (a la mode Unix)
|
||||
*/
|
||||
{
|
||||
bool PathFound = FALSE;
|
||||
|
@ -545,7 +545,7 @@ wxString ReturnKicadDatasPath()
|
|||
* Sinon retourne /usr/share/kicad/
|
||||
*
|
||||
* Remarque:
|
||||
* Les \ sont remplacés par / (a la mode Unix)
|
||||
* Les \ sont remplac<EFBFBD>s par / (a la mode Unix)
|
||||
*/
|
||||
{
|
||||
bool PathFound = FALSE;
|
||||
|
|
|
@ -21,7 +21,7 @@ void WinEDA_DrawFrame::TraceWorkSheet(wxDC * DC, BASE_SCREEN * screen, int line_
|
|||
{
|
||||
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;
|
||||
wxPoint pos;
|
||||
int refx, refy,Color;
|
||||
|
@ -179,10 +179,8 @@ int width = line_width;
|
|||
|
||||
case WS_IDENTSHEET:
|
||||
if(WsItem->m_Legende) msg = WsItem->m_Legende;
|
||||
msg << screen->m_SheetNumber << wxT("/") <<
|
||||
screen->m_NumberOfSheet;
|
||||
DrawGraphicText(DrawPanel, DC, pos, Color,
|
||||
msg, TEXT_ORIENT_HORIZ, size,
|
||||
GetScreenDesc(), TEXT_ORIENT_HORIZ, size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ SET(EESCHEMA_SRCS
|
|||
block_libedit.cpp
|
||||
busentry.cpp
|
||||
bus-wire-junction.cpp
|
||||
class_hierarchy_sheet.cpp
|
||||
class_drawsheet.cpp
|
||||
class_screen.cpp
|
||||
class_text-label.cpp
|
||||
cleanup.cpp
|
||||
|
|
|
@ -35,7 +35,7 @@ void EDA_SchComponentStruct::Display_Infos( WinEDA_DrawFrame* frame )
|
|||
frame->MsgPanel->EraseMsgBox();
|
||||
|
||||
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 )
|
||||
msg = _( "Pwr Symb" );
|
||||
|
|
|
@ -12,7 +12,7 @@ static bool SortByPosition = true;
|
|||
#include "protos.h"
|
||||
|
||||
/* 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 void BreakReference( 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
|
||||
*/
|
||||
{
|
||||
/* Build the screen list */
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
/* Build the screen list (screen, not sheet) */
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
/* Update the sheet number, sheet count and date */
|
||||
ScreenList.UpdateSheetNumberAndDate();
|
||||
/* Update the screen number, sheet count and date */
|
||||
//ScreenList.UpdateScreenNumberAndDate();
|
||||
|
||||
SCH_SCREEN* screen;
|
||||
DrawSheetList* sheet;
|
||||
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 )
|
||||
{
|
||||
if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
|
@ -54,15 +54,31 @@ void ReAnnotatePowerSymbolsOnly( void )
|
|||
FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
if( (Entry == NULL) || (Entry->m_Options != ENTRY_POWER) )
|
||||
continue;
|
||||
DrawLibItem->ClearAnnotation();
|
||||
DrawLibItem->m_RefIdNumber = CmpNumber;
|
||||
DrawLibItem->m_Field[REFERENCE].m_Text.RemoveLast(); // Remove the '?'
|
||||
DrawLibItem->m_Field[REFERENCE].m_Text << wxT( "0" ) << CmpNumber;
|
||||
//DrawLibItem->ClearAnnotation(sheet); this clears all annotation :(
|
||||
wxString refstr = DrawLibItem->m_PrefixString;
|
||||
//str will be "C?" or so after the ClearAnnotation call.
|
||||
while(refstr.Last() == '?')
|
||||
refstr.RemoveLast();
|
||||
if(!refstr.StartsWith(wxT("#")))
|
||||
refstr = wxT("#") + refstr;
|
||||
refstr << wxT( "0" ) << CmpNumber;
|
||||
DrawLibItem->SetRef(sheet, refstr);
|
||||
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 )
|
||||
|
@ -84,12 +100,12 @@ void WinEDA_AnnotateFrame::AnnotateComponents( wxCommandEvent& event )
|
|||
/******************************************************************/
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
{
|
||||
int NbSheet, ii, NbOfCmp;
|
||||
SCH_SCREEN* screen;
|
||||
int ii, NbOfCmp;
|
||||
DrawSheetList* sheet;
|
||||
CmpListStruct* BaseListeCmp;
|
||||
|
||||
wxBusyCursor dummy;
|
||||
|
@ -104,47 +120,36 @@ void WinEDA_AnnotateFrame::AnnotateComponents( wxCommandEvent& event )
|
|||
return;
|
||||
|
||||
|
||||
/* Build the screen list */
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
/* Build the sheet list */
|
||||
EDA_SheetList SheetList( g_RootSheet );
|
||||
|
||||
NbSheet = ScreenList.GetCount();
|
||||
|
||||
/* Update the sheet number, sheet count and date */
|
||||
ScreenSch->SetModify();
|
||||
ScreenList.UpdateSheetNumberAndDate();
|
||||
/* Update the sheet number */
|
||||
ii = 0;
|
||||
|
||||
/* First pass: Component counting */
|
||||
screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen;
|
||||
if( AnnotProject == true )
|
||||
{
|
||||
sheet = m_Parent->GetSheet();
|
||||
if( AnnotProject == true ){
|
||||
NbOfCmp = 0;
|
||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
NbOfCmp += ListeComposants( NULL, screen, screen->m_SheetNumber );
|
||||
}
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
NbOfCmp += ListeComposants( NULL, sheet );
|
||||
}
|
||||
else
|
||||
NbOfCmp = ListeComposants( NULL, screen, screen->m_SheetNumber );
|
||||
NbOfCmp = ListeComposants( NULL, sheet );
|
||||
|
||||
if( NbOfCmp == 0 )
|
||||
return;
|
||||
|
||||
ii = sizeof(CmpListStruct) * NbOfCmp;
|
||||
BaseListeCmp = (CmpListStruct*) MyZMalloc( ii );
|
||||
BaseListeCmp = AllocateCmpListStrct(NbOfCmp);
|
||||
|
||||
/* Second pass : Int data tables */
|
||||
screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen;
|
||||
if( AnnotProject == true )
|
||||
{
|
||||
{
|
||||
ii = 0;
|
||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
ii += ListeComposants( BaseListeCmp + ii,
|
||||
screen, screen->m_SheetNumber );
|
||||
}
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
ii += ListeComposants( BaseListeCmp + ii, sheet);
|
||||
}
|
||||
else
|
||||
ii = ListeComposants( BaseListeCmp, screen, screen->m_SheetNumber );
|
||||
ii = ListeComposants( BaseListeCmp, sheet);
|
||||
|
||||
if( ii != NbOfCmp )
|
||||
DisplayError( this, wxT( "Internal error in AnnotateComponents()" ) );
|
||||
|
@ -177,33 +182,23 @@ void WinEDA_AnnotateFrame::DeleteAnnotation( wxCommandEvent& event )
|
|||
* Update sheet number and number of sheets
|
||||
*/
|
||||
{
|
||||
int NbSheet;
|
||||
SCH_SCREEN* screen;
|
||||
EDA_SchComponentStruct* DrawLibItem;
|
||||
|
||||
if( !IsOK( this, _( "Previous Annotation will be deleted. Continue ?" ) ) )
|
||||
{
|
||||
m_Abort = true; return;
|
||||
}
|
||||
DrawSheetStruct* sheet;
|
||||
//EDA_SchComponentStruct* DrawLibItem;
|
||||
|
||||
if( !IsOK( this, _( "Previous Annotation will be deleted. Continue ?" ) ) ){
|
||||
m_Abort = true;
|
||||
return;
|
||||
}
|
||||
AnnotProject = (m_AnnotProjetCtrl->GetSelection() == 0) ? true : 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 )
|
||||
screen = ScreenList.GetFirst();
|
||||
sheet = g_RootSheet;
|
||||
else
|
||||
screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen;
|
||||
sheet = m_Parent->GetSheet()->Last();
|
||||
|
||||
sheet->DeleteAnnotation( AnnotProject );
|
||||
/*
|
||||
for( ; screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
EDA_BaseStruct* DrawList = screen->EEDrawList;
|
||||
|
@ -219,26 +214,26 @@ void WinEDA_AnnotateFrame::DeleteAnnotation( wxCommandEvent& event )
|
|||
if( !AnnotProject )
|
||||
break;
|
||||
}
|
||||
|
||||
*/
|
||||
g_RootSheet->m_s->SetModify();
|
||||
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
|
||||
*/
|
||||
{
|
||||
int NbrCmp = 0;
|
||||
EDA_BaseStruct* DrawList = screen->EEDrawList;
|
||||
EDA_BaseStruct* DrawList = sheet->LastDrawList();
|
||||
EDA_SchComponentStruct* DrawLibItem;
|
||||
EDA_LibComponentStruct* Entry;
|
||||
|
||||
DrawList = screen->EEDrawList;
|
||||
for( ; DrawList; DrawList = DrawList->Pnext )
|
||||
{
|
||||
switch( DrawList->Type() )
|
||||
|
@ -248,6 +243,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumShe
|
|||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
break;
|
||||
|
||||
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_Unit = DrawLibItem->m_Multi;
|
||||
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_Pos = DrawLibItem->m_Pos;
|
||||
BaseListeCmp[NbrCmp].m_TimeStamp = DrawLibItem->m_TimeStamp;
|
||||
|
||||
if( DrawLibItem->m_Field[REFERENCE].m_Text.IsEmpty() )
|
||||
DrawLibItem->m_Field[REFERENCE].m_Text = wxT( "DefRef?" );
|
||||
if( DrawLibItem->GetRef(sheet).IsEmpty() )
|
||||
DrawLibItem->SetRef( sheet, wxT( "DefRef?" ) );
|
||||
|
||||
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;
|
||||
|
||||
|
@ -326,7 +322,7 @@ int AnnotTriComposant( const void* o1, const void* o2 )
|
|||
if( SortByPosition == true )
|
||||
{
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_Sheet - Objet2->m_Sheet;
|
||||
ii = Objet1->m_SheetList.Cmp(Objet2->m_SheetList);
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_Pos.x - Objet2->m_Pos.x;
|
||||
if( ii == 0 )
|
||||
|
@ -339,7 +335,7 @@ int AnnotTriComposant( const void* o1, const void* o2 )
|
|||
if( ii == 0 )
|
||||
ii = Objet1->m_Unit - Objet2->m_Unit;
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_Sheet - Objet2->m_Sheet;
|
||||
ii = Objet1->m_SheetList.Cmp(Objet2->m_SheetList);
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_Pos.x - Objet2->m_Pos.x;
|
||||
if( ii == 0 )
|
||||
|
@ -375,11 +371,8 @@ static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp )
|
|||
else
|
||||
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_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;
|
||||
}
|
||||
}
|
||||
/*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).
|
||||
*/
|
||||
{
|
||||
int NbSheet, ii, NumSheet = 1, error, NbOfCmp;
|
||||
SCH_SCREEN* screen;
|
||||
int ii, error, NbOfCmp;
|
||||
DrawSheetList* sheet;
|
||||
CmpListStruct* ListeCmp = NULL;
|
||||
wxString Buff;
|
||||
wxString msg, cmpref;
|
||||
|
||||
/* build the screen list */
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
NbSheet = ScreenList.GetCount();
|
||||
|
||||
/* Update the sheet number, sheet count and date */
|
||||
ScreenSch->SetModify();
|
||||
ScreenList.UpdateSheetNumberAndDate();
|
||||
g_RootSheet->m_s->SetModify();
|
||||
ii = 0;
|
||||
|
||||
/* first pass : count composents */
|
||||
screen = (SCH_SCREEN*) frame->m_CurrentScreen;
|
||||
if( !OneSheetOnly )
|
||||
{
|
||||
if( !OneSheetOnly ){
|
||||
NbOfCmp = 0;
|
||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
NbOfCmp += ListeComposants( NULL, screen, NumSheet );
|
||||
}
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
NbOfCmp += ListeComposants( NULL, sheet );
|
||||
}
|
||||
else
|
||||
NbOfCmp = ListeComposants( NULL, screen, NumSheet );
|
||||
NbOfCmp = ListeComposants( NULL, frame->GetSheet() );
|
||||
|
||||
if( NbOfCmp == 0 )
|
||||
{
|
||||
|
@ -654,23 +643,18 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
|
|||
|
||||
|
||||
/* Second pass : create the list of components */
|
||||
ii = sizeof(CmpListStruct) * NbOfCmp;
|
||||
ListeCmp = (CmpListStruct*) MyZMalloc( ii );
|
||||
ListeCmp = AllocateCmpListStrct(NbOfCmp);
|
||||
|
||||
if( OneSheetOnly == 0 )
|
||||
{
|
||||
ii = 0;
|
||||
screen = ScreenSch;
|
||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
ii += ListeComposants( ListeCmp + ii, screen, NumSheet );
|
||||
}
|
||||
printf("CheckAnnotate() listing all components:\n");
|
||||
if( !OneSheetOnly ){
|
||||
ii = 0;
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
ii += ListeComposants( ListeCmp + ii, sheet );
|
||||
}
|
||||
else
|
||||
{
|
||||
screen = (SCH_SCREEN*) frame->m_CurrentScreen;
|
||||
ListeComposants( ListeCmp, screen, NumSheet );
|
||||
}
|
||||
ListeComposants( ListeCmp, frame->GetSheet() );
|
||||
|
||||
printf("CheckAnnotate() done:\n");
|
||||
|
||||
qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotTriComposant );
|
||||
|
||||
|
@ -782,7 +766,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
|
|||
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 )
|
||||
{
|
||||
wxString nextcmpref, cmpvalue, nextcmpvalue;
|
||||
|
|
|
@ -201,7 +201,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
|||
* retourne :
|
||||
* 0 si aucun composant selectionne
|
||||
* 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;
|
||||
|
@ -232,18 +232,18 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
|||
break;
|
||||
|
||||
case BLOCK_DRAG: /* Drag */
|
||||
BreakSegmentOnJunction( GetScreen() );
|
||||
BreakSegmentOnJunction( (SCH_SCREEN*)GetScreen() );
|
||||
|
||||
case BLOCK_MOVE: /* Move */
|
||||
case BLOCK_COPY: /* Copy */
|
||||
block->m_BlockDrawStruct =
|
||||
PickStruct( GetScreen()->BlockLocate, GetScreen()->EEDrawList, SEARCHALL );
|
||||
PickStruct( GetScreen()->BlockLocate, GetScreen(), SEARCHALL );
|
||||
|
||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||
if( block->m_BlockDrawStruct != NULL )
|
||||
{
|
||||
ii = 1;
|
||||
CollectStructsToDrag( GetScreen() );
|
||||
CollectStructsToDrag( (SCH_SCREEN*)GetScreen() );
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
@ -260,7 +260,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_DELETE: /* Delete */
|
||||
block->m_BlockDrawStruct =
|
||||
PickStruct( GetScreen()->BlockLocate,
|
||||
GetScreen()->EEDrawList, SEARCHALL );
|
||||
GetScreen(), SEARCHALL );
|
||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||
if( block->m_BlockDrawStruct != NULL )
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
|
|||
case BLOCK_SAVE: /* Save */
|
||||
block->m_BlockDrawStruct =
|
||||
PickStruct( GetScreen()->BlockLocate,
|
||||
GetScreen()->EEDrawList, SEARCHALL );
|
||||
GetScreen(), SEARCHALL );
|
||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||
if( block->m_BlockDrawStruct != NULL )
|
||||
{
|
||||
|
@ -379,14 +379,14 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
|||
}
|
||||
block->m_BlockDrawStruct = NULL;
|
||||
}
|
||||
BreakSegmentOnJunction( GetScreen() );
|
||||
BreakSegmentOnJunction( (SCH_SCREEN*)GetScreen() );
|
||||
block->m_BlockDrawStruct =
|
||||
PickStruct( GetScreen()->BlockLocate,
|
||||
GetScreen()->EEDrawList, SEARCHALL );
|
||||
GetScreen(), SEARCHALL );
|
||||
if( block->m_BlockDrawStruct != NULL )
|
||||
{
|
||||
ii = 1;
|
||||
CollectStructsToDrag( GetScreen() );
|
||||
CollectStructsToDrag( (SCH_SCREEN*)GetScreen() );
|
||||
if( DrawPanel->ManageCurseur )
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
block->m_State = STATE_BLOCK_MOVE;
|
||||
|
@ -685,10 +685,10 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
|
|||
DrawText->m_Pos.x = px.x;
|
||||
break;
|
||||
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
|
||||
// Text is not really mirrored: Orientation is changed
|
||||
DrawText = (DrawGlobalLabelStruct*) DrawStruct;
|
||||
DrawText = (DrawLabelStruct*) DrawStruct;
|
||||
if( DrawText->m_Orient == 0 ) /* horizontal text */
|
||||
DrawText->m_Orient = 2;
|
||||
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:
|
||||
{
|
||||
//DuplicateStruct calls GenCopy, which should handle
|
||||
//m_s and m_sRefCount properly.
|
||||
DrawSheetStruct* sheet = (DrawSheetStruct*) Struct;
|
||||
sheet->m_TimeStamp = GetTimeStamp();
|
||||
sheet->m_UndoList = NULL;
|
||||
sheet->m_RedoList = NULL;
|
||||
sheet->EEDrawList = NULL;
|
||||
sheet->m_Son = NULL;
|
||||
sheet->m_SheetName.Printf( wxT( "%8.8lX" ), sheet->m_TimeStamp );
|
||||
sheet->m_FileName = sheet->m_SheetName + wxT( ".sch" );
|
||||
//sheet->m_s->m_UndoList = NULL;
|
||||
//sheet->m_s->m_RedoList = NULL;
|
||||
//keep m_s pointer & associated.
|
||||
//sheet->m_Son = NULL; m_son is involved in undo and redo.
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -871,6 +871,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
|
|||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_SHEETLABEL_STRUCT_TYPE:
|
||||
case DRAW_PICK_ITEM_STRUCT_TYPE:
|
||||
case DRAW_MARKER_STRUCT_TYPE:
|
||||
|
@ -882,17 +883,12 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
|
|||
{
|
||||
DrawSheetStruct* sheet = (DrawSheetStruct*) NewDrawStruct;
|
||||
sheet->m_TimeStamp = GetTimeStamp();
|
||||
sheet->m_UndoList = NULL;
|
||||
sheet->m_RedoList = NULL;
|
||||
sheet->EEDrawList = NULL;
|
||||
sheet->m_Son = NULL;
|
||||
sheet->m_SheetName.Printf( wxT( "%8.8lX" ), sheet->m_TimeStamp );
|
||||
sheet->m_FileName = sheet->m_SheetName + wxT( ".sch" );
|
||||
break;
|
||||
}
|
||||
|
||||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
( (EDA_SchComponentStruct*) NewDrawStruct )->m_TimeStamp = GetTimeStamp();
|
||||
( (EDA_SchComponentStruct*) NewDrawStruct )->m_TimeStamp = GetTimeStamp();
|
||||
( (EDA_SchComponentStruct*) NewDrawStruct )->ClearAnnotation();
|
||||
break;
|
||||
}
|
||||
|
@ -964,7 +960,12 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
|
|||
RedrawOneStruct( panel, DC, DrawStruct, g_XorMode );
|
||||
/* Unlink the structure */
|
||||
DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link
|
||||
frame->SaveCopyInUndoList( DrawStruct, IS_DELETED );
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1043,7 +1044,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
|
|||
EDA_BaseStruct* Struct = PickedList->m_PickedStruct;
|
||||
if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
{
|
||||
( (EDA_SchComponentStruct*) Struct )->m_TimeStamp = GetTimeStamp();
|
||||
( (EDA_SchComponentStruct*) Struct )->m_TimeStamp = GetTimeStamp();
|
||||
( (EDA_SchComponentStruct*) Struct )->ClearAnnotation();
|
||||
SetStructFather( Struct, GetScreen() );
|
||||
}
|
||||
|
@ -1067,7 +1068,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
|
|||
{
|
||||
if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
{
|
||||
( (EDA_SchComponentStruct*) DrawStruct )->m_TimeStamp = GetTimeStamp();
|
||||
( (EDA_SchComponentStruct*) DrawStruct )->m_TimeStamp = GetTimeStamp();
|
||||
( (EDA_SchComponentStruct*) DrawStruct )->ClearAnnotation();
|
||||
}
|
||||
SetStructFather( DrawStruct, GetScreen() );
|
||||
|
@ -1117,6 +1118,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct )
|
|||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
case DRAW_SHEET_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;
|
||||
break;
|
||||
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
#define DrawGlobalLabel ( (DrawGlobalLabelStruct*) DrawStruct )
|
||||
DrawGlobalLabel->m_Pos += move_vector;
|
||||
#define DrawGHLabel ( (DrawLabelStruct*) DrawStruct )
|
||||
DrawGHLabel->m_Pos += move_vector;
|
||||
break;
|
||||
|
||||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
|
@ -1310,6 +1313,10 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
|
|||
NewDrawStruct = ( (DrawLabelStruct*) DrawStruct )->GenCopy();
|
||||
break;
|
||||
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
NewDrawStruct = ( (DrawHierLabelStruct*) DrawStruct )->GenCopy();
|
||||
break;
|
||||
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
NewDrawStruct = ( (DrawGlobalLabelStruct*) DrawStruct )->GenCopy();
|
||||
break;
|
||||
|
@ -1577,9 +1584,10 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
|||
Struct->m_Flags |= SELECTED;
|
||||
break;
|
||||
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawGlobalLabelStruct*) Struct )
|
||||
#define STRUCT ( (DrawLabelStruct*) Struct )
|
||||
if( Struct->m_Flags & SELECTED )
|
||||
break; /* Already in list */
|
||||
if( STRUCT->m_Pos != position )
|
||||
|
|
|
@ -140,8 +140,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
|||
if( !newsegment ) /* first point : Create first wire ou bus */
|
||||
{
|
||||
s_ConnexionStartPoint = cursorpos;
|
||||
s_OldWiresList = GetScreen()->ExtractWires( TRUE );
|
||||
GetScreen()->SchematicCleanUp( NULL );
|
||||
s_OldWiresList = ((SCH_SCREEN*)GetScreen())->ExtractWires( TRUE );
|
||||
((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL );
|
||||
|
||||
switch( type )
|
||||
{
|
||||
|
@ -191,8 +191,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
|||
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
|
||||
/* Creation du segment suivant ou fin de tracé si point sur pin, jonction ...*/
|
||||
if( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->m_Layer ) )
|
||||
/* Creation du segment suivant ou fin de trac<EFBFBD> si point sur pin, jonction ...*/
|
||||
if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->m_Layer ) )
|
||||
{
|
||||
EndSegment( DC ); return;
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
|
|||
alt_end_point = lastsegment->m_Start;
|
||||
}
|
||||
|
||||
GetScreen()->SchematicCleanUp( NULL );
|
||||
((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL );
|
||||
|
||||
/* clear flags and find last segment entered, for repeat function */
|
||||
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 */
|
||||
}
|
||||
|
||||
EraseStruct( GetScreen()->GetCurItem(), GetScreen() );
|
||||
EraseStruct( GetScreen()->GetCurItem(), (SCH_SCREEN*)GetScreen() );
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
}
|
||||
|
@ -662,6 +662,16 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
|||
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:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawGlobalLabelStruct*) g_ItemToRepeat )
|
||||
|
@ -695,11 +705,11 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
|||
|
||||
// Create the duplicate component, position = mouse cursor
|
||||
g_ItemToRepeat = STRUCT->GenCopy();
|
||||
new_pos.x = m_CurrentScreen->m_Curseur.x - STRUCT->m_Pos.x;
|
||||
new_pos.y = m_CurrentScreen->m_Curseur.y - STRUCT->m_Pos.y;
|
||||
STRUCT->m_Pos = m_CurrentScreen->m_Curseur;
|
||||
new_pos.x = GetScreen()->m_Curseur.x - STRUCT->m_Pos.x;
|
||||
new_pos.y = GetScreen()->m_Curseur.y - STRUCT->m_Pos.y;
|
||||
STRUCT->m_Pos = GetScreen()->m_Curseur;
|
||||
STRUCT->m_Flags = IS_NEW;
|
||||
STRUCT->m_TimeStamp = GetTimeStamp();
|
||||
STRUCT->m_TimeStamp = GetTimeStamp();
|
||||
for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
|
||||
{
|
||||
STRUCT->m_Field[ii].m_Pos += new_pos;
|
||||
|
@ -770,10 +780,10 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
|||
* - type WIRE, si il y a
|
||||
* - une jonction
|
||||
* - 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
|
||||
* - ou une extrémité unique de BUS
|
||||
* - ou une extr<EFBFBD>mit<EFBFBD> unique de BUS
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* item;
|
||||
|
@ -785,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
|||
switch( layer )
|
||||
{
|
||||
case LAYER_BUS:
|
||||
item = PickStruct( pos, screen->EEDrawList, BUSITEM );
|
||||
item = PickStruct( pos, screen, BUSITEM );
|
||||
if( item )
|
||||
return TRUE;
|
||||
pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList );
|
||||
|
@ -798,13 +808,13 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
|||
break;
|
||||
|
||||
case LAYER_NOTES:
|
||||
item = PickStruct( pos, screen->EEDrawList, DRAWITEM );
|
||||
item = PickStruct( pos, screen, DRAWITEM );
|
||||
if( item )
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case LAYER_WIRE:
|
||||
item = PickStruct( pos, screen->EEDrawList, RACCORDITEM | JUNCTIONITEM );
|
||||
item = PickStruct( pos, screen, RACCORDITEM | JUNCTIONITEM );
|
||||
if( item )
|
||||
return TRUE;
|
||||
|
||||
|
@ -820,17 +830,17 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
item = PickStruct( pos, screen->EEDrawList, WIREITEM );
|
||||
item = PickStruct( pos, screen, WIREITEM );
|
||||
if( item )
|
||||
return TRUE;
|
||||
|
||||
item = PickStruct( pos, screen->EEDrawList, LABELITEM );
|
||||
item = PickStruct( pos, screen, LABELITEM );
|
||||
if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE)
|
||||
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x )
|
||||
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) )
|
||||
return TRUE;
|
||||
|
||||
pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList );
|
||||
pinsheet = LocateAnyPinSheet( pos, screen );
|
||||
if( pinsheet && !IsBusLabel( pinsheet->m_Text ) )
|
||||
{
|
||||
itempos = pinsheet->m_Pos;
|
||||
|
@ -861,14 +871,14 @@ bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos )
|
|||
* - a pin is on location pos
|
||||
*/
|
||||
{
|
||||
if( PickStruct( pos, frame->GetScreen()->EEDrawList, JUNCTIONITEM ) )
|
||||
if( PickStruct( pos, frame->GetScreen(), JUNCTIONITEM ) )
|
||||
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;
|
||||
if( frame->LocatePinEnd( frame->GetScreen()->EEDrawList, pos ) )
|
||||
if( frame->LocatePinEnd( frame->GetScreen(), pos ) )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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 */
|
||||
}
|
|
@ -1,7 +1,3 @@
|
|||
/**********************************************************/
|
||||
/* EECLASS.CPP */
|
||||
/* fonctions relatives aux classes definies dans EESCHEMA */
|
||||
/**********************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -24,6 +20,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
|
|||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
case DRAW_SEGMENT_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 )
|
||||
{
|
||||
Pnext = frame->m_CurrentScreen->EEDrawList;
|
||||
frame->m_CurrentScreen->EEDrawList = this;
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*)frame->GetScreen();
|
||||
if(!screen->CheckIfOnDrawList(this)) //don't want a loop!
|
||||
screen->AddToDrawList(this);
|
||||
g_ItemToRepeat = this;
|
||||
if( frame->m_Ident == SCHEMATIC_FRAME )
|
||||
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_NEW );
|
||||
|
@ -91,6 +89,9 @@ SCH_SCREEN::SCH_SCREEN( int screentype, KICAD_T aType ) :
|
|||
SetZoomList( table_zoom );
|
||||
SetGridList( g_GridList );
|
||||
m_UndoRedoCountMax = 10;
|
||||
m_RefCount = 0;
|
||||
m_ScreenNumber = 1;
|
||||
m_NumberOfScreen = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,8 +117,9 @@ void SCH_SCREEN::FreeDrawList()
|
|||
{
|
||||
DrawStruct = EEDrawList;
|
||||
EEDrawList = EEDrawList->Pnext;
|
||||
delete DrawStruct;
|
||||
SAFE_DELETE(DrawStruct);
|
||||
}
|
||||
EEDrawList = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,7 +136,7 @@ void SCH_SCREEN::RemoveFromDrawList( EDA_BaseStruct* DrawStruct )
|
|||
else
|
||||
{
|
||||
EDA_BaseStruct* DrawList = EEDrawList;
|
||||
while( DrawList->Pnext )
|
||||
while( DrawList && DrawList->Pnext )
|
||||
{
|
||||
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 */
|
||||
/*********************************************************************/
|
||||
|
||||
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()
|
||||
/*****************************************/
|
||||
{
|
||||
m_Index = 0;
|
||||
if( m_List )
|
||||
return *m_List;
|
||||
else
|
||||
return NULL;
|
||||
if(m_List.GetCount() > 0)
|
||||
return m_List[0];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************/
|
||||
SCH_SCREEN* EDA_ScreenList::GetNext()
|
||||
/*****************************************/
|
||||
{
|
||||
if( m_Index < m_Count )
|
||||
if( m_Index < m_List.GetCount() )
|
||||
m_Index++;
|
||||
|
||||
if( (m_Index < m_Count) && m_List )
|
||||
{
|
||||
return m_List[m_Index];
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
return GetScreen(m_Index);
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
SCH_SCREEN* EDA_ScreenList::GetScreen( int index )
|
||||
SCH_SCREEN* EDA_ScreenList::GetScreen( unsigned int index )
|
||||
/************************************************/
|
||||
|
||||
/* return the m_List[index] item
|
||||
*/
|
||||
{
|
||||
SCH_SCREEN* screen = NULL;
|
||||
if( index < m_List.GetCount() )
|
||||
return m_List[index];
|
||||
return NULL;
|
||||
}
|
||||
/************************************************/
|
||||
void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen )
|
||||
/************************************************/
|
||||
{
|
||||
if(testscreen == NULL) return;
|
||||
for(unsigned int i=0; i< m_List.GetCount(); i++){
|
||||
if(m_List[i] == testscreen)
|
||||
return;
|
||||
}
|
||||
m_List.Add(testscreen);
|
||||
#ifdef DEBUG
|
||||
printf("EDA_ScreenList::AddScreenToList adding %s\n", (const char*)testscreen->m_FileName.mb_str());
|
||||
#endif
|
||||
}
|
||||
/************************************************/
|
||||
void EDA_ScreenList::UpdateScreenNumberAndDate( )
|
||||
/************************************************/
|
||||
{
|
||||
SCH_SCREEN* screen;
|
||||
|
||||
if( (index >= 0) && index < m_Count )
|
||||
screen = m_List[index];
|
||||
wxString date = GenDate();
|
||||
for(int i=0; i<(int)m_List.GetCount(); i++){
|
||||
screen = m_List[i];
|
||||
screen->m_ScreenNumber = i;
|
||||
screen->m_NumberOfScreen = m_List.GetCount();
|
||||
screen->m_Date = date;
|
||||
}
|
||||
}
|
||||
/************************************************************************/
|
||||
void EDA_ScreenList::BuildScreenList(EDA_BaseStruct* s)
|
||||
/************************************************************************/
|
||||
{
|
||||
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 */
|
||||
/*********************************************************************/
|
||||
|
||||
return screen;
|
||||
/*****************************************/
|
||||
DrawSheetList* EDA_SheetList::GetFirst()
|
||||
/*****************************************/
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/**************************************************/
|
||||
void EDA_ScreenList::UpdateSheetNumberAndDate()
|
||||
/**************************************************/
|
||||
|
||||
/* Update the sheet number, the sheet count and the date for all sheets in list
|
||||
/************************************************/
|
||||
DrawSheetList* EDA_SheetList::GetSheet(int index )
|
||||
/************************************************/
|
||||
/* return the m_List[index] item
|
||||
*/
|
||||
{
|
||||
int SheetNumber = 1;
|
||||
SCH_SCREEN* screen;
|
||||
wxString sheet_date = GenDate();
|
||||
|
||||
for( screen = GetFirst(); screen != NULL; screen = GetNext() )
|
||||
{
|
||||
screen->m_SheetNumber = SheetNumber++; /* Update the sheet number */
|
||||
screen->m_NumberOfSheet = m_Count; /* Update the number of sheets */
|
||||
screen->m_Date = sheet_date; /* Update the sheet date */
|
||||
}
|
||||
if( index < m_count )
|
||||
return &(m_List[index]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
SCH_SCREEN** EDA_ScreenList::BuildScreenList( SCH_SCREEN** ScreenList,
|
||||
EDA_BaseStruct* DrawStruct, int* Count )
|
||||
void EDA_SheetList::BuildSheetList(DrawSheetStruct* sheet)
|
||||
/************************************************************************/
|
||||
|
||||
/* Count the Hierachical sheet number (ScreenList == NULL )
|
||||
* or fill the screen pointer buffer (ScreenList != NULL )
|
||||
* If DrawStruct = NULL, search starts from Root screen, and puts root screen in list
|
||||
* Recursive function !
|
||||
*/
|
||||
{
|
||||
bool HasSubhierarchy = FALSE;
|
||||
EDA_BaseStruct* CurrStruct;
|
||||
|
||||
if( *Count > NB_MAX_SHEET )
|
||||
{
|
||||
return ScreenList;
|
||||
}
|
||||
|
||||
/* Read the current list and put Screen pointers in list */
|
||||
if( DrawStruct == NULL )
|
||||
{
|
||||
DrawStruct = ScreenSch->EEDrawList;
|
||||
if( ScreenList )
|
||||
{
|
||||
*ScreenList = ScreenSch;
|
||||
ScreenList++;
|
||||
}
|
||||
else
|
||||
(*Count)++;
|
||||
}
|
||||
|
||||
CurrStruct = DrawStruct;
|
||||
while( CurrStruct )
|
||||
{
|
||||
if( CurrStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
HasSubhierarchy = TRUE;
|
||||
if( ScreenList )
|
||||
{
|
||||
*ScreenList = (SCH_SCREEN*) CurrStruct;
|
||||
ScreenList++;
|
||||
}
|
||||
else
|
||||
(*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;
|
||||
if(m_List == NULL){
|
||||
int count = sheet->CountSheets();
|
||||
m_count = count;
|
||||
m_index = 0;
|
||||
if(m_List) free(m_List); m_List = NULL;
|
||||
count *= sizeof(DrawSheetList);
|
||||
m_List = (DrawSheetList*)MyZMalloc(count);
|
||||
memset((void*)m_List, 0, count);
|
||||
m_currList.Clear();
|
||||
}
|
||||
m_currList.Push(sheet);
|
||||
m_List[m_index] = m_currList;
|
||||
m_index++;
|
||||
if(sheet->m_s != NULL){
|
||||
EDA_BaseStruct* strct = m_currList.LastDrawList();
|
||||
while(strct){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* sht = (DrawSheetStruct*)strct;
|
||||
BuildSheetList(sht);
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
}
|
||||
m_currList.Pop();
|
||||
}
|
||||
|
|
|
@ -83,11 +83,16 @@ extern int* TemplateShape[5][4];
|
|||
|
||||
/* Forward declarations */
|
||||
class DrawSheetStruct;
|
||||
extern DrawSheetStruct* g_RootSheet;
|
||||
|
||||
|
||||
class SCH_SCREEN : public BASE_SCREEN
|
||||
{
|
||||
public:
|
||||
int m_RefCount; //how many sheets reference this screen?
|
||||
//delete when it goes to zero.
|
||||
int m_ScreenNumber;
|
||||
int m_NumberOfScreen;
|
||||
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
|
||||
~SCH_SCREEN();
|
||||
|
||||
|
@ -100,6 +105,8 @@ public:
|
|||
|
||||
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
|
||||
void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */
|
||||
bool CheckIfOnDrawList( EDA_BaseStruct* st );
|
||||
void AddToDrawList( EDA_BaseStruct* DrawStruct );
|
||||
void ClearUndoORRedoList( EDA_BaseStruct* List );
|
||||
|
||||
bool SchematicCleanUp( wxDC* DC = NULL );
|
||||
|
@ -117,7 +124,7 @@ class DrawSheetLabelStruct : public EDA_BaseStruct, public EDA_TextStruct
|
|||
public:
|
||||
int m_Layer;
|
||||
int m_Edge, m_Shape;
|
||||
bool m_IsDangling; // TRUE si non connecté
|
||||
bool m_IsDangling; // TRUE si non connect<EFBFBD>
|
||||
|
||||
public:
|
||||
DrawSheetLabelStruct( DrawSheetStruct* parent,
|
||||
|
@ -140,20 +147,25 @@ public:
|
|||
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:
|
||||
wxString m_SheetName;
|
||||
int m_SheetNameSize;
|
||||
wxString m_SheetName; //this is equivalent to C101 for components:
|
||||
// it is stored in F0 ... of the file.
|
||||
wxString m_FileName; //also in SCH_SCREEN (redundant),
|
||||
//but need it here for loading after
|
||||
//reading the sheet description from file.
|
||||
int m_SheetNameSize;
|
||||
|
||||
// wxString m_FileName; in SCH_SCREEN
|
||||
int m_FileNameSize;
|
||||
wxPoint m_Pos;
|
||||
wxSize m_Size; /* Position and Size of sheet symbol */
|
||||
int m_Layer;
|
||||
DrawSheetLabelStruct* m_Label; /* Points de connection */
|
||||
int m_NbLabel; /* Nombre de points de connexion */
|
||||
int m_FileNameSize;
|
||||
wxPoint m_Pos;
|
||||
wxSize m_Size; /* Position and Size of sheet symbol */
|
||||
int m_Layer;
|
||||
DrawSheetLabelStruct* m_Label; /* Points de connection, linked list.*/
|
||||
int m_NbLabel; /* Nombre de points de connexion */
|
||||
SCH_SCREEN* m_s;
|
||||
|
||||
public:
|
||||
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||
|
@ -169,30 +181,95 @@ public:
|
|||
void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color = -1 );
|
||||
void SwapData( DrawSheetStruct* copyitem );
|
||||
void 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
|
||||
{
|
||||
private:
|
||||
int m_Count;
|
||||
SCH_SCREEN** m_List;
|
||||
int m_Index;
|
||||
ScreenGrowArray m_List;
|
||||
unsigned int m_Index;
|
||||
|
||||
public:
|
||||
EDA_ScreenList( EDA_BaseStruct* DrawStruct );
|
||||
~EDA_ScreenList();
|
||||
int GetCount() { return m_Count; }
|
||||
EDA_ScreenList(){
|
||||
m_Index = 0;
|
||||
BuildScreenList(g_RootSheet);
|
||||
}
|
||||
~EDA_ScreenList() {}
|
||||
int GetCount() { return m_List.GetCount(); }
|
||||
SCH_SCREEN* GetFirst();
|
||||
SCH_SCREEN* GetNext();
|
||||
SCH_SCREEN* GetScreen( int index );
|
||||
void UpdateSheetNumberAndDate();
|
||||
SCH_SCREEN* GetScreen( unsigned int index );
|
||||
void UpdateScreenNumberAndDate();
|
||||
|
||||
private:
|
||||
SCH_SCREEN** BuildScreenList( SCH_SCREEN** ScreenList,
|
||||
EDA_BaseStruct* DrawStruct, int* Count );
|
||||
void AddScreenToList( SCH_SCREEN* testscreen );
|
||||
void BuildScreenList( EDA_BaseStruct* sheet );
|
||||
};
|
||||
|
||||
#endif /* CLASS_SCREEN_H */
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
/* class DrawTextStruct */
|
||||
/* class DrawLabelStruct */
|
||||
/* class DrawGlobalLabelStruct */
|
||||
/* class DrawHierLabelStruct */
|
||||
/************************/
|
||||
|
||||
/**************************************************************************/
|
||||
|
@ -47,9 +48,13 @@ DrawTextStruct* DrawTextStruct::GenCopy()
|
|||
break;
|
||||
|
||||
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;
|
||||
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
newitem = new DrawLabelStruct( m_Pos, m_Text );
|
||||
break;
|
||||
|
@ -102,8 +107,7 @@ void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
|
|||
/* restore new values */
|
||||
SwapData( (DrawTextStruct*) g_ItemToUndoCopy );
|
||||
|
||||
delete g_ItemToUndoCopy;
|
||||
g_ItemToUndoCopy = NULL;
|
||||
SAFE_DELETE( g_ItemToUndoCopy );
|
||||
}
|
||||
|
||||
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 )
|
||||
/***********************************************************************************/
|
||||
{
|
||||
m_Layer = LAYER_GLOBLABEL;
|
||||
m_Shape = NET_INPUT;
|
||||
m_Layer = LAYER_GLOBLABEL;
|
||||
m_Shape = NET_BIDI;
|
||||
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,
|
||||
|
@ -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 )
|
||||
/******************************************************************************************/
|
||||
|
||||
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
|
||||
*/
|
||||
{
|
||||
|
@ -214,46 +226,45 @@ void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoi
|
|||
wxSize Size = m_Size;
|
||||
int width = MAX( m_Width, g_DrawMinimunLineWidth );
|
||||
|
||||
if( Color >= 0 )
|
||||
color = Color;
|
||||
else
|
||||
color = ReturnLayerColor( m_Layer );
|
||||
if( Color >= 0 )
|
||||
color = Color;
|
||||
else
|
||||
color = ReturnLayerColor( m_Layer );
|
||||
|
||||
GRSetDrawMode( DC, DrawMode );
|
||||
GRSetDrawMode( DC, DrawMode );
|
||||
|
||||
HalfSize = Size.x / 2; ii = Size.x + TXTMARGE;
|
||||
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;
|
||||
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 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;
|
||||
}
|
||||
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];
|
||||
|
||||
|
@ -271,3 +282,74 @@ void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoi
|
|||
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];
|
||||
|
||||
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 );
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
|
|||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
case DRAW_PICK_ITEM_STRUCT_TYPE:
|
||||
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
|
||||
#include "macros.h"
|
||||
|
||||
|
||||
#include <wx/arrimpl.cpp>
|
||||
WX_DEFINE_OBJARRAY(ArrayOfSheetLists);
|
||||
/***************************/
|
||||
/* class DrawPartStruct */
|
||||
/* class EDA_SchComponentStruct */
|
||||
|
@ -88,6 +89,71 @@ const wxString& EDA_SchComponentStruct::ReturnFieldName( int aFieldNdx ) const
|
|||
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
|
||||
{
|
||||
|
@ -109,8 +175,8 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) :
|
|||
int ii;
|
||||
|
||||
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) */
|
||||
|
||||
/* 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_PinIsDangling = NULL;
|
||||
|
||||
m_PrefixString = wxString(_("U"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,8 +251,6 @@ EDA_Rect EDA_SchComponentStruct::GetBoundaryBox()
|
|||
BoundaryBox.Offset( m_Pos );
|
||||
return BoundaryBox;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
void PartTextStruct::SwapData( PartTextStruct* copyitem )
|
||||
/**************************************************************************/
|
||||
|
@ -250,8 +316,7 @@ void EDA_SchComponentStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
|
|||
/* restore new values */
|
||||
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy );
|
||||
|
||||
delete g_ItemToUndoCopy;
|
||||
g_ItemToUndoCopy = NULL;
|
||||
SAFE_DELETE( g_ItemToUndoCopy );
|
||||
}
|
||||
|
||||
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)
|
||||
*/
|
||||
{
|
||||
m_RefIdNumber = 0;
|
||||
|
||||
while( isdigit( m_Field[REFERENCE].m_Text.Last() ) )
|
||||
m_Field[REFERENCE].m_Text.RemoveLast();
|
||||
|
||||
if( m_Field[REFERENCE].m_Text.Last() != '?' )
|
||||
m_Field[REFERENCE].m_Text.Append( '?' );
|
||||
wxString defRef = m_PrefixString;
|
||||
defRef.Append( _("?") );
|
||||
m_References.Empty();
|
||||
unsigned int i;
|
||||
for(i=0; i< m_Paths.GetCount(); i++){
|
||||
m_References.Add(defRef);
|
||||
}
|
||||
|
||||
EDA_LibComponentStruct* Entry;
|
||||
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_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_Transform[0][0] = m_Transform[0][0];
|
||||
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 )
|
||||
/***********************************************************************/
|
||||
|
||||
/* 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).
|
||||
* 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;
|
||||
|
@ -548,7 +614,7 @@ void EDA_SchComponentStruct::Show( int nestLevel, std::ostream& os )
|
|||
{
|
||||
// for now, make it look like XML:
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
||||
" ref=\"" << GetReference().mb_str() << '"' <<
|
||||
" ref=\"" << ReturnFieldName(0) << '"' <<
|
||||
" chipName=\"" << m_ChipName.mb_str() << '"' <<
|
||||
m_Pos <<
|
||||
" layer=\"" << m_Layer << '"' <<
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
|
||||
#include "macros.h"
|
||||
#include "base_struct.h"
|
||||
|
||||
#include <wx/arrstr.h>
|
||||
#include "class_screen.h"
|
||||
#include <wx/dynarray.h>
|
||||
|
||||
/* Definition de la representation du composant */
|
||||
#define NUMBER_OF_FIELDS 12 /* Nombre de champs de texte affectes au composant */
|
||||
enum NumFieldType {
|
||||
REFERENCE = 0, /* Champ Reference of part, i.e. "IC21" */
|
||||
VALUE, /* Champ Value of part, i.e. "3.3K" */
|
||||
|
@ -27,7 +28,8 @@ enum NumFieldType {
|
|||
FIELD5,
|
||||
FIELD6,
|
||||
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
|
||||
* 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
|
||||
*/
|
||||
class DrawPartStruct : public EDA_BaseStruct
|
||||
|
@ -83,27 +85,26 @@ public:
|
|||
{
|
||||
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 */
|
||||
class EDA_SchComponentStruct : public DrawPartStruct
|
||||
{
|
||||
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_FlagControlMulti;
|
||||
int m_Convert; /* Gestion des mutiples representations (ex: conversion De Morgan) */
|
||||
//int m_FlagControlMulti;
|
||||
ArrayOfSheetLists m_UsedOnSheets;
|
||||
int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
|
||||
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
|
||||
bool* m_PinIsDangling; // liste des indicateurs de pin non connectee
|
||||
|
||||
wxArrayString m_Paths; // /sheet1/C102, /sh2/sh1/U32 etc.
|
||||
wxArrayString m_References; // C102, U32 etc.
|
||||
wxString m_PrefixString; //C, R, U, Q etc - the first character which typically indicates what the component is.
|
||||
//determined, upon placement, from the library component.
|
||||
//determined, upon file load, by the first non-digits in the reference fields.
|
||||
|
||||
public:
|
||||
EDA_SchComponentStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||
~EDA_SchComponentStruct( void ) { }
|
||||
|
@ -143,6 +144,12 @@ public:
|
|||
|
||||
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)
|
||||
/**
|
||||
* Function Show
|
||||
|
|
|
@ -60,7 +60,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
|
|||
break;
|
||||
|
||||
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 )
|
||||
break; // Priority is probing a pin first
|
||||
LibItem = (EDA_SchComponentStruct*) DrawStruct;
|
||||
|
@ -68,7 +68,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
|
|||
break;
|
||||
|
||||
default:
|
||||
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, GetScreen()->m_Curseur, &LibItem );
|
||||
Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, &LibItem );
|
||||
break;
|
||||
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
|
@ -82,7 +82,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
|
|||
Pin->Display_Infos( this );
|
||||
if( LibItem )
|
||||
Affiche_1_Parametre( this, 1,
|
||||
LibItem->m_Field[REFERENCE].m_Text,
|
||||
LibItem->GetRef(GetSheet()),
|
||||
LibItem->m_Field[VALUE].m_Text,
|
||||
CYAN );
|
||||
|
||||
|
@ -121,7 +121,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
|
|||
wxString msg;
|
||||
int ii;
|
||||
|
||||
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, MARKERITEM );
|
||||
DrawStruct = PickStruct( refpoint, GetScreen(), MARKERITEM );
|
||||
if( DrawStruct )
|
||||
{
|
||||
DrawMarkerStruct* Marker = (DrawMarkerStruct*) DrawStruct;
|
||||
|
@ -134,7 +134,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
|
|||
return DrawStruct;
|
||||
}
|
||||
|
||||
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList,
|
||||
DrawStruct = PickStruct( refpoint, GetScreen(),
|
||||
NOCONNECTITEM );
|
||||
if( DrawStruct )
|
||||
{
|
||||
|
@ -142,7 +142,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
|
|||
return DrawStruct;
|
||||
}
|
||||
|
||||
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList,
|
||||
DrawStruct = PickStruct( refpoint, GetScreen(),
|
||||
JUNCTIONITEM );
|
||||
if( DrawStruct )
|
||||
{
|
||||
|
@ -150,17 +150,17 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
|
|||
return DrawStruct;
|
||||
}
|
||||
|
||||
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList,
|
||||
DrawStruct = PickStruct( refpoint, GetScreen(),
|
||||
WIREITEM | BUSITEM | RACCORDITEM );
|
||||
if( DrawStruct ) // Search for a pin
|
||||
{
|
||||
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, refpoint, &LibItem );
|
||||
Pin = LocateAnyPin( m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
|
||||
if( Pin )
|
||||
{
|
||||
Pin->Display_Infos( this );
|
||||
if( LibItem )
|
||||
Affiche_1_Parametre( this, 1,
|
||||
LibItem->m_Field[REFERENCE].m_Text,
|
||||
LibItem->GetRef(GetSheet()),
|
||||
LibItem->m_Field[VALUE].m_Text,
|
||||
CYAN );
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
|
|||
return DrawStruct;
|
||||
}
|
||||
|
||||
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, FIELDCMPITEM );
|
||||
DrawStruct = PickStruct( refpoint, GetScreen(), FIELDCMPITEM );
|
||||
if( DrawStruct )
|
||||
{
|
||||
PartTextStruct* Field = (PartTextStruct*) DrawStruct;
|
||||
|
@ -180,29 +180,29 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
|
|||
}
|
||||
|
||||
/* search for a pin */
|
||||
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, refpoint, &LibItem );
|
||||
Pin = LocateAnyPin( m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
|
||||
if( Pin )
|
||||
{
|
||||
Pin->Display_Infos( this );
|
||||
if( LibItem )
|
||||
Affiche_1_Parametre( this, 1,
|
||||
LibItem->m_Field[REFERENCE].m_Text,
|
||||
LibItem->GetRef(GetSheet()),
|
||||
LibItem->m_Field[VALUE].m_Text,
|
||||
CYAN );
|
||||
if( IncludePin == TRUE )
|
||||
return LibItem;
|
||||
}
|
||||
|
||||
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, LIBITEM );
|
||||
DrawStruct = PickStruct( refpoint, GetScreen(), LIBITEM );
|
||||
if( DrawStruct )
|
||||
{
|
||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
|
||||
LibItem = (EDA_SchComponentStruct*) DrawStruct;
|
||||
LibItem->Display_Infos( this );
|
||||
return DrawStruct;
|
||||
}
|
||||
|
||||
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList,
|
||||
DrawStruct = PickStruct( refpoint, GetScreen(),
|
||||
SHEETITEM );
|
||||
if( DrawStruct )
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
|
|||
}
|
||||
|
||||
// Recherche des autres elements
|
||||
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList,
|
||||
DrawStruct = PickStruct( refpoint, GetScreen(),
|
||||
SEARCHALL );
|
||||
if( DrawStruct )
|
||||
{
|
||||
|
@ -228,17 +228,16 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
|
|||
/***********************************************************************/
|
||||
{
|
||||
wxSize delta;
|
||||
int zoom = m_CurrentScreen->GetZoom();
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*)GetScreen();
|
||||
int zoom = screen->GetZoom();
|
||||
wxPoint curpos, oldpos;
|
||||
int hotkey = 0;
|
||||
|
||||
ActiveScreen = (SCH_SCREEN*) m_CurrentScreen;
|
||||
curpos = screen->m_MousePosition;
|
||||
oldpos = screen->m_Curseur;
|
||||
|
||||
curpos = m_CurrentScreen->m_MousePosition;
|
||||
oldpos = m_CurrentScreen->m_Curseur;
|
||||
|
||||
delta.x = m_CurrentScreen->GetGrid().x / zoom;
|
||||
delta.y = m_CurrentScreen->GetGrid().y / zoom;
|
||||
delta.x = screen->GetGrid().x / zoom;
|
||||
delta.y = screen->GetGrid().y / zoom;
|
||||
|
||||
if( delta.x <= 0 )
|
||||
delta.x = 1;
|
||||
|
@ -252,37 +251,37 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
|
|||
|
||||
case EDA_PANNING_UP_KEY:
|
||||
OnZoom( ID_ZOOM_PANNING_UP );
|
||||
curpos = m_CurrentScreen->m_Curseur;
|
||||
curpos = screen->m_Curseur;
|
||||
break;
|
||||
|
||||
case EDA_PANNING_DOWN_KEY:
|
||||
OnZoom( ID_ZOOM_PANNING_DOWN );
|
||||
curpos = m_CurrentScreen->m_Curseur;
|
||||
curpos = screen->m_Curseur;
|
||||
break;
|
||||
|
||||
case EDA_PANNING_LEFT_KEY:
|
||||
OnZoom( ID_ZOOM_PANNING_LEFT );
|
||||
curpos = m_CurrentScreen->m_Curseur;
|
||||
curpos = screen->m_Curseur;
|
||||
break;
|
||||
|
||||
case EDA_PANNING_RIGHT_KEY:
|
||||
OnZoom( ID_ZOOM_PANNING_RIGHT );
|
||||
curpos = m_CurrentScreen->m_Curseur;
|
||||
curpos = screen->m_Curseur;
|
||||
break;
|
||||
|
||||
case EDA_ZOOM_IN_FROM_MOUSE:
|
||||
OnZoom( ID_ZOOM_PLUS_KEY );
|
||||
curpos = m_CurrentScreen->m_Curseur;
|
||||
curpos = screen->m_Curseur;
|
||||
break;
|
||||
|
||||
case EDA_ZOOM_OUT_FROM_MOUSE:
|
||||
OnZoom( ID_ZOOM_MOINS_KEY );
|
||||
curpos = m_CurrentScreen->m_Curseur;
|
||||
curpos = screen->m_Curseur;
|
||||
break;
|
||||
|
||||
case EDA_ZOOM_CENTER_FROM_MOUSE:
|
||||
OnZoom( ID_ZOOM_CENTER_KEY );
|
||||
curpos = m_CurrentScreen->m_Curseur;
|
||||
curpos = screen->m_Curseur;
|
||||
break;
|
||||
|
||||
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 */
|
||||
m_CurrentScreen->m_Curseur = curpos;
|
||||
screen->m_Curseur = curpos;
|
||||
|
||||
/* Placement sur la grille generale */
|
||||
PutOnGrid( &m_CurrentScreen->m_Curseur );
|
||||
PutOnGrid( &(screen->m_Curseur) );
|
||||
|
||||
if( m_CurrentScreen->IsRefreshReq() )
|
||||
if( screen->IsRefreshReq() )
|
||||
{
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
}
|
||||
|
||||
if( oldpos != m_CurrentScreen->m_Curseur )
|
||||
if( oldpos != screen->m_Curseur )
|
||||
{
|
||||
curpos = m_CurrentScreen->m_Curseur;
|
||||
m_CurrentScreen->m_Curseur = oldpos;
|
||||
curpos = screen->m_Curseur;
|
||||
screen->m_Curseur = oldpos;
|
||||
DrawPanel->CursorOff( DC );
|
||||
m_CurrentScreen->m_Curseur = curpos;
|
||||
GetScreen()->m_Curseur = curpos;
|
||||
DrawPanel->CursorOn( DC );
|
||||
|
||||
if( DrawPanel->ManageCurseur )
|
||||
|
@ -341,9 +340,9 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
|
|||
|
||||
if( hotkey )
|
||||
{
|
||||
if( m_CurrentScreen->GetCurItem()
|
||||
&& m_CurrentScreen->GetCurItem()->m_Flags )
|
||||
OnHotKey( DC, hotkey, m_CurrentScreen->GetCurItem() );
|
||||
if( screen->GetCurItem()
|
||||
&& screen->GetCurItem()->m_Flags )
|
||||
OnHotKey( DC, hotkey, screen->GetCurItem() );
|
||||
else
|
||||
OnHotKey( DC, hotkey, NULL );
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
|
|||
for( DanglingItem = ItemList; DanglingItem != NULL; DanglingItem = nextitem )
|
||||
{
|
||||
nextitem = DanglingItem->m_Pnext;
|
||||
delete DanglingItem;
|
||||
SAFE_DELETE( DanglingItem );
|
||||
}
|
||||
|
||||
ItemList = RebuildEndList( DrawList );
|
||||
|
@ -109,6 +109,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
|
|||
switch( DrawItem->Type() )
|
||||
{
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawLabelStruct*) DrawItem )
|
||||
|
@ -146,7 +147,7 @@ LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( EDA_BaseStruct* DrawList,
|
|||
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
|
||||
* NULL sinon
|
||||
*/
|
||||
|
@ -280,7 +281,7 @@ wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin,
|
|||
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 */
|
||||
{
|
||||
wxPoint PinPos = Pin->m_Pos;
|
||||
|
@ -316,8 +317,9 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
|||
break;
|
||||
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawGlobalLabelStruct*) DrawItem )
|
||||
#define STRUCT ( (DrawLabelStruct*) DrawItem )
|
||||
item = new DanglingEndHandle( LABEL_END );
|
||||
|
||||
item->m_Item = DrawItem;
|
||||
|
|
|
@ -116,24 +116,28 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
|
|||
for(DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct=DelStruct->Pnext)
|
||||
DelStruct->m_Flags = 0;
|
||||
|
||||
BreakSegmentOnJunction( GetScreen() );
|
||||
BreakSegmentOnJunction( (SCH_SCREEN*)GetScreen() );
|
||||
DelStruct = GetScreen()->EEDrawList;
|
||||
|
||||
/* Locate all the wires, bus or junction under the mouse cursor, and put them in a list
|
||||
of items to delete
|
||||
*/
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*)GetScreen();
|
||||
EDA_BaseStruct* savedEEDrawList = screen->EEDrawList;
|
||||
while ( DelStruct &&
|
||||
(DelStruct = PickStruct(GetScreen()->m_Curseur,
|
||||
DelStruct, JUNCTIONITEM|WIREITEM|BUSITEM)) != NULL )
|
||||
(DelStruct = PickStruct(screen->m_Curseur,
|
||||
screen, JUNCTIONITEM|WIREITEM|BUSITEM)) != NULL )
|
||||
{
|
||||
|
||||
DelStruct->m_Flags = SELECTEDNODE|STRUCT_DELETED;
|
||||
/* Put this structure in the picked list: */
|
||||
PickedItem = new DrawPickedStruct(DelStruct);
|
||||
PickedItem->Pnext = PickedList;
|
||||
PickedList = PickedItem;
|
||||
DelStruct=DelStruct->Pnext;
|
||||
screen->EEDrawList = DelStruct;
|
||||
}
|
||||
|
||||
GetScreen()->EEDrawList = savedEEDrawList;
|
||||
/* Mark all wires, junctions, .. connected to one of the item to delete
|
||||
*/
|
||||
if ( DeleteFullConnection )
|
||||
|
@ -224,7 +228,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
|
|||
if ( DelStruct->Type() != DRAW_LABEL_STRUCT_TYPE ) continue;
|
||||
GetScreen()->m_Curseur = ((DrawTextStruct*)DelStruct)->m_Pos;
|
||||
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 )
|
||||
{
|
||||
DelStruct->m_Flags |= STRUCT_DELETED;
|
||||
|
@ -267,33 +271,33 @@ bool LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC)
|
|||
*/
|
||||
{
|
||||
EDA_BaseStruct * DelStruct;
|
||||
SCH_SCREEN * screen = frame->GetScreen();
|
||||
SCH_SCREEN * screen = (SCH_SCREEN*)(frame->GetScreen());
|
||||
bool item_deleted = FALSE;
|
||||
|
||||
DelStruct = PickStruct(screen->m_Curseur,
|
||||
screen->EEDrawList, MARKERITEM);
|
||||
screen, MARKERITEM);
|
||||
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
|
||||
screen->EEDrawList, JUNCTIONITEM);
|
||||
screen, JUNCTIONITEM);
|
||||
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
|
||||
screen->EEDrawList, NOCONNECTITEM);
|
||||
screen, NOCONNECTITEM);
|
||||
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
|
||||
screen->EEDrawList, RACCORDITEM);
|
||||
screen, RACCORDITEM);
|
||||
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
|
||||
screen->EEDrawList, WIREITEM|BUSITEM);
|
||||
screen, WIREITEM|BUSITEM);
|
||||
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
|
||||
screen->EEDrawList, DRAWITEM);
|
||||
screen, DRAWITEM);
|
||||
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
|
||||
screen->EEDrawList, TEXTITEM|LABELITEM);
|
||||
screen, TEXTITEM|LABELITEM);
|
||||
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
|
||||
screen->EEDrawList, LIBITEM);
|
||||
screen, LIBITEM);
|
||||
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
|
||||
screen->EEDrawList, SHEETITEM);
|
||||
screen, SHEETITEM);
|
||||
|
||||
if (DelStruct)
|
||||
{
|
||||
g_ItemToRepeat = NULL;
|
||||
DeleteStruct(frame->DrawPanel, DC, DelStruct);
|
||||
frame->TestDanglingEnds(frame->m_CurrentScreen->EEDrawList, DC);
|
||||
frame->TestDanglingEnds(frame->GetScreen()->EEDrawList, DC);
|
||||
frame->GetScreen()->SetModify();
|
||||
item_deleted = TRUE;
|
||||
}
|
||||
|
@ -331,6 +335,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
|
|||
if (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE)
|
||||
{ /* Cette stucture est rattachee a une feuille, et n'est pas
|
||||
accessible par la liste globale directement */
|
||||
//this structure has a sheet attached, which we must find.
|
||||
DrawList = Screen->EEDrawList;
|
||||
for ( ; DrawList != NULL; DrawList = DrawList->Pnext )
|
||||
{
|
||||
|
@ -342,7 +347,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
|
|||
{
|
||||
((DrawSheetStruct *) DrawList)->m_Label =
|
||||
(DrawSheetLabelStruct *)SheetLabel->Pnext;
|
||||
delete DrawStruct;
|
||||
SAFE_DELETE( DrawStruct );
|
||||
return;
|
||||
}
|
||||
else while( SheetLabel->Pnext )/* Examen de la liste dependante */
|
||||
|
@ -351,7 +356,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
|
|||
if( NextLabel == (DrawSheetLabelStruct*) DrawStruct )
|
||||
{
|
||||
SheetLabel->Pnext = (EDA_BaseStruct *)NextLabel->Pnext;
|
||||
delete DrawStruct;
|
||||
SAFE_DELETE( DrawStruct );
|
||||
return;
|
||||
}
|
||||
SheetLabel = NextLabel;
|
||||
|
@ -360,7 +365,6 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if (DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE)
|
||||
{
|
||||
PickedList = (DrawPickedStruct *) DrawStruct;
|
||||
|
@ -369,7 +373,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
|
|||
if (PickedList->m_PickedStruct == Screen->EEDrawList)
|
||||
{
|
||||
Screen->EEDrawList = Screen->EEDrawList->Pnext;
|
||||
delete DrawStruct;
|
||||
SAFE_DELETE( DrawStruct );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -379,7 +383,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
|
|||
if (DrawList->Pnext == PickedList->m_PickedStruct)
|
||||
{
|
||||
DrawList->Pnext = DrawList->Pnext->Pnext;
|
||||
delete DrawStruct;
|
||||
SAFE_DELETE( DrawStruct );
|
||||
return;
|
||||
}
|
||||
DrawList = DrawList->Pnext;
|
||||
|
@ -393,7 +397,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
|
|||
if (DrawStruct == Screen->EEDrawList)
|
||||
{
|
||||
Screen->EEDrawList = DrawStruct->Pnext;
|
||||
delete DrawStruct;
|
||||
SAFE_DELETE( DrawStruct );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -403,7 +407,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
|
|||
if (DrawList->Pnext == DrawStruct)
|
||||
{
|
||||
DrawList->Pnext = DrawStruct->Pnext;
|
||||
delete DrawStruct;
|
||||
SAFE_DELETE( DrawStruct );
|
||||
return;
|
||||
}
|
||||
DrawList = DrawList->Pnext;
|
||||
|
@ -423,7 +427,7 @@ SCH_SCREEN * screen;
|
|||
EDA_BaseStruct * DrawStruct, * NextStruct;
|
||||
DrawMarkerStruct * Marker;
|
||||
|
||||
EDA_ScreenList ScreenList(NULL);
|
||||
EDA_ScreenList ScreenList;
|
||||
for ( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
for ( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct)
|
||||
|
@ -471,7 +475,7 @@ LibEDA_BaseStruct *PreviousDrawItem;
|
|||
if( LibEntry->m_Drawings == DrawItem )
|
||||
{
|
||||
LibEntry->m_Drawings = DrawItem->Next();
|
||||
delete DrawItem;
|
||||
SAFE_DELETE( DrawItem );
|
||||
}
|
||||
|
||||
else /* Cas des autres items */
|
||||
|
@ -480,7 +484,7 @@ LibEDA_BaseStruct *PreviousDrawItem;
|
|||
if(PreviousDrawItem->Pnext == DrawItem)
|
||||
{
|
||||
PreviousDrawItem->Pnext = DrawItem->Pnext;
|
||||
delete DrawItem; break;
|
||||
SAFE_DELETE( DrawItem ); break;
|
||||
}
|
||||
PreviousDrawItem = PreviousDrawItem->Next();
|
||||
}
|
||||
|
@ -488,7 +492,7 @@ LibEDA_BaseStruct *PreviousDrawItem;
|
|||
|
||||
else /* Structure non reliee a un composant */
|
||||
{
|
||||
delete DrawItem;
|
||||
SAFE_DELETE( DrawItem );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,37 +37,40 @@ wxString msg;
|
|||
}
|
||||
|
||||
/* 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?"),
|
||||
FirstSheet->m_SheetName.GetData(),
|
||||
FirstSheet->m_FileName.GetData());
|
||||
if( IsOK(NULL, msg) )
|
||||
{
|
||||
frame->SaveEEFile(FirstSheet, FILE_SAVE_AS);
|
||||
frame->SaveEEFile(FirstSheet->m_s, FILE_SAVE_AS);
|
||||
}
|
||||
}
|
||||
|
||||
/* free the sub hierarchy */
|
||||
EEDrawList = FirstSheet->EEDrawList;
|
||||
while (EEDrawList != NULL)
|
||||
{
|
||||
DrawStruct = EEDrawList;
|
||||
EEDrawList = EEDrawList->Pnext;
|
||||
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE)
|
||||
if(FirstSheet->m_s){
|
||||
EEDrawList = FirstSheet->m_s->EEDrawList;
|
||||
while (EEDrawList != NULL)
|
||||
{
|
||||
DeleteSubHierarchy((DrawSheetStruct *) DrawStruct, confirm_deletion);
|
||||
DrawStruct = EEDrawList;
|
||||
EEDrawList = EEDrawList->Pnext;
|
||||
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE)
|
||||
{
|
||||
DeleteSubHierarchy((DrawSheetStruct *) DrawStruct, confirm_deletion);
|
||||
}
|
||||
}
|
||||
/* Effacement des elements de la feuille courante */
|
||||
FirstSheet->m_s->FreeDrawList();
|
||||
}
|
||||
|
||||
/* Effacement des elements de la feuille courante */
|
||||
FirstSheet->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 */
|
||||
//this is redundant -- use FreeDrawList, a member of SCH_SCREEN
|
||||
/*
|
||||
{
|
||||
EDA_BaseStruct *DrawStruct;
|
||||
|
||||
|
@ -84,7 +87,7 @@ EDA_BaseStruct *DrawStruct;
|
|||
delete DrawStruct;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/********************************************************************/
|
||||
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);
|
||||
|
||||
ClearDrawList(screen->EEDrawList, confirm_deletion);
|
||||
screen->EEDrawList = NULL;
|
||||
screen->FreeDrawList();
|
||||
|
||||
/* Clear the screen datas */
|
||||
screen->m_SheetNumber = screen->m_NumberOfSheet = 1;
|
||||
screen->m_ScreenNumber = screen->m_NumberOfScreen = 1;
|
||||
screen->m_Title.Empty();
|
||||
screen->m_Revision.Empty();
|
||||
screen->m_Company.Empty();
|
||||
|
|
|
@ -46,24 +46,16 @@
|
|||
////@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 */
|
||||
static int GenListeGLabels( ListLabel * List );
|
||||
static int ListTriComposantByRef(EDA_SchComponentStruct **Objet1,
|
||||
EDA_SchComponentStruct **Objet2);
|
||||
static int ListTriComposantByVal(EDA_SchComponentStruct **Objet1,
|
||||
EDA_SchComponentStruct **Objet2);
|
||||
int GenListeCmp( ListComponent * List );
|
||||
static int ListTriComposantByRef(ListComponent *Objet1,
|
||||
ListComponent *Objet2);
|
||||
static int ListTriComposantByVal(ListComponent *Objet1,
|
||||
ListComponent *Objet2);
|
||||
static int ListTriGLabelBySheet(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);
|
||||
|
||||
|
@ -552,12 +544,14 @@ wxString mask, filename;
|
|||
else
|
||||
s_ExportSeparatorSymbol = s_ExportSeparator[0];
|
||||
|
||||
m_ListFileName = ScreenSch->m_FileName;
|
||||
m_ListFileName = g_RootSheet->m_s->m_FileName;
|
||||
ChangeFileNameExt(m_ListFileName, EXT_LIST);
|
||||
//need to get rid of the path.
|
||||
m_ListFileName = m_ListFileName.AfterLast('/');
|
||||
mask = wxT("*");
|
||||
mask += EXT_LIST;
|
||||
|
||||
filename = EDA_FileSelector(_("Bill of material:"),
|
||||
filename = EDA_FileSelector(_("Bill of materials:"),
|
||||
wxEmptyString, /* Chemin par defaut (ici dir courante) */
|
||||
m_ListFileName, /* nom fichier par defaut, et resultat */
|
||||
EXT_LIST, /* extension par defaut */
|
||||
|
@ -600,7 +594,7 @@ void WinEDA_Build_BOM_Frame::CreateExportList(const wxString & FullFileName)
|
|||
*/
|
||||
{
|
||||
FILE *f;
|
||||
EDA_BaseStruct ** List;
|
||||
ListComponent * List;
|
||||
int NbItems;
|
||||
wxString msg;
|
||||
|
||||
|
@ -616,8 +610,7 @@ wxString msg;
|
|||
NbItems = GenListeCmp( NULL );
|
||||
if( NbItems )
|
||||
{
|
||||
List = (EDA_BaseStruct **)
|
||||
MyZMalloc( NbItems * sizeof(EDA_BaseStruct **) );
|
||||
List = (ListComponent*)MyZMalloc( NbItems * sizeof(ListComponent) );
|
||||
if( List == NULL )
|
||||
{
|
||||
fclose( f );
|
||||
|
@ -627,7 +620,7 @@ wxString msg;
|
|||
GenListeCmp( List );
|
||||
|
||||
/* sort component list */
|
||||
qsort( List, NbItems, sizeof( EDA_BaseStruct * ),
|
||||
qsort( List, NbItems, sizeof( ListComponent ),
|
||||
(int(*)(const void*, const void*))ListTriComposantByRef );
|
||||
|
||||
// if( ! s_ListWithSubCmponents )
|
||||
|
@ -654,7 +647,7 @@ void WinEDA_Build_BOM_Frame::GenereListeOfItems(const wxString & FullFileName)
|
|||
*/
|
||||
{
|
||||
FILE *f;
|
||||
EDA_BaseStruct ** List;
|
||||
ListComponent * List;
|
||||
ListLabel * ListOfLabels;
|
||||
int NbItems;
|
||||
char Line[1024];
|
||||
|
@ -672,8 +665,8 @@ wxString msg;
|
|||
NbItems = GenListeCmp( NULL );
|
||||
if( NbItems )
|
||||
{
|
||||
List = ( EDA_BaseStruct **)
|
||||
MyZMalloc( NbItems * sizeof(EDA_BaseStruct **) );
|
||||
List = ( ListComponent *)
|
||||
MyZMalloc( NbItems * sizeof(ListComponent) );
|
||||
if( List == NULL )
|
||||
{
|
||||
fclose( f );
|
||||
|
@ -682,6 +675,10 @@ wxString msg;
|
|||
|
||||
GenListeCmp( List );
|
||||
|
||||
for(int i=0; i<NbItems; i++){
|
||||
printf("found component: %s\n", List[i].m_Ref);
|
||||
}
|
||||
|
||||
/* generation du fichier listing */
|
||||
DateAndTime(Line);
|
||||
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion();
|
||||
|
@ -689,9 +686,12 @@ wxString msg;
|
|||
|
||||
/* 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 );
|
||||
|
||||
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( ! m_ListSubCmpItems->GetValue() )
|
||||
DeleteSubCmp(List, NbItems);
|
||||
|
@ -705,7 +705,7 @@ wxString msg;
|
|||
// if( s_ListByValue )
|
||||
if( m_ListCmpbyValItems->GetValue() )
|
||||
{
|
||||
qsort( List, NbItems, sizeof( EDA_BaseStruct * ),
|
||||
qsort( List, NbItems, sizeof( ListComponent ),
|
||||
(int(*)(const void*, const void*))ListTriComposantByVal );
|
||||
PrintListeCmpByVal(f, List, NbItems);
|
||||
}
|
||||
|
@ -720,6 +720,7 @@ wxString msg;
|
|||
if( NbItems )
|
||||
{
|
||||
ListOfLabels = (ListLabel *) MyZMalloc( NbItems * sizeof(ListLabel) );
|
||||
memset((void*)ListOfLabels, 0, NbItems * sizeof(ListLabel));
|
||||
if( ListOfLabels == NULL )
|
||||
{
|
||||
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
|
||||
* Si List == NULL: comptage des elements
|
||||
* Sinon remplissage de la liste
|
||||
* Initialise "FlagControlMulti" a SheetNumber pour la sortie des listes
|
||||
* 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;
|
||||
EDA_BaseStruct *DrawList;
|
||||
EDA_SchComponentStruct *DrawLibItem;
|
||||
BASE_SCREEN * screen;
|
||||
DrawSheetList * sheet;
|
||||
|
||||
/* Build the screen list */
|
||||
EDA_ScreenList ScreenList(NULL);
|
||||
/* Build the sheet (not screen) list */
|
||||
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 )
|
||||
{
|
||||
switch( DrawList->Type() )
|
||||
|
@ -788,11 +794,14 @@ BASE_SCREEN * screen;
|
|||
case DRAW_LIB_ITEM_STRUCT_TYPE :
|
||||
ItemCount++;
|
||||
DrawLibItem = (EDA_SchComponentStruct *) DrawList;
|
||||
DrawLibItem->m_FlagControlMulti = screen->m_SheetNumber;
|
||||
DrawLibItem->m_Parent = screen;
|
||||
DrawLibItem->m_Parent = sheet->LastScreen();
|
||||
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++;
|
||||
}
|
||||
break;
|
||||
|
@ -818,24 +827,27 @@ static int GenListeGLabels( ListLabel * List )
|
|||
int ItemCount = 0;
|
||||
EDA_BaseStruct *DrawList;
|
||||
DrawSheetLabelStruct *SheetLabel;
|
||||
BASE_SCREEN * screen;
|
||||
DrawSheetList * sheet;
|
||||
|
||||
/* 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;
|
||||
while( DrawList )
|
||||
DrawList = sheet->LastDrawList();
|
||||
wxString path = sheet->Path();
|
||||
while(DrawList )
|
||||
{
|
||||
switch( DrawList->Type() )
|
||||
{
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
|
||||
ItemCount++;
|
||||
if( List )
|
||||
{
|
||||
List->m_LabelType = DRAW_GLOBAL_LABEL_STRUCT_TYPE;
|
||||
List->m_SheetNumber = screen->m_SheetNumber;
|
||||
List->m_LabelType = DrawList->Type();
|
||||
snprintf(List->m_SheetPath, sizeof(List->m_SheetPath),
|
||||
"%s", CONV_TO_UTF8(path));
|
||||
List->m_Label = DrawList;
|
||||
List++;
|
||||
}
|
||||
|
@ -850,7 +862,8 @@ BASE_SCREEN * screen;
|
|||
if( List )
|
||||
{
|
||||
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++;
|
||||
}
|
||||
|
@ -871,8 +884,8 @@ BASE_SCREEN * screen;
|
|||
|
||||
|
||||
/**********************************************************/
|
||||
static int ListTriComposantByVal(EDA_SchComponentStruct **Objet1,
|
||||
EDA_SchComponentStruct **Objet2)
|
||||
static int ListTriComposantByVal(ListComponent *Objet1,
|
||||
ListComponent *Objet2)
|
||||
/**********************************************************/
|
||||
/* Routine de comparaison pour le tri du Tableau par qsort()
|
||||
* Les composants sont tries
|
||||
|
@ -884,27 +897,31 @@ static int ListTriComposantByVal(EDA_SchComponentStruct **Objet1,
|
|||
int ii;
|
||||
const wxString * Text1, *Text2;
|
||||
|
||||
if( ( *Objet1 == NULL ) && ( *Objet2 == NULL ) )
|
||||
if( ( Objet1 == NULL ) && ( Objet2 == NULL ) )
|
||||
return( 0 );
|
||||
if( *Objet1 == NULL )
|
||||
if( Objet1 == NULL )
|
||||
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 );
|
||||
|
||||
Text1 = &(*Objet1)->m_Field[VALUE].m_Text;
|
||||
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);
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
Text1 = &(*Objet1)->m_Field[REFERENCE].m_Text;
|
||||
Text2 = &(*Objet2)->m_Field[REFERENCE].m_Text;
|
||||
ii = Text1->CmpNoCase(*Text2);
|
||||
ii = strcmp(Objet1->m_Ref, Objet2->m_Ref);
|
||||
}
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = (*Objet1)->m_Multi - (*Objet2)->m_Multi;
|
||||
ii = Objet1->m_Comp->m_Multi - Objet2->m_Comp->m_Multi;
|
||||
}
|
||||
|
||||
return( ii );
|
||||
|
@ -912,8 +929,8 @@ const wxString * Text1, *Text2;
|
|||
|
||||
|
||||
/**********************************************************/
|
||||
static int ListTriComposantByRef(EDA_SchComponentStruct **Objet1,
|
||||
EDA_SchComponentStruct **Objet2)
|
||||
static int ListTriComposantByRef(ListComponent *Objet1,
|
||||
ListComponent *Objet2)
|
||||
/**********************************************************/
|
||||
/* Routine de comparaison pour le tri du Tableau par qsort()
|
||||
* Les composants sont tries
|
||||
|
@ -925,27 +942,30 @@ static int ListTriComposantByRef(EDA_SchComponentStruct **Objet1,
|
|||
int ii;
|
||||
const wxString * Text1, *Text2;
|
||||
|
||||
if( ( *Objet1 == NULL ) && ( *Objet2 == NULL ) )
|
||||
if( ( Objet1 == NULL ) && ( Objet2 == NULL ) )
|
||||
return( 0 );
|
||||
if( *Objet1 == NULL )
|
||||
if( Objet1 == NULL )
|
||||
return( -1 );
|
||||
if( *Objet2 == NULL )
|
||||
if( Objet2 == NULL )
|
||||
return( 1 );
|
||||
|
||||
Text1 = &(*Objet1)->m_Field[REFERENCE].m_Text;
|
||||
Text2 = &(*Objet2)->m_Field[REFERENCE].m_Text;
|
||||
ii = Text1->CmpNoCase(*Text2);
|
||||
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 );
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
Text1 = &(*Objet1)->m_Field[VALUE].m_Text;
|
||||
Text2 = &(*Objet2)->m_Field[VALUE].m_Text;
|
||||
ii = strcmp(Objet1->m_Ref, Objet2->m_Ref);
|
||||
|
||||
if( ii == 0 ){
|
||||
Text1 = &( Objet1->m_Comp->m_Field[VALUE].m_Text );
|
||||
Text2 = &( Objet2->m_Comp->m_Field[VALUE].m_Text );
|
||||
ii = Text1->CmpNoCase(*Text2);
|
||||
}
|
||||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = (*Objet1)->m_Multi - (*Objet2)->m_Multi;
|
||||
if( ii == 0 ){
|
||||
ii = Objet1->m_Comp->m_Multi - Objet2->m_Comp->m_Multi;
|
||||
}
|
||||
|
||||
return( ii );
|
||||
|
@ -978,7 +998,7 @@ const wxString * Text1, *Text2;
|
|||
|
||||
if( ii == 0 )
|
||||
{
|
||||
ii = Objet1->m_SheetNumber - Objet2->m_SheetNumber;
|
||||
ii = strcmp(Objet1->m_SheetPath, Objet2->m_SheetPath);
|
||||
}
|
||||
|
||||
return( ii );
|
||||
|
@ -997,7 +1017,8 @@ static int ListTriGLabelBySheet(ListLabel *Objet1, ListLabel *Objet2)
|
|||
int ii;
|
||||
const wxString * Text1, *Text2;
|
||||
|
||||
ii = Objet1->m_SheetNumber - Objet2->m_SheetNumber;
|
||||
|
||||
ii = strcmp(Objet1->m_SheetPath, Objet2->m_SheetPath);
|
||||
|
||||
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
|
||||
* boitiers multiples
|
||||
|
@ -1028,21 +1049,24 @@ static void DeleteSubCmp( EDA_BaseStruct ** List, int NbItems )
|
|||
{
|
||||
int ii;
|
||||
EDA_SchComponentStruct * LibItem;
|
||||
const wxString * OldName = NULL;
|
||||
wxString OldName;
|
||||
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
LibItem = (EDA_SchComponentStruct *) List[ii];
|
||||
LibItem = List[ii].m_Comp;
|
||||
if( LibItem == NULL )
|
||||
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 )
|
||||
/*********************************************************************************************/
|
||||
/* Print the B.O.M sorted by reference
|
||||
|
@ -1103,7 +1127,7 @@ wxString msg;
|
|||
|
||||
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 );
|
||||
wxCheckBox * FieldListCtrl[FIELD8 - FIELD1 + 1] = {
|
||||
|
@ -1140,7 +1164,7 @@ wxString msg;
|
|||
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
DrawList = List[ii];
|
||||
DrawList = List[ii].m_Comp;
|
||||
|
||||
if( DrawList == NULL )
|
||||
continue;
|
||||
|
@ -1148,7 +1172,7 @@ wxString msg;
|
|||
continue;
|
||||
|
||||
DrawLibItem = (EDA_SchComponentStruct *) DrawList;
|
||||
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' )
|
||||
if( List[ii].m_Ref[0] == '#' )
|
||||
continue;
|
||||
|
||||
Multi = 0;
|
||||
|
@ -1160,7 +1184,7 @@ wxString msg;
|
|||
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() )
|
||||
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 != ' ' )
|
||||
sprintf( NameCmp + strlen(NameCmp), "%c", Unit );
|
||||
|
||||
|
@ -1174,17 +1198,19 @@ wxString msg;
|
|||
// if( s_ListWithSubCmponents )
|
||||
if( m_ListSubCmpItems->GetValue() )
|
||||
{
|
||||
DrawSheetStruct * sheet = (DrawSheetStruct *)(DrawLibItem->m_Parent);
|
||||
SCH_SCREEN * screen = (SCH_SCREEN *)(DrawLibItem->m_Parent);
|
||||
wxString sheetname;
|
||||
if( sheet && sheet->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
sheetname = sheet->m_SheetName;
|
||||
if( screen && screen->Type() == SCREEN_STRUCT_TYPE )
|
||||
sheetname = screen->m_FileName;
|
||||
else
|
||||
sheetname = _("Root");
|
||||
sheetname = _("?");
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -1220,7 +1246,7 @@ wxString msg;
|
|||
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
DrawList = List[ii];
|
||||
DrawList = List[ii].m_Comp;
|
||||
|
||||
if( DrawList == NULL )
|
||||
continue;
|
||||
|
@ -1228,7 +1254,7 @@ wxString msg;
|
|||
continue;
|
||||
|
||||
DrawLibItem = (EDA_SchComponentStruct *) DrawList;
|
||||
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' )
|
||||
if( List[ii].m_Ref[0] == '#' )
|
||||
continue;
|
||||
|
||||
Multi = 0;
|
||||
|
@ -1237,18 +1263,17 @@ wxString msg;
|
|||
if( Entry )
|
||||
Multi = Entry->m_UnitCount;
|
||||
// if( ( Multi > 1 ) && s_ListWithSubCmponents )
|
||||
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() )
|
||||
if( ( Multi > 1 ) && m_ListSubCmpItems->GetValue() ){
|
||||
Unit = DrawLibItem->m_Multi + 'A' - 1;
|
||||
msg = DrawLibItem->m_Field[REFERENCE].m_Text;
|
||||
msg.Append(Unit);
|
||||
}
|
||||
fprintf( f, "| %-12s %-10s%c",
|
||||
CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text),
|
||||
List[ii].m_Ref, Unit);
|
||||
|
||||
fprintf( f, "| %-12s %-10s",
|
||||
CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text),
|
||||
CONV_TO_UTF8(msg) );
|
||||
// if( s_ListWithSubCmponents )
|
||||
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);
|
||||
|
@ -1265,11 +1290,12 @@ wxString msg;
|
|||
static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems)
|
||||
/******************************************************************/
|
||||
{
|
||||
int ii, jj;
|
||||
DrawGlobalLabelStruct *DrawTextItem;
|
||||
DrawSheetLabelStruct * DrawSheetLabel;
|
||||
ListLabel * LabelItem;
|
||||
wxString msg;
|
||||
int ii, jj;
|
||||
DrawLabelStruct *DrawTextItem;
|
||||
DrawSheetLabelStruct * DrawSheetLabel;
|
||||
ListLabel * LabelItem;
|
||||
wxString msg;
|
||||
char str[64];
|
||||
|
||||
for( ii = 0; ii < NbItems; ii++ )
|
||||
{
|
||||
|
@ -1277,12 +1303,18 @@ wxString msg;
|
|||
|
||||
switch( LabelItem->m_LabelType )
|
||||
{
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
|
||||
DrawTextItem = (DrawGlobalLabelStruct *)(LabelItem->m_Label);
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
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(
|
||||
_("> %-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(),
|
||||
LabelItem->m_SheetNumber,
|
||||
str,
|
||||
LabelItem->m_SheetPath,
|
||||
(float)DrawTextItem->m_Pos.x / 1000,
|
||||
(float)DrawTextItem->m_Pos.y / 1000);
|
||||
|
||||
|
@ -1299,10 +1331,10 @@ wxString msg;
|
|||
jj = 4;
|
||||
wxString labtype = CONV_FROM_UTF8(SheetLabelType[jj]);
|
||||
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(),
|
||||
labtype.GetData(),
|
||||
LabelItem->m_SheetNumber,
|
||||
LabelItem->m_SheetPath,
|
||||
(float)DrawSheetLabel->m_Pos.x / 1000,
|
||||
(float)DrawSheetLabel->m_Pos.y / 1000);
|
||||
fprintf(f, CONV_TO_UTF8(msg));
|
||||
|
|
|
@ -131,8 +131,8 @@ public:
|
|||
////@end WinEDA_Build_BOM_Frame member function declarations
|
||||
void GenereListeOfItems(const wxString & FullFileName);
|
||||
void CreateExportList(const wxString & FullFileName);
|
||||
int PrintListeCmpByRef( FILE * f, EDA_BaseStruct ** List, int NbItems, bool CompactForm = FALSE );
|
||||
int PrintListeCmpByVal( FILE *f, EDA_BaseStruct **List, int NbItems);
|
||||
int PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems, bool CompactForm = FALSE );
|
||||
int PrintListeCmpByVal( FILE *f, ListComponent * List, int NbItems);
|
||||
void PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem, bool CompactForm = FALSE);
|
||||
void SavePreferences();
|
||||
|
||||
|
|
|
@ -68,6 +68,10 @@ wxString msg;
|
|||
SetTitle(_("Global Label properties"));
|
||||
break;
|
||||
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
SetTitle(_("Hierarchal Label properties"));
|
||||
break;
|
||||
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
SetTitle(_("Label properties"));
|
||||
break;
|
||||
|
@ -155,7 +159,7 @@ void WinEDA_LabelPropertiesFrame::CreateControls()
|
|||
m_TextShapeStrings.Add(_("Bidi"));
|
||||
m_TextShapeStrings.Add(_("TriState"));
|
||||
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->Show(false);
|
||||
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) );
|
||||
////@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);
|
||||
}
|
||||
|
||||
|
|
|
@ -433,10 +433,10 @@ wxString msg;
|
|||
break;
|
||||
}
|
||||
|
||||
if ( m_Parent->m_CurrentScreen )
|
||||
if ( m_Parent->GetScreen() )
|
||||
{
|
||||
if ( setgrid ) m_Parent->m_CurrentScreen->SetGrid(grid);
|
||||
m_Parent->m_CurrentScreen->SetRefreshReq();
|
||||
if ( setgrid ) m_Parent->GetScreen()->SetGrid(grid);
|
||||
m_Parent->GetScreen()->SetRefreshReq();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,28 +14,6 @@
|
|||
#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)
|
||||
/**************************************/
|
||||
|
|
|
@ -29,15 +29,15 @@ enum id_libedit {
|
|||
/* Variables locales */
|
||||
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.
|
||||
* On peut éditer:
|
||||
* On peut <EFBFBD>diter:
|
||||
* Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
|
||||
* Documentation et mots clefs
|
||||
* 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"
|
||||
|
@ -653,7 +653,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
|
|||
Close(); return;
|
||||
}
|
||||
|
||||
m_Parent->m_CurrentScreen->SetModify();
|
||||
m_Parent->GetScreen()->SetModify();
|
||||
m_Parent->SaveCopyInUndoList( CurrentLibEntry );
|
||||
|
||||
CopyPanelFieldToData();
|
||||
|
@ -761,7 +761,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
|
|||
{
|
||||
if( ii < FIELD1 || Field->m_Name.IsEmpty() )
|
||||
{
|
||||
delete Field;
|
||||
SAFE_DELETE( Field );
|
||||
if( previousField )
|
||||
previousField->Pnext = NextField;
|
||||
else
|
||||
|
@ -1056,8 +1056,8 @@ bool WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackage( int MaxUnit )
|
|||
bool WinEDA_PartPropertiesFrame::SetUnsetConvert()
|
||||
/*****************************************************/
|
||||
|
||||
/* crée ou efface (selon option AsConvert) les éléments
|
||||
* de la représentation convertie d'un composant
|
||||
/* cr<EFBFBD>e ou efface (selon option AsConvert) les <20>l<EFBFBD>ments
|
||||
* de la repr<EFBFBD>sentation convertie d'un composant
|
||||
*/
|
||||
{
|
||||
int FlagDel = 0;
|
||||
|
@ -1096,7 +1096,7 @@ bool WinEDA_PartPropertiesFrame::SetUnsetConvert()
|
|||
}
|
||||
else /* Representation convertie a supprimer */
|
||||
{
|
||||
/* Traitement des elements à supprimer */
|
||||
/* Traitement des elements <EFBFBD> supprimer */
|
||||
if( CurrentLibEntry )
|
||||
DrawItem = CurrentLibEntry->m_Drawings;
|
||||
for( ; DrawItem != NULL; DrawItem = NextDrawItem )
|
||||
|
|
|
@ -88,7 +88,10 @@ void WinEDA_ComponentPropertiesFrame::InitBuffers()
|
|||
for( ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ )
|
||||
{
|
||||
m_FieldName[ii] = m_Cmp->ReturnFieldName( ii );
|
||||
m_FieldText[ii] = m_Cmp->m_Field[ii].m_Text;
|
||||
if(ii == REFERENCE)
|
||||
m_FieldText[ii] = m_Cmp->GetRef(m_Parent->GetSheet());
|
||||
else
|
||||
m_FieldText[ii] = m_Cmp->m_Field[ii].m_Text;
|
||||
m_FieldSize[ii] = m_Cmp->m_Field[ii].m_Size.x;
|
||||
m_FieldFlags[ii] =
|
||||
(m_Cmp->m_Field[ii].m_Attributs & TEXT_NO_VISIBLE) ? 0 : 1;
|
||||
|
@ -115,8 +118,9 @@ void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField()
|
|||
{
|
||||
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] );
|
||||
}
|
||||
|
||||
if( fieldId == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER )
|
||||
m_FieldTextCtrl->Enable( FALSE );
|
||||
|
@ -343,7 +347,7 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
|
|||
(m_ConvertButt->GetValue() == TRUE) ?
|
||||
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 )
|
||||
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++ )
|
||||
{
|
||||
if( ii == REFERENCE ) // la reference ne peut etre vide
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -421,10 +425,10 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
|
|||
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 );
|
||||
m_Parent->TestDanglingEnds( m_Parent->m_CurrentScreen->EEDrawList, &dc );
|
||||
m_Parent->TestDanglingEnds( m_Parent->GetScreen()->EEDrawList, &dc );
|
||||
|
||||
EndModal( 0 );
|
||||
}
|
||||
|
@ -454,7 +458,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC )
|
|||
int x1, y1;
|
||||
EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) CurrentField->m_Parent;
|
||||
|
||||
delete g_ItemToUndoCopy;
|
||||
SAFE_DELETE( g_ItemToUndoCopy );
|
||||
g_ItemToUndoCopy = Cmp->GenCopy();
|
||||
|
||||
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;
|
||||
|
||||
DrawPanel->CursorOff( DC );
|
||||
m_CurrentScreen->m_Curseur = newpos;
|
||||
GetScreen()->m_Curseur = newpos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
||||
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_Text = newtext;
|
||||
if( FieldNumber == REFERENCE ){
|
||||
Cmp->SetRef(GetSheet(), newtext);
|
||||
}
|
||||
}
|
||||
else /* Nouveau texte NULL */
|
||||
{
|
||||
|
@ -580,7 +587,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
|
|||
|
||||
DrawTextField( DrawPanel, DC, Field, flag, g_XorMode );
|
||||
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 );
|
||||
}
|
||||
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*/
|
||||
{
|
||||
wxString msg;
|
||||
EDA_LibComponentStruct* Entry;
|
||||
int flag = 0;
|
||||
|
||||
|
@ -739,19 +745,18 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
|
|||
if( Entry->m_UnitCount > 1 )
|
||||
flag = 1;
|
||||
|
||||
PartTextStruct* TextField = &Cmp->m_Field[REFERENCE];
|
||||
wxString ref = Cmp->GetRef(GetSheet());
|
||||
Get_Message( _( "Reference" ), ref, this );
|
||||
|
||||
msg = TextField->m_Text;
|
||||
Get_Message( _( "Reference" ), msg, this );
|
||||
|
||||
if( !msg.IsEmpty() ) // New text entered
|
||||
if( !ref.IsEmpty() ) // New text entered
|
||||
{
|
||||
/* save old cmp in undo list if not already in edit, or moving ... */
|
||||
if( Cmp->m_Flags == 0 )
|
||||
SaveCopyInUndoList( Cmp, IS_CHANGED );
|
||||
Cmp->SetRef(GetSheet(), ref);
|
||||
|
||||
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,
|
||||
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
|
||||
GetScreen()->SetModify();
|
||||
|
@ -794,7 +799,7 @@ void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxD
|
|||
TextField->m_Text = msg;
|
||||
DrawTextField( DrawPanel, DC, &Cmp->m_Field[VALUE], flag,
|
||||
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
}
|
||||
|
||||
Cmp->Display_Infos( this );
|
||||
|
@ -848,7 +853,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( EDA_SchComponentStruct* Cmp,
|
|||
|
||||
DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag,
|
||||
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
|
||||
Cmp->Display_Infos( this );
|
||||
}
|
||||
|
@ -896,7 +901,7 @@ void WinEDA_ComponentPropertiesFrame::SetInitCmp( wxCommandEvent& event )
|
|||
|
||||
m_Cmp->SetRotationMiroir( CMP_NORMAL );
|
||||
|
||||
m_Parent->m_CurrentScreen->SetModify();
|
||||
m_Parent->GetScreen()->SetModify();
|
||||
|
||||
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE );
|
||||
EndModal( 1 );
|
||||
|
|
|
@ -87,6 +87,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
|
|||
{
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
ItemInitialPosition = TextStruct->m_Pos;
|
||||
OldSize = TextStruct->m_Size;
|
||||
|
@ -98,7 +99,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
|
|||
}
|
||||
|
||||
DrawPanel->CursorOff( DC );
|
||||
m_CurrentScreen->m_Curseur = ItemInitialPosition;
|
||||
GetScreen()->m_Curseur = ItemInitialPosition;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
||||
GetScreen()->SetModify();
|
||||
|
@ -142,7 +143,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
|
|||
{
|
||||
if( TextStruct == NULL )
|
||||
TextStruct = (DrawTextStruct*) PickStruct( GetScreen()->m_Curseur,
|
||||
GetScreen()->EEDrawList, TEXTITEM | LABELITEM );
|
||||
GetScreen(), TEXTITEM | LABELITEM );
|
||||
if( TextStruct == NULL )
|
||||
return;
|
||||
|
||||
|
@ -159,6 +160,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
|
|||
{
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
TextStruct->m_Orient++;
|
||||
TextStruct->m_Orient &= 3;
|
||||
|
@ -190,15 +192,21 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
|
|||
switch( type )
|
||||
{
|
||||
case LAYER_NOTES:
|
||||
NewText = new DrawTextStruct( m_CurrentScreen->m_Curseur );
|
||||
NewText = new DrawTextStruct( GetScreen()->m_Curseur );
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
case LAYER_GLOBLABEL:
|
||||
NewText = new DrawGlobalLabelStruct( m_CurrentScreen->m_Curseur );
|
||||
NewText = new DrawGlobalLabelStruct(GetScreen()->m_Curseur );
|
||||
NewText->m_Shape = s_DefaultShapeGLabel;
|
||||
NewText->m_Orient = s_DefaultOrientGLabel;
|
||||
break;
|
||||
|
@ -216,11 +224,11 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
|
|||
|
||||
if( NewText->m_Text.IsEmpty() )
|
||||
{
|
||||
delete NewText;
|
||||
SAFE_DELETE( NewText );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( type == LAYER_GLOBLABEL )
|
||||
if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL)
|
||||
{
|
||||
s_DefaultShapeGLabel = NewText->m_Shape;
|
||||
s_DefaultOrientGLabel = NewText->m_Orient;
|
||||
|
@ -230,7 +238,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
|
|||
DrawPanel->ManageCurseur = ShowWhileMoving;
|
||||
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
|
||||
|
||||
m_CurrentScreen->SetCurItem( NewText );
|
||||
GetScreen()->SetCurItem( NewText );
|
||||
|
||||
return NewText;
|
||||
}
|
||||
|
@ -252,6 +260,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
{
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
( (DrawTextStruct*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur;
|
||||
break;
|
||||
|
@ -269,7 +278,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
/*************************************************************/
|
||||
/* 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();
|
||||
|
||||
g_ItemToRepeat = NULL;
|
||||
|
@ -286,7 +295,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
|
||||
if( Struct->m_Flags & IS_NEW )
|
||||
{
|
||||
delete Struct;
|
||||
SAFE_DELETE( Struct );
|
||||
screen->SetCurItem( NULL );
|
||||
}
|
||||
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_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
{
|
||||
DrawTextStruct* Text = (DrawTextStruct*) Struct;
|
||||
|
@ -336,9 +346,11 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
|
|||
break;
|
||||
|
||||
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;
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
newtext = new DrawTextStruct( Text->m_Pos, Text->m_Text );
|
||||
break;
|
||||
|
@ -381,13 +393,12 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
|
|||
{
|
||||
Text->m_Flags = 0;
|
||||
DeleteStruct( DrawPanel, DC, Text );
|
||||
m_CurrentScreen->SetCurItem( NULL );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
g_ItemToRepeat = NULL;
|
||||
}
|
||||
GetScreen()->SetCurItem( newtext );
|
||||
|
||||
delete g_ItemToUndoCopy;
|
||||
g_ItemToUndoCopy = NULL;
|
||||
SAFE_DELETE( g_ItemToUndoCopy );
|
||||
|
||||
DrawPanel->CursorOff( DC ); // Erase schematic cursor
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ wxString FullFileName;
|
|||
case ID_CONFIG_READ:
|
||||
{
|
||||
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 );
|
||||
|
||||
FullFileName = EDA_FileSelector(_("Read config file"),
|
||||
|
@ -142,7 +142,7 @@ wxString FullFileName;
|
|||
bool IsRead = TRUE;
|
||||
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;
|
||||
g_LibName_List.Clear();
|
||||
|
||||
|
@ -185,7 +185,7 @@ wxString FullFileName;
|
|||
wxString mask( wxT("*") );
|
||||
|
||||
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 );
|
||||
|
||||
path = wxGetCwd();
|
||||
|
|
|
@ -27,6 +27,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
|||
/* Routine de Trace de segments ( WIRES, BUS ) pour lesquels chaque segment
|
||||
* est une structure.
|
||||
*/
|
||||
// NOT USED!!!@!@!
|
||||
{
|
||||
DrawSegmentStruct* oldsegment, * newsegment;
|
||||
wxPoint pos = GetScreen()->m_Curseur;
|
||||
|
@ -84,7 +85,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
|
|||
GetScreen()->ManageCurseur( DrawPanel, DC, 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 ) )
|
||||
{
|
||||
EndSegment( DC ); return;
|
||||
|
@ -385,6 +386,8 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
|||
|
||||
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawLabelStruct*) g_ItemToRepeat )
|
||||
g_ItemToRepeat = STRUCT->GenCopy();
|
||||
|
@ -396,19 +399,6 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
|
|||
STRUCT->m_Text = Line;
|
||||
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:
|
||||
#undef STRUCT
|
||||
#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
|
||||
* - une jonction
|
||||
* - 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
|
||||
* - ou une extrémité unique de BUS
|
||||
* - ou une extr<EFBFBD>mit<EFBFBD> unique de BUS
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* item;
|
||||
|
|
|
@ -193,7 +193,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
Field->m_HJustify, Field->m_VJustify, LineWidth );
|
||||
}
|
||||
|
||||
// Tracé de l'ancre
|
||||
// Trac<EFBFBD> de l'ancre
|
||||
int len = 3 * panel->GetZoom();
|
||||
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 );
|
||||
|
@ -212,7 +212,7 @@ void EDA_SchComponentStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
bool dummy = FALSE;
|
||||
|
||||
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;
|
||||
if( DummyCmp == NULL )
|
||||
CreateDummyCmp();
|
||||
|
@ -587,8 +587,8 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
LibDrawPin* Pin = (LibDrawPin*) DEntry;
|
||||
if( Pin->m_Attributs & PINNOTDRAW )
|
||||
{
|
||||
if( (ActiveScreen->m_Type == SCHEMATIC_FRAME)
|
||||
&& !g_ShowAllPins )
|
||||
if( /*(GetScreen()->m_Type == SCHEMATIC_FRAME )
|
||||
&&*/ !g_ShowAllPins )
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,9 +91,9 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
|
|||
ChangeFileNameExt( FullFileName, DOC_EXT );
|
||||
LoadDocLib( frame, FullFileName, NewLib->m_Name );
|
||||
}
|
||||
else
|
||||
delete NewLib;
|
||||
|
||||
else{
|
||||
SAFE_DELETE( NewLib );
|
||||
}
|
||||
fclose( f );
|
||||
return NewLib;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
|
|||
TempLib->m_Pnext = TempLib->m_Pnext->m_Pnext;
|
||||
}
|
||||
|
||||
delete Lib;
|
||||
SAFE_DELETE( Lib );
|
||||
|
||||
/* The removed librairy can be 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" ),
|
||||
*LineNum, currentLibraryName.GetData() );
|
||||
DisplayError( frame, Msg );
|
||||
delete LibEntry;
|
||||
SAFE_DELETE( LibEntry );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -604,7 +604,7 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
|
|||
if( !Error )
|
||||
{ /* Convert '~' to spaces. */
|
||||
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;
|
||||
|
@ -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." ),
|
||||
Line[0], *LineNum );
|
||||
DisplayError( frame, MsgLine );
|
||||
delete New;
|
||||
SAFE_DELETE( New );
|
||||
|
||||
/* FLush till end of draw: */
|
||||
do {
|
||||
|
@ -1119,8 +1119,8 @@ static int SortItemsFct( const void* ref, const void* item );
|
|||
void EDA_LibComponentStruct::SortDrawItems()
|
||||
/*******************************************/
|
||||
|
||||
/* Trie les éléments graphiques d'un composant lib pour améliorer
|
||||
* le tracé:
|
||||
/* Trie les <EFBFBD>l<EFBFBD>ments graphiques d'un composant lib pour am<61>liorer
|
||||
* le trac<EFBFBD>:
|
||||
* items remplis en premier, pins en dernier
|
||||
* En cas de superposition d'items, c'est plus lisible
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@ char marq_bitmap[]=
|
|||
char marqERC_bitmap[]=
|
||||
{
|
||||
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,0,1,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)
|
||||
/*******************************************************************************/
|
||||
{
|
||||
BASE_SCREEN * screen, * oldscreen = m_Parent->GetScreen();
|
||||
BASE_SCREEN * screen; // * oldscreen = m_Parent->GetScreen();
|
||||
|
||||
wxBeginBusyCursor();
|
||||
|
||||
|
||||
screen = m_Parent->m_CurrentScreen = ActiveScreen;
|
||||
ActiveScreen = screen = m_Parent->GetScreen();
|
||||
RedrawStructList(this,DC, screen->EEDrawList, GR_COPY);
|
||||
|
||||
if ( Print_Sheet_Ref )
|
||||
m_Parent->TraceWorkSheet(DC, screen, g_DrawMinimunLineWidth );
|
||||
|
||||
m_Parent->m_CurrentScreen = oldscreen;
|
||||
//m_Parent->m_CurrentSheet->m_s = oldscreen;
|
||||
wxEndBusyCursor();
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ void DrawMarkerStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint &
|
|||
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 )
|
||||
{
|
||||
|
@ -300,23 +300,23 @@ int width = MAX(m_Width, g_DrawMinimunLineWidth);
|
|||
GRSetDrawMode(DC, DrawMode);
|
||||
|
||||
if( (m_Layer == LAYER_BUS) && (zoom <= 16) )
|
||||
{
|
||||
{
|
||||
width *= 3;
|
||||
}
|
||||
}
|
||||
|
||||
GRMoveTo(m_Points[0], m_Points[1]);
|
||||
if( m_Layer == LAYER_NOTES)
|
||||
{
|
||||
{
|
||||
for (i = 1; i < m_NumOfPoints; i++)
|
||||
GRDashedLineTo(&panel->m_ClipBox, DC, m_Points[i * 2] + offset.x,
|
||||
m_Points[i * 2 + 1] + offset.y, width, color);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
for (i = 1; i < m_NumOfPoints; i++)
|
||||
GRLineTo(&panel->m_ClipBox, DC, m_Points[i * 2] + offset.x, m_Points[i * 2 + 1] + offset.y,
|
||||
width, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -420,6 +420,8 @@ int width = g_DrawMinimunLineWidth;
|
|||
}
|
||||
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
{
|
||||
DrawLabelStruct * Struct;
|
||||
Struct = (DrawLabelStruct * ) DrawStruct;
|
||||
|
@ -429,16 +431,6 @@ int width = g_DrawMinimunLineWidth;
|
|||
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:
|
||||
{
|
||||
DrawNoConnectStruct * Struct;
|
||||
|
|
|
@ -24,10 +24,6 @@
|
|||
#include "bitmaps.h"
|
||||
#include "eda_dde.h"
|
||||
|
||||
|
||||
/* Routines locales */
|
||||
static void CreateScreens();
|
||||
|
||||
// Global variables
|
||||
wxString g_Main_Title( wxT( "EESchema" ) );
|
||||
|
||||
|
@ -61,8 +57,6 @@ bool WinEDA_App::OnInit()
|
|||
if( argc > 1 )
|
||||
FFileName = argv[1];
|
||||
|
||||
CreateScreens();
|
||||
|
||||
/* init EESCHEMA */
|
||||
GetSettings(); // read current setup
|
||||
SeedLayers();
|
||||
|
@ -106,25 +100,3 @@ bool WinEDA_App::OnInit()
|
|||
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;
|
||||
}
|
||||
|
|
126
eeschema/erc.cpp
126
eeschema/erc.cpp
|
@ -51,7 +51,7 @@ int WriteFichierERC = FALSE;
|
|||
* PIN_OPENEMITTER, PIN_NC
|
||||
*/
|
||||
#define OK 0
|
||||
#define WAR 1 // utilisé aussi dans eeredraw
|
||||
#define WAR 1 // utilis<EFBFBD> aussi dans eeredraw
|
||||
#define ERR 2
|
||||
#define UNC 3
|
||||
|
||||
|
@ -185,7 +185,7 @@ void WinEDA_ErcFrame::ReBuildMatrixPanel()
|
|||
|
||||
text_height = text->GetRect().GetHeight();
|
||||
bitmap_size = MAX( bitmap_size, text_height );
|
||||
delete text;
|
||||
SAFE_DELETE( text );
|
||||
|
||||
// compute the Y pos interval:
|
||||
BoxMatrixMinSize.y = ( bitmap_size * (PIN_NMAX + 1) ) + 5;
|
||||
|
@ -313,7 +313,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
|
|||
g_EESchemaVar.NbWarningErc = 0;
|
||||
|
||||
/* Cleanup the entire hierarchy */
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
EDA_ScreenList ScreenList;
|
||||
|
||||
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_BUSLABELMEMBER:
|
||||
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;
|
||||
|
||||
case NET_GLOBLABEL:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_HIERLABEL:
|
||||
case NET_HIERBUSLABELMEMBER:
|
||||
case NET_SHEETLABEL:
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
TestLabel( m_Parent->DrawPanel, &dc, NetItemRef, StartNet );
|
||||
|
@ -398,7 +400,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
|
|||
if( WriteFichierERC == TRUE )
|
||||
{
|
||||
wxString ErcFullFileName;
|
||||
ErcFullFileName = ScreenSch->m_FileName;
|
||||
ErcFullFileName = g_RootSheet->m_s->m_FileName;
|
||||
ChangeFileNameExt( ErcFullFileName, wxT( ".erc" ) );
|
||||
ErcFullFileName = EDA_FileSelector( _( "ERC file:" ),
|
||||
wxEmptyString, /* Chemin par defaut */
|
||||
|
@ -542,7 +544,7 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
|
||||
Marker->m_Type = MARQ_ERC;
|
||||
Marker->m_MarkFlags = WAR;
|
||||
screen = NetItemRef->m_Screen;
|
||||
screen = NetItemRef->m_SheetList.LastScreen();
|
||||
Marker->Pnext = screen->EEDrawList;
|
||||
screen->EEDrawList = Marker;
|
||||
g_EESchemaVar.NbErrorErc++;
|
||||
|
@ -550,14 +552,14 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
|
||||
if( MinConn < 0 ) // Traitement des erreurs sur labels
|
||||
{
|
||||
if( (NetItemRef->m_Type == NET_GLOBLABEL)
|
||||
|| (NetItemRef->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
if( (NetItemRef->m_Type == NET_HIERLABEL)
|
||||
|| (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() );
|
||||
}
|
||||
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() );
|
||||
|
||||
if( screen == panel->GetScreen() )
|
||||
|
@ -656,7 +658,7 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
|| (NetItemRef->GetNet() != NetItemTst->GetNet()) ) // fin de net
|
||||
{ /* Fin de netcode trouve: Tst connexion minimum */
|
||||
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 );
|
||||
*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_JONCTION:
|
||||
case NET_LABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_HIERLABEL:
|
||||
case NET_BUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_HIERBUSLABELMEMBER:
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
case NET_SHEETLABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_PINLABEL:
|
||||
break;
|
||||
|
||||
|
@ -719,7 +723,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
|
|||
DrawMarkerStruct* Marker;
|
||||
char Line[256];
|
||||
static FILE* OutErc;
|
||||
DrawSheetStruct* Sheet;
|
||||
DrawSheetList* Sheet;
|
||||
wxString msg;
|
||||
|
||||
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 );
|
||||
|
||||
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;
|
||||
|
||||
msg.Printf( _( "\n***** Sheet %d (%s)\n" ),
|
||||
Sheet->m_SheetNumber,
|
||||
Screen == ScreenSch ? _( "Root" ) : Sheet->m_SheetName.GetData() );
|
||||
if(Sheet->Last() == g_RootSheet){
|
||||
msg.Printf( _( "\n***** Sheet Root\n" ) );
|
||||
}else{
|
||||
wxString str = Sheet->Path();
|
||||
msg.Printf( _("\n***** Sheet %s\n"), str.GetData() );
|
||||
}
|
||||
|
||||
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) );
|
||||
|
||||
DrawStruct = Screen->EEDrawList;
|
||||
DrawStruct = Sheet->LastDrawList();
|
||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
|
||||
{
|
||||
if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE )
|
||||
|
@ -770,7 +775,18 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
|
|||
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,
|
||||
ObjetNetListStruct* NetItemRef, ObjetNetListStruct* StartNet )
|
||||
|
@ -799,66 +815,16 @@ void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
|| ( NetItemRef->GetNet() != NetItemTst->GetNet() ) )
|
||||
{
|
||||
/* Fin de netcode trouve */
|
||||
if( erc )
|
||||
{
|
||||
if( erc ){
|
||||
/* GLabel ou SheetLabel orphelin */
|
||||
Diagnose( panel, DC, NetItemRef, NULL, -1, WAR );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(TestLabel_(NetItemRef, NetItemTst))
|
||||
erc = 0;
|
||||
//same thing, different order.
|
||||
if(TestLabel_(NetItemTst, NetItemRef))
|
||||
erc = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
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();
|
||||
|
@ -28,7 +28,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
|
|||
switch( id )
|
||||
{
|
||||
case ID_SAVE_PROJECT: /* Update Schematic File */
|
||||
SaveProject( this );
|
||||
SaveProject( );
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
if( screen->EEDrawList != NULL )
|
||||
{
|
||||
if( !IsOK( this, _( "Clear SubHierarchy ?" ) ) )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if( FullFileName.IsEmpty() )
|
||||
{
|
||||
wxString mask;
|
||||
mask = wxT( "*" ) + g_SchExtBuffer;
|
||||
FullFileName = EDA_FileSelector( _( "Schematic files:" ),
|
||||
wxEmptyString, /* default path */
|
||||
screen->m_FileName, /* default filename */
|
||||
g_SchExtBuffer, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
wxEmptyString, //default path
|
||||
sheet->m_s->m_FileName,// default filename
|
||||
g_SchExtBuffer, // extension par defaut
|
||||
mask, // Masque d'affichage
|
||||
this,
|
||||
wxFD_OPEN,
|
||||
FALSE
|
||||
|
@ -76,52 +75,212 @@ bool WinEDA_SchematicFrame::LoadOneSheet( SCH_SCREEN* screen, const wxString& fi
|
|||
}
|
||||
|
||||
ClearProjectDrawList( screen, TRUE );
|
||||
|
||||
printf("in LoadOneScreen setting screen filename: %s \n", (const char*) FullFileName.mb_str() );
|
||||
screen->m_FileName = FullFileName;
|
||||
LoadOneEEFile( screen, FullFileName );
|
||||
LoadDrawSheet( DrawSheetStruct * sheet, filename);
|
||||
screen->SetModify();
|
||||
|
||||
if( GetScreen() == screen )
|
||||
Refresh( 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
|
||||
* 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;
|
||||
|
||||
if( frame == NULL )
|
||||
return;
|
||||
screen_tmp = (SCH_SCREEN*)GetScreen(); //save...
|
||||
|
||||
screen_tmp = frame->GetScreen();
|
||||
EDA_ScreenList ScreenList;
|
||||
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
|
||||
for( ActiveScreen = ScreenList.GetFirst();
|
||||
ActiveScreen != NULL;
|
||||
ActiveScreen = ScreenList.GetNext() )
|
||||
for( screen = ScreenList.GetFirst(); screen != NULL;
|
||||
screen = ScreenList.GetNext() )
|
||||
{
|
||||
frame->m_CurrentScreen = ActiveScreen;
|
||||
frame->SaveEEFile( NULL, FILE_SAVE_AS );
|
||||
printf("SaveEEFile, %s\n", (const char*)screen->m_FileName.mb_str() );
|
||||
SaveEEFile( screen, FILE_SAVE_AS );
|
||||
}
|
||||
|
||||
frame->m_CurrentScreen = ActiveScreen = screen_tmp;
|
||||
|
||||
/* 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 );
|
||||
|
||||
/* mise a jour extension */
|
||||
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,
|
||||
* powers non comprises */
|
||||
{
|
||||
return g_RootSheet->ComponentCount();
|
||||
/*
|
||||
BASE_SCREEN* Window;
|
||||
EDA_BaseStruct* Phead;
|
||||
int Nb = 0;
|
||||
|
||||
|
||||
|
||||
Window = ScreenSch;
|
||||
while( Window )
|
||||
{
|
||||
|
@ -153,4 +316,5 @@ int CountCmpNumber()
|
|||
}
|
||||
|
||||
return Nb;
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
|
|||
* @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_SchComponentStruct* Component = NULL;
|
||||
wxSize DrawAreaSize = DrawPanel->GetClientSize();
|
||||
|
@ -89,25 +89,25 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
|
|||
wxString msg;
|
||||
LibDrawPin* pin;
|
||||
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
Screen = ScreenList.GetFirst();
|
||||
sheet = SheetList.GetFirst();
|
||||
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 )
|
||||
{
|
||||
if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
{
|
||||
EDA_SchComponentStruct* pSch;
|
||||
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;
|
||||
ScreenWithComponentFound = Screen;
|
||||
SheetWithComponentFound = sheet;
|
||||
|
||||
switch( SearchType )
|
||||
{
|
||||
|
@ -149,11 +149,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
|
|||
|
||||
if( Component )
|
||||
{
|
||||
Screen = ScreenWithComponentFound;
|
||||
if( Screen != GetScreen() )
|
||||
sheet = SheetWithComponentFound;
|
||||
if( sheet != GetSheet() )
|
||||
{
|
||||
Screen->SetZoom( GetScreen()->GetZoom() );
|
||||
m_CurrentScreen = ActiveScreen = Screen;
|
||||
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
||||
*m_CurrentSheet = *sheet;
|
||||
ActiveScreen = m_CurrentSheet->LastScreen();
|
||||
m_CurrentSheet->UpdateAllScreenReferences();
|
||||
DoCenterAndRedraw = TRUE;
|
||||
}
|
||||
wxPoint delta;
|
||||
|
@ -164,18 +166,18 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
|
|||
|
||||
pos = delta + Component->m_Pos;
|
||||
|
||||
wxPoint old_cursor_position = Screen->m_Curseur;
|
||||
Screen->m_Curseur = pos;
|
||||
wxPoint old_cursor_position = sheet->LastScreen()->m_Curseur;
|
||||
sheet->LastScreen()->m_Curseur = pos;
|
||||
|
||||
curpos = DrawPanel->CursorScreenPosition();
|
||||
|
||||
DrawPanel->GetViewStart(
|
||||
&m_CurrentScreen->m_StartVisu.x,
|
||||
&m_CurrentScreen->m_StartVisu.y );
|
||||
&( GetScreen()->m_StartVisu.x ),
|
||||
&( GetScreen()->m_StartVisu.y ));
|
||||
|
||||
// calcul des coord curseur avec origine = screen
|
||||
curpos.x -= m_CurrentScreen->m_StartVisu.x;
|
||||
curpos.y -= m_CurrentScreen->m_StartVisu.y;
|
||||
curpos.x -= GetScreen()->m_StartVisu.x;
|
||||
curpos.y -= GetScreen()->m_StartVisu.y;
|
||||
|
||||
/* Il y a peut-etre necessite de recadrer le dessin: */
|
||||
#define MARGIN 30
|
||||
|
@ -194,13 +196,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
|
|||
|
||||
DrawPanel->PrepareGraphicContext( &dc );
|
||||
|
||||
EXCHG( old_cursor_position, Screen->m_Curseur );
|
||||
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
||||
DrawPanel->CursorOff( &dc );
|
||||
|
||||
if( mouseWarp )
|
||||
GRMouseWarp( DrawPanel, curpos );
|
||||
|
||||
EXCHG( old_cursor_position, Screen->m_Curseur );
|
||||
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
||||
|
||||
DrawPanel->CursorOn( &dc );
|
||||
}
|
||||
|
@ -273,7 +275,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
|||
* 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;
|
||||
DrawMarkerStruct* Marker = NULL;
|
||||
int StartCount;
|
||||
|
@ -289,13 +291,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
|||
if( SearchType == 0 )
|
||||
s_MarkerCount = 0;
|
||||
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
NotFound = TRUE; StartCount = 0;
|
||||
/* 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 )
|
||||
{
|
||||
if( DrawList->Type() == DRAW_MARKER_STRUCT_TYPE )
|
||||
|
@ -303,9 +305,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
|||
Marker = (DrawMarkerStruct*) DrawList;
|
||||
NotFound = FALSE;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -326,31 +328,33 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
|||
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 */
|
||||
NotFound = FALSE; Screen = FirstScreen;
|
||||
NotFound = FALSE; sheet = FirstSheet;
|
||||
Struct = FirstStruct;
|
||||
pos = firstpos; s_MarkerCount = 1;
|
||||
}
|
||||
|
||||
if( NotFound == FALSE )
|
||||
{
|
||||
if( Screen != GetScreen() )
|
||||
if( sheet != GetSheet() )
|
||||
{
|
||||
Screen->SetZoom( GetScreen()->GetZoom() );
|
||||
m_CurrentScreen = ActiveScreen = Screen;
|
||||
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
||||
*m_CurrentSheet = *sheet;
|
||||
ActiveScreen = m_CurrentSheet->LastScreen();
|
||||
m_CurrentSheet->UpdateAllScreenReferences();
|
||||
DoCenterAndRedraw = TRUE;
|
||||
}
|
||||
|
||||
old_cursor_position = Screen->m_Curseur;
|
||||
Screen->m_Curseur = pos;
|
||||
old_cursor_position = sheet->LastScreen()->m_Curseur;
|
||||
sheet->LastScreen()->m_Curseur = pos;
|
||||
curpos = DrawPanel->CursorScreenPosition();
|
||||
|
||||
// calcul des coord curseur avec origine = screen
|
||||
DrawPanel->GetViewStart( &m_CurrentScreen->m_StartVisu.x,
|
||||
&m_CurrentScreen->m_StartVisu.y );
|
||||
curpos.x -= m_CurrentScreen->m_StartVisu.x;
|
||||
curpos.y -= m_CurrentScreen->m_StartVisu.y;
|
||||
DrawPanel->GetViewStart( &m_CurrentSheet->LastScreen()->m_StartVisu.x,
|
||||
&m_CurrentSheet->LastScreen()->m_StartVisu.y );
|
||||
curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x;
|
||||
curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y;
|
||||
|
||||
// reposition the window if the chosen marker is off screen.
|
||||
#define MARGIN 30
|
||||
|
@ -368,14 +372,14 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
|||
wxClientDC dc( DrawPanel );
|
||||
|
||||
DrawPanel->PrepareGraphicContext( &dc );
|
||||
EXCHG( old_cursor_position, Screen->m_Curseur );
|
||||
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
||||
DrawPanel->CursorOff( &dc );
|
||||
GRMouseWarp( DrawPanel, curpos );
|
||||
EXCHG( old_cursor_position, Screen->m_Curseur );
|
||||
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
||||
DrawPanel->CursorOn( &dc );
|
||||
}
|
||||
|
||||
msg.Printf( _( "Marker %d found in %s" ), s_MarkerCount, Screen->m_FileName.GetData() );
|
||||
wxString path = sheet->Path();
|
||||
msg.Printf( _( "Marker %d found in %s" ), s_MarkerCount, path.GetData() );
|
||||
Affiche_Message( msg );
|
||||
}
|
||||
else
|
||||
|
@ -425,7 +429,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
|||
* @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;
|
||||
int StartCount, ii, jj;
|
||||
bool NotFound;
|
||||
|
@ -457,15 +461,15 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
|||
NotFound = TRUE;
|
||||
StartCount = 0;
|
||||
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
Screen = ScreenList.GetFirst();
|
||||
Sheet = SheetList.GetFirst();
|
||||
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 )
|
||||
{
|
||||
switch( DrawList->Type() )
|
||||
|
@ -473,7 +477,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
|||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
EDA_SchComponentStruct * pSch;
|
||||
pSch = (EDA_SchComponentStruct*) DrawList;
|
||||
if( WildCompareString( WildText, pSch->m_Field[REFERENCE].m_Text, FALSE ) )
|
||||
if( WildCompareString( WildText, pSch->GetRef(Sheet), FALSE ) )
|
||||
{
|
||||
NotFound = FALSE;
|
||||
pos = pSch->m_Field[REFERENCE].m_Pos;
|
||||
|
@ -488,6 +492,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
|||
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
DrawTextStruct * pDraw;
|
||||
pDraw = (DrawTextStruct*) DrawList;
|
||||
|
@ -504,9 +509,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
|||
|
||||
if( NotFound == FALSE ) /* Item found ! */
|
||||
{
|
||||
if( FirstScreen == NULL ) /* First Item found */
|
||||
if( FirstSheet == NULL ) /* First Item found */
|
||||
{
|
||||
FirstScreen = Screen;
|
||||
FirstSheet = Sheet;
|
||||
firstpos = pos;
|
||||
FirstStruct = DrawList;
|
||||
}
|
||||
|
@ -535,10 +540,10 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
|||
break;
|
||||
}
|
||||
|
||||
if( NotFound && FirstScreen )
|
||||
if( NotFound && FirstSheet )
|
||||
{
|
||||
NotFound = FALSE;
|
||||
Screen = FirstScreen;
|
||||
Sheet = FirstSheet;
|
||||
Struct = FirstStruct;
|
||||
pos = firstpos;
|
||||
s_ItemsCount = 1;
|
||||
|
@ -546,10 +551,12 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
|||
|
||||
if( NotFound == FALSE )
|
||||
{
|
||||
if( Screen != GetScreen() )
|
||||
if( Sheet != GetSheet() )
|
||||
{
|
||||
Screen->SetZoom( GetScreen()->GetZoom() );
|
||||
m_CurrentScreen = ActiveScreen = Screen;
|
||||
Sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
||||
*m_CurrentSheet = *Sheet;
|
||||
ActiveScreen = m_CurrentSheet->LastScreen();
|
||||
m_CurrentSheet->UpdateAllScreenReferences();
|
||||
DoCenterAndRedraw = TRUE;
|
||||
}
|
||||
|
||||
|
@ -570,18 +577,18 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
|||
pos.y = jj + pSch->m_Pos.y;
|
||||
}
|
||||
|
||||
old_cursor_position = Screen->m_Curseur;
|
||||
Screen->m_Curseur = pos;
|
||||
old_cursor_position = Sheet->LastScreen()->m_Curseur;
|
||||
Sheet->LastScreen()->m_Curseur = pos;
|
||||
|
||||
curpos = DrawPanel->CursorScreenPosition();
|
||||
|
||||
DrawPanel->GetViewStart(
|
||||
&m_CurrentScreen->m_StartVisu.x,
|
||||
&m_CurrentScreen->m_StartVisu.y );
|
||||
&( GetScreen()->m_StartVisu.x ),
|
||||
&( GetScreen()->m_StartVisu.y ));
|
||||
|
||||
// calcul des coord curseur avec origine = screen
|
||||
curpos.x -= m_CurrentScreen->m_StartVisu.x;
|
||||
curpos.y -= m_CurrentScreen->m_StartVisu.y;
|
||||
curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x;
|
||||
curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y;
|
||||
|
||||
/* Il y a peut-etre necessite de recadrer le dessin: */
|
||||
#define MARGIN 30
|
||||
|
@ -599,18 +606,18 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
|
|||
|
||||
DrawPanel->PrepareGraphicContext( &dc );
|
||||
|
||||
EXCHG( old_cursor_position, Screen->m_Curseur );
|
||||
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
|
||||
DrawPanel->CursorOff( &dc );
|
||||
|
||||
if( mouseWarp )
|
||||
GRMouseWarp( DrawPanel, curpos );
|
||||
|
||||
EXCHG( old_cursor_position, Screen->m_Curseur );
|
||||
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
|
||||
|
||||
DrawPanel->CursorOn( &dc );
|
||||
}
|
||||
|
||||
msg = WildText + _( " Found in " ) + Screen->m_FileName;
|
||||
msg = WildText + _( " Found in " ) + Sheet->Last()->m_SheetName;
|
||||
Affiche_Message( msg );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -72,6 +72,7 @@ typedef enum {
|
|||
LAYER_JUNCTION,
|
||||
LAYER_LOCLABEL,
|
||||
LAYER_GLOBLABEL,
|
||||
LAYER_HIERLABEL,
|
||||
LAYER_PINFUN,
|
||||
LAYER_PINNUM,
|
||||
LAYER_PINNAM,
|
||||
|
@ -147,7 +148,7 @@ extern int g_HVLines;
|
|||
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
|
||||
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_CurrentViewComponentName; /* nom du le composant en cours d'examen */
|
||||
eda_global int g_ViewConvert; /* Vue normal / convert */
|
||||
eda_global int g_ViewUnit; /* unité a afficher (A, B ..) */
|
||||
eda_global int g_ViewUnit; /* unit<EFBFBD> a afficher (A, B ..) */
|
||||
|
||||
/* Variables globales pour Schematic Edit */
|
||||
eda_global int g_DefaultTextLabelSize
|
||||
|
@ -218,7 +219,8 @@ struct HPGL_Pen_Descr_Struct
|
|||
eda_global HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
|
||||
|
||||
/* Ecrans usuels */
|
||||
eda_global SCH_SCREEN * ScreenSch;
|
||||
//eda_global SCH_SCREEN * ScreenSch;
|
||||
eda_global DrawSheetStruct* g_RootSheet;
|
||||
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 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
|
||||
#endif
|
||||
;
|
||||
|
|
|
@ -178,11 +178,11 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
|
|||
DrawPanel->ManageCurseur = ShowWhileMoving;
|
||||
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_Convert = 1;
|
||||
DrawLibItem->m_ChipName = Name;
|
||||
DrawLibItem->m_TimeStamp = GetTimeStamp();
|
||||
DrawLibItem->m_TimeStamp = GetTimeStamp();
|
||||
DrawLibItem->m_Flags = IS_NEW | IS_MOVED;
|
||||
|
||||
/* Init champ Valeur */
|
||||
|
@ -209,7 +209,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
|
|||
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_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_HJustify = Entry->m_Prefix.m_HJustify;
|
||||
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;
|
||||
|
||||
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*)
|
||||
panel->m_Parent->m_CurrentScreen->GetCurItem();
|
||||
panel->m_Parent->GetScreen()->GetCurItem();
|
||||
|
||||
/* Effacement du composant */
|
||||
if( erase )
|
||||
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
|
||||
|
||||
move_vector.x = panel->m_Parent->m_CurrentScreen->m_Curseur.x - DrawLibItem->m_Pos.x;
|
||||
move_vector.y = panel->m_Parent->m_CurrentScreen->m_Curseur.y - DrawLibItem->m_Pos.y;
|
||||
move_vector.x = panel->m_Parent->GetScreen()->m_Curseur.x - DrawLibItem->m_Pos.x;
|
||||
move_vector.y = panel->m_Parent->GetScreen()->m_Curseur.y - DrawLibItem->m_Pos.y;
|
||||
MoveOneStruct( DrawLibItem, move_vector );
|
||||
|
||||
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
|
||||
|
@ -301,7 +301,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
|
|||
DrawPanel->CursorOn( DC );
|
||||
}
|
||||
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
GetScreen()->SetModify();
|
||||
}
|
||||
|
||||
|
@ -314,12 +314,12 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
*/
|
||||
{
|
||||
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 */
|
||||
{
|
||||
DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 );
|
||||
delete DrawLibItem;
|
||||
SAFE_DELETE( DrawLibItem );
|
||||
}
|
||||
else if( DrawLibItem ) /* Deplacement ancien composant en cours */
|
||||
{
|
||||
|
@ -338,7 +338,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
DrawLibItem->m_Flags = 0;
|
||||
Panel->ManageCurseur = 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
|
||||
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
||||
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
GetScreen()->SetModify();
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,7 @@ void WinEDA_SchematicFrame::ConvertPart( EDA_SchComponentStruct* DrawComponent,
|
|||
else
|
||||
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
||||
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
GetScreen()->SetModify();
|
||||
}
|
||||
|
||||
|
@ -471,18 +471,19 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component,
|
|||
|
||||
if( Component->m_Flags == 0 )
|
||||
{
|
||||
if( g_ItemToUndoCopy )
|
||||
delete g_ItemToUndoCopy;
|
||||
if( g_ItemToUndoCopy ){
|
||||
SAFE_DELETE( g_ItemToUndoCopy );
|
||||
}
|
||||
g_ItemToUndoCopy = Component->GenCopy();
|
||||
}
|
||||
|
||||
DrawPanel->CursorOff( DC );
|
||||
m_CurrentScreen->m_Curseur = Component->m_Pos;
|
||||
GetScreen()->m_Curseur = Component->m_Pos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
||||
DrawPanel->ManageCurseur = ShowWhileMoving;
|
||||
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
|
||||
m_CurrentScreen->SetCurItem( Component );
|
||||
GetScreen()->SetCurItem( Component );
|
||||
OldPos = Component->m_Pos;
|
||||
memcpy( OldTransMat, Component->m_Transform, sizeof(OldTransMat) );
|
||||
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
#include "../bitmaps/treensel.xpm"
|
||||
|
||||
|
||||
static void InstallScreenFromSheet(WinEDA_SchematicFrame * frame,
|
||||
DrawSheetStruct * Sheet );
|
||||
static void UpdateScreenFromSheet(WinEDA_SchematicFrame * frame);
|
||||
|
||||
enum {
|
||||
ID_TREECTRL_HIERARCHY = 1600
|
||||
|
@ -31,16 +30,16 @@ enum {
|
|||
|
||||
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 */
|
||||
class TreeItemData: public wxTreeItemData
|
||||
{
|
||||
public:
|
||||
DrawSheetStruct * Sheet;
|
||||
TreeItemData(DrawSheetStruct * sheet) :wxTreeItemData()
|
||||
{
|
||||
Sheet = sheet;
|
||||
}
|
||||
DrawSheetList m_SheetList;
|
||||
TreeItemData(DrawSheetList sheet) :wxTreeItemData()
|
||||
{
|
||||
m_SheetList = sheet;
|
||||
}
|
||||
};
|
||||
|
||||
/* Classe de l'arbre de hierarchie */
|
||||
|
@ -82,7 +81,7 @@ class WinEDA_HierFrame : public wxDialog
|
|||
public:
|
||||
WinEDA_SchematicFrame * m_Parent;
|
||||
WinEDA_Tree * m_Tree;
|
||||
int nbsheets;
|
||||
int m_nbsheets;
|
||||
wxDC * m_DC;
|
||||
|
||||
private:
|
||||
|
@ -91,8 +90,7 @@ private:
|
|||
|
||||
public:
|
||||
WinEDA_HierFrame(WinEDA_SchematicFrame *parent, wxDC * DC, const wxPoint& pos);
|
||||
void BuildSheetList(EDA_BaseStruct * DrawStruct,
|
||||
wxTreeItemId * previousmenu);
|
||||
void BuildSheetList(DrawSheetList * list, wxTreeItemId * previousmenu);
|
||||
~WinEDA_HierFrame();
|
||||
|
||||
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),
|
||||
DIALOG_STYLE)
|
||||
{
|
||||
wxTreeItemId cellule;
|
||||
wxTreeItemId cellule;
|
||||
|
||||
m_Parent = parent;
|
||||
m_DC = DC;
|
||||
m_Tree = new WinEDA_Tree(this);
|
||||
|
||||
nbsheets = 1;
|
||||
m_nbsheets = 1;
|
||||
|
||||
cellule = m_Tree->AddRoot(_("Root"), 0, 1);
|
||||
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;
|
||||
#ifdef __UNIX__
|
||||
|
@ -145,20 +145,18 @@ wxRect itemrect;
|
|||
m_TreeSize.x = itemrect.GetWidth() + 10;
|
||||
m_TreeSize.y = 20;
|
||||
|
||||
if (ScreenSch == m_Parent->m_CurrentScreen )
|
||||
{
|
||||
m_Tree->SelectItem(cellule);
|
||||
}
|
||||
if( m_Parent->GetSheet()->Last() == g_RootSheet )
|
||||
m_Tree->SelectItem(cellule); //root.
|
||||
|
||||
maxposx = 15;
|
||||
BuildSheetList(ScreenSch->EEDrawList, &cellule);
|
||||
BuildSheetList(&list, &cellule);
|
||||
|
||||
if ( nbsheets > 1)
|
||||
if ( m_nbsheets > 1)
|
||||
{
|
||||
m_Tree->Expand(cellule);
|
||||
|
||||
// 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.y = MIN( m_TreeSize.y, 350);
|
||||
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)
|
||||
/********************************************************************/
|
||||
/* Routine de creation de l'arbre de navigation dans la hierarchy
|
||||
|
@ -188,33 +186,27 @@ schematique
|
|||
*/
|
||||
{
|
||||
wxTreeItemId menu;
|
||||
SCH_SCREEN * Screen;
|
||||
|
||||
if( nbsheets > NB_MAX_SHEET )
|
||||
{
|
||||
if( nbsheets == (NB_MAX_SHEET + 1) )
|
||||
{
|
||||
if( m_nbsheets > NB_MAX_SHEET ){
|
||||
if( m_nbsheets == (NB_MAX_SHEET + 1) ){
|
||||
wxString msg;
|
||||
msg << wxT("BuildSheetList: Error: nbsheets > ") << NB_MAX_SHEET;
|
||||
DisplayError(this, msg);
|
||||
nbsheets++;
|
||||
m_nbsheets++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
maxposx += m_Tree->GetIndent();
|
||||
|
||||
while( DrawStruct )
|
||||
{
|
||||
if(DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
#define STRUCT ((DrawSheetStruct*)DrawStruct)
|
||||
nbsheets++;
|
||||
EDA_BaseStruct* bs = list->LastDrawList();
|
||||
while(bs && m_nbsheets < NB_MAX_SHEET){
|
||||
if(bs->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*)bs;
|
||||
m_nbsheets++;
|
||||
menu = m_Tree->AppendItem(*previousmenu,
|
||||
STRUCT->m_SheetName, 0 , 1 );
|
||||
m_Tree->SetItemData( menu, new TreeItemData(STRUCT) );
|
||||
// m_Tree->SetItemFont( menu, *StdFont);
|
||||
|
||||
ss->m_SheetName, 0 , 1 );
|
||||
list->Push(ss);
|
||||
m_Tree->SetItemData( menu, new TreeItemData(*list) );
|
||||
int ll = m_Tree->GetItemText(menu).Len();
|
||||
#ifdef __WINDOWS__
|
||||
ll *= 9; // * char width
|
||||
|
@ -224,27 +216,15 @@ SCH_SCREEN * Screen;
|
|||
ll += maxposx + 20;
|
||||
m_TreeSize.x = MAX(m_TreeSize.x, ll);
|
||||
m_TreeSize.y += 1;
|
||||
|
||||
Screen = (SCH_SCREEN*) DrawStruct;
|
||||
if (Screen == m_Parent->m_CurrentScreen )
|
||||
{
|
||||
if ( *list == *(m_Parent->GetSheet()) ){
|
||||
m_Tree->EnsureVisible(menu);
|
||||
m_Tree->SelectItem(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);
|
||||
}
|
||||
}
|
||||
BuildSheetList(list, &menu);
|
||||
m_Tree->Expand(menu);
|
||||
list->Pop();
|
||||
}
|
||||
DrawStruct = DrawStruct->Pnext;
|
||||
bs = bs->Pnext;
|
||||
}
|
||||
maxposx -= m_Tree->GetIndent();
|
||||
}
|
||||
|
@ -254,63 +234,37 @@ SCH_SCREEN * Screen;
|
|||
void WinEDA_HierFrame::OnSelect(wxTreeEvent& event)
|
||||
/***************************************************/
|
||||
/* 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();
|
||||
Sheet = ((TreeItemData*)(m_Tree->GetItemData(ItemSel)))->Sheet;
|
||||
InstallScreenFromSheet(m_Parent, Sheet);
|
||||
*(m_Parent->m_CurrentSheet) =
|
||||
((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);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************/
|
||||
void WinEDA_SchematicFrame::InstallPreviousScreen()
|
||||
void WinEDA_SchematicFrame::InstallPreviousSheet()
|
||||
/******************************************************/
|
||||
/* Set the current screen to display the parent sheet of the current displayed sheet
|
||||
*/
|
||||
{
|
||||
SCH_SCREEN * Screen;
|
||||
EDA_BaseStruct * DrawStruct;
|
||||
|
||||
if( m_CurrentScreen == ScreenSch ) return;
|
||||
if( m_CurrentSheet->Last() == g_RootSheet ) return;
|
||||
|
||||
g_ItemToRepeat = NULL;
|
||||
MsgPanel->EraseMsgBox();
|
||||
|
||||
/* Build the screen list */
|
||||
EDA_ScreenList ScreenList(NULL);
|
||||
|
||||
/* search the list which have the current scheet in EEDrawList */
|
||||
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"));
|
||||
//make a copy for testing purposes.
|
||||
DrawSheetList listtemp = *m_CurrentSheet;
|
||||
listtemp.Pop();
|
||||
if ( listtemp.LastScreen() == NULL ){
|
||||
DisplayError( this, wxT("InstallPreviousScreen() Error: Sheet not found"));
|
||||
return;
|
||||
}
|
||||
m_CurrentScreen = ActiveScreen = Screen;
|
||||
DrawPanel->m_CanStartBlock = -1;
|
||||
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();
|
||||
m_CurrentSheet->Pop();
|
||||
UpdateScreenFromSheet(this);
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
|
@ -318,22 +272,23 @@ void WinEDA_SchematicFrame::InstallNextScreen(DrawSheetStruct * Sheet)
|
|||
/*********************************************************************/
|
||||
/* Routine d'installation de l'ecran correspondant au symbole Sheet pointe
|
||||
par la souris
|
||||
have to be careful here because the DrawSheetStructs within the EEDrawList
|
||||
don't actually have a valid m_s (on purpose -- you need the m_SubSheet hierarchy
|
||||
to maintain path info (well, this is but one way to maintain path info..)
|
||||
*/
|
||||
{
|
||||
if( Sheet == NULL)
|
||||
{
|
||||
DisplayError(this,wxT("InstallNextScreen() error")); return;
|
||||
}
|
||||
m_CurrentSheet->Push(Sheet);
|
||||
g_ItemToRepeat = NULL;
|
||||
MsgPanel->EraseMsgBox();
|
||||
InstallScreenFromSheet(this, Sheet );
|
||||
UpdateScreenFromSheet(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
static void InstallScreenFromSheet(WinEDA_SchematicFrame * frame,
|
||||
DrawSheetStruct * Sheet )
|
||||
static void UpdateScreenFromSheet(WinEDA_SchematicFrame * frame)
|
||||
/**************************************************************/
|
||||
|
||||
/* Recherche et installe de l'ecran relatif au sheet symbole Sheet.
|
||||
|
@ -341,36 +296,34 @@ static void InstallScreenFromSheet(WinEDA_SchematicFrame * frame,
|
|||
*/
|
||||
|
||||
{
|
||||
SCH_SCREEN * NewScreen;
|
||||
SCH_SCREEN * oldscreen = (SCH_SCREEN*) frame->m_CurrentScreen;
|
||||
SCH_SCREEN * NewScreen;
|
||||
//SCH_SCREEN * oldscreen = frame->GetScreen(); what is oldscreen used for?
|
||||
|
||||
if( Sheet == NULL ) NewScreen = ScreenSch;
|
||||
else NewScreen = Sheet;
|
||||
NewScreen = frame->m_CurrentSheet->LastScreen();
|
||||
if(!NewScreen)
|
||||
NewScreen = g_RootSheet->m_s;
|
||||
|
||||
frame->m_CurrentScreen = ActiveScreen = NewScreen;
|
||||
if ( oldscreen != frame->m_CurrentScreen )
|
||||
{ // Reinit des parametres d'affichage du nouvel ecran
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
frame->DrawPanel->SetScrollbars( frame->DrawPanel->m_Scroll_unit,
|
||||
frame->DrawPanel->m_Scroll_unit,
|
||||
NewScreen->m_ScrollbarNumber.x,
|
||||
NewScreen->m_ScrollbarNumber.y,
|
||||
NewScreen->m_ScrollbarPos.x,
|
||||
NewScreen->m_ScrollbarPos.y,TRUE);
|
||||
// Reinit des parametres d'affichage du nouvel ecran
|
||||
// assumes m_CurrentSheet has already been updated.
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
frame->DrawPanel->SetScrollbars( frame->DrawPanel->m_Scroll_unit,
|
||||
frame->DrawPanel->m_Scroll_unit,
|
||||
NewScreen->m_ScrollbarNumber.x,
|
||||
NewScreen->m_ScrollbarNumber.y,
|
||||
NewScreen->m_ScrollbarPos.x,
|
||||
NewScreen->m_ScrollbarPos.y,TRUE);
|
||||
|
||||
frame->DrawPanel->m_CanStartBlock = -1;
|
||||
if ( NewScreen->m_FirstRedraw )
|
||||
{
|
||||
NewScreen->m_FirstRedraw = FALSE;
|
||||
frame->Zoom_Automatique(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
frame->ReDrawPanel();
|
||||
frame->DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
//update the References
|
||||
frame->m_CurrentSheet->UpdateAllScreenReferences();
|
||||
frame->DrawPanel->m_CanStartBlock = -1;
|
||||
if ( NewScreen->m_FirstRedraw ){
|
||||
NewScreen->m_FirstRedraw = FALSE;
|
||||
frame->Zoom_Automatique(TRUE);
|
||||
}else{
|
||||
frame->ReDrawPanel();
|
||||
frame->DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
|
||||
ActiveScreen = frame->m_CurrentSheet->LastScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -145,14 +145,14 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
* Commands are case insensitive
|
||||
*/
|
||||
{
|
||||
bool ItemInEdit = m_CurrentScreen->GetCurItem()
|
||||
&& m_CurrentScreen->GetCurItem()->m_Flags;
|
||||
bool ItemInEdit = GetScreen()->GetCurItem()
|
||||
&& GetScreen()->GetCurItem()->m_Flags;
|
||||
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
|
||||
|
||||
if( hotkey == 0 )
|
||||
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...)
|
||||
if( (hotkey & GR_KB_CTRL) != 0 )
|
||||
|
@ -179,7 +179,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
break;
|
||||
|
||||
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;
|
||||
|
||||
case HK_ZOOM_IN:
|
||||
|
@ -217,9 +217,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
if( ItemInEdit )
|
||||
break;
|
||||
RefreshToolBar = LocateAndDeleteItem( this, DC );
|
||||
m_CurrentScreen->SetModify();
|
||||
m_CurrentScreen->SetCurItem( NULL );
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
break;
|
||||
|
||||
case HK_REPEAT_LAST:
|
||||
|
@ -276,11 +276,11 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
if( DrawStruct == NULL )
|
||||
{
|
||||
DrawStruct = PickStruct( GetScreen()->m_Curseur,
|
||||
GetScreen()->EEDrawList, LIBITEM | TEXTITEM | LABELITEM );
|
||||
GetScreen(), LIBITEM | TEXTITEM | LABELITEM );
|
||||
if( DrawStruct == NULL )
|
||||
break;
|
||||
if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
|
||||
if( DrawStruct == NULL )
|
||||
break;
|
||||
}
|
||||
|
@ -301,6 +301,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
if( DrawStruct->m_Flags == 0 )
|
||||
{
|
||||
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
|
||||
|
@ -317,7 +318,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
|
||||
case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component)
|
||||
if( DrawStruct == NULL )
|
||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
|
||||
if( DrawStruct )
|
||||
{
|
||||
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)
|
||||
if( DrawStruct == NULL )
|
||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
|
||||
if( DrawStruct )
|
||||
{
|
||||
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)
|
||||
if( DrawStruct == NULL )
|
||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
|
||||
if( DrawStruct )
|
||||
{
|
||||
if( DrawStruct->m_Flags == 0 )
|
||||
|
@ -357,7 +358,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
}
|
||||
CmpRotationMiroir(
|
||||
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_NORMAL );
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( (SCH_SCREEN*)GetScreen()->EEDrawList, DC );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -366,10 +367,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
if( ItemInEdit )
|
||||
break;
|
||||
if( DrawStruct == NULL )
|
||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
|
||||
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 );
|
||||
|
||||
wxPostEvent( this, event );
|
||||
|
@ -379,7 +380,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
if( ItemInEdit )
|
||||
break;
|
||||
if( DrawStruct == NULL )
|
||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
|
||||
if(DrawStruct)
|
||||
{
|
||||
EditComponentValue(
|
||||
|
@ -391,7 +392,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
if( ItemInEdit )
|
||||
break;
|
||||
if( DrawStruct == NULL )
|
||||
DrawStruct = LocateSmallestComponent( GetScreen() );
|
||||
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
|
||||
if(DrawStruct)
|
||||
{
|
||||
EditComponentFootprint(
|
||||
|
@ -414,14 +415,14 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
* Commands are case insensitive
|
||||
*/
|
||||
{
|
||||
bool ItemInEdit = m_CurrentScreen->GetCurItem()
|
||||
&& m_CurrentScreen->GetCurItem()->m_Flags;
|
||||
bool ItemInEdit = GetScreen()->GetCurItem()
|
||||
&& GetScreen()->GetCurItem()->m_Flags;
|
||||
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
|
||||
|
||||
if( hotkey == 0 )
|
||||
return;
|
||||
|
||||
wxPoint MousePos = m_CurrentScreen->m_MousePosition;
|
||||
wxPoint MousePos = GetScreen()->m_MousePosition;
|
||||
|
||||
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
|
||||
|
||||
|
@ -448,7 +449,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
break;
|
||||
|
||||
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;
|
||||
|
||||
case HK_ZOOM_IN:
|
||||
|
|
|
@ -27,15 +27,15 @@ static int TriListEntry(EDA_LibComponentStruct **Objet1,
|
|||
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
|
||||
retourne TRUE si fichier créé
|
||||
retourne TRUE si fichier cr<EFBFBD><EFBFBD>
|
||||
*/
|
||||
{
|
||||
wxString DocFileName, msg;
|
||||
char Line[256];
|
||||
FILE *ArchiveFile, *DocFile;
|
||||
EDA_BaseStruct ** ListStruct;
|
||||
ListComponent * List;
|
||||
EDA_LibComponentStruct ** ListEntry, *Entry;
|
||||
int ii, NbItems;
|
||||
const wxChar * Text;
|
||||
|
@ -45,12 +45,11 @@ const wxChar * Text;
|
|||
NbItems = GenListeCmp(NULL ); // Comptage des composants
|
||||
if ( NbItems == 0 ) return FALSE;
|
||||
|
||||
ListStruct = (EDA_BaseStruct **)
|
||||
MyZMalloc( NbItems * sizeof(EDA_BaseStruct **) );
|
||||
if (ListStruct == NULL ) return FALSE;
|
||||
List = (ListComponent *) MyZMalloc( NbItems * sizeof( ListComponent ) );
|
||||
if (List == NULL ) return FALSE;
|
||||
|
||||
/* Calcul de la liste des composants */
|
||||
GenListeCmp(ListStruct);
|
||||
GenListeCmp(List);
|
||||
|
||||
/* Calcul de la liste des Entrees de librairie
|
||||
et Remplacement des alias par les composants "Root" */
|
||||
|
@ -60,12 +59,12 @@ const wxChar * Text;
|
|||
|
||||
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);
|
||||
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 *),
|
||||
(int(*)(const void*, const void*))TriListEntry);
|
||||
|
@ -95,7 +94,7 @@ const wxChar * Text;
|
|||
/* Generation des elements */
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ void FreeLibraryEntry( LibCmpEntry* Entry )
|
|||
/* Used by PQFreeFunc() to delete all entries
|
||||
*/
|
||||
{
|
||||
delete Entry;
|
||||
SAFE_DELETE( Entry );
|
||||
}
|
||||
|
||||
|
||||
|
@ -197,7 +197,7 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
|
|||
while( field )
|
||||
{
|
||||
TempField = field; field = (LibDrawField*) field->Pnext;
|
||||
delete TempField;
|
||||
SAFE_DELETE( TempField );
|
||||
}
|
||||
|
||||
/* suppression des elements dependants */
|
||||
|
@ -205,7 +205,7 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
|
|||
while( DrawItem )
|
||||
{
|
||||
NextDrawItem = DrawItem->Next();
|
||||
delete DrawItem;
|
||||
SAFE_DELETE( DrawItem );
|
||||
DrawItem = NextDrawItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,11 +98,10 @@ EDA_LibComponentStruct *LibEntry = NULL;
|
|||
|
||||
ScreenLib->ClrModify();
|
||||
CurrentDrawItem = NULL;
|
||||
// Effacement ancien composant affiché
|
||||
// Effacement ancien composant affich<EFBFBD>
|
||||
if( CurrentLibEntry)
|
||||
{
|
||||
delete CurrentLibEntry;
|
||||
CurrentLibEntry = NULL;
|
||||
SAFE_DELETE( CurrentLibEntry ) ;
|
||||
}
|
||||
|
||||
/* Chargement du composant */
|
||||
|
@ -159,7 +158,7 @@ const wxChar * CmpName, *RootName = NULL;
|
|||
CurrentAliasName = CmpName;
|
||||
}
|
||||
|
||||
if( CurrentLibEntry) delete CurrentLibEntry;
|
||||
if( CurrentLibEntry){ SAFE_DELETE( CurrentLibEntry ) ;}
|
||||
|
||||
CurrentLibEntry = CopyLibEntryStruct(this, LibEntry);
|
||||
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 */
|
||||
{
|
||||
if( m_CurrentScreen == NULL ) return;
|
||||
if( GetScreen() == NULL ) return;
|
||||
|
||||
ActiveScreen = GetScreen();
|
||||
|
||||
|
@ -209,7 +208,7 @@ void WinEDA_LibeditFrame::RedrawActiveWindow(wxDC * DC, bool EraseBg)
|
|||
DrawPanel->ManageCurseur(DrawPanel, DC, FALSE); // reaffichage lie au curseur
|
||||
}
|
||||
|
||||
m_CurrentScreen->ClrRefreshReq();
|
||||
GetScreen()->ClrRefreshReq();
|
||||
DisplayLibInfos();
|
||||
Affiche_Status_Box();
|
||||
}
|
||||
|
@ -260,7 +259,7 @@ void WinEDA_LibeditFrame::DisplayCmpDoc(const wxString & Name)
|
|||
/**************************************************************/
|
||||
/*
|
||||
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;
|
||||
|
@ -400,8 +399,8 @@ int diag;
|
|||
NewStruct->m_Prefix.m_Text = wxT("U");
|
||||
NewStruct->m_Prefix.m_Text.MakeUpper();
|
||||
|
||||
// Effacement ancien composant affiché
|
||||
if( CurrentLibEntry) delete CurrentLibEntry;
|
||||
// Effacement ancien composant affich<EFBFBD>
|
||||
if( CurrentLibEntry){ SAFE_DELETE( CurrentLibEntry );}
|
||||
CurrentLibEntry = NewStruct;
|
||||
CurrentUnit = 1;
|
||||
CurrentConvert = 1;
|
||||
|
@ -460,7 +459,7 @@ EDA_LibCmpAliasStruct * AliasEntry;
|
|||
|
||||
/* Effacement memoire pour cet alias */
|
||||
PQDelete( &Library->m_Entries, (void*) Entry );
|
||||
delete Entry;
|
||||
SAFE_DELETE( Entry );
|
||||
if( Library->m_NumOfParts > 0 ) CurrentLib->m_NumOfParts --;
|
||||
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
|
||||
{
|
||||
PQDelete( &Library->m_Entries, Entry );
|
||||
delete Entry;
|
||||
SAFE_DELETE( Entry );
|
||||
if( Library->m_NumOfParts > 0 ) Library->m_NumOfParts --;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -52,21 +52,21 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
}
|
||||
else
|
||||
{
|
||||
DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry,
|
||||
DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
|
||||
CurrentUnit, CurrentConvert );
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DrawEntry = LocateDrawItem( GetScreen(), GetScreen()->m_MousePosition,
|
||||
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), GetScreen()->m_MousePosition,
|
||||
CurrentLibEntry, CurrentUnit,
|
||||
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
||||
}
|
||||
|
||||
if( DrawEntry == NULL )
|
||||
DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry,
|
||||
DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
|
||||
CurrentUnit, CurrentConvert );
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DrawEntry = LocateDrawItem( GetScreen(), GetScreen()->m_Curseur,
|
||||
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), GetScreen()->m_Curseur,
|
||||
CurrentLibEntry, CurrentUnit,
|
||||
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
||||
}
|
||||
|
@ -124,21 +124,23 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
break;
|
||||
|
||||
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
||||
DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry,
|
||||
DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
|
||||
CurrentUnit, CurrentConvert );
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DrawEntry = LocateDrawItem( GetScreen(), m_CurrentScreen->m_MousePosition,
|
||||
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
|
||||
GetScreen()->m_MousePosition,
|
||||
CurrentLibEntry, CurrentUnit,
|
||||
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
||||
}
|
||||
|
||||
if( DrawEntry == NULL )
|
||||
DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry,
|
||||
DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
|
||||
CurrentUnit, CurrentConvert );
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DrawEntry = LocateDrawItem( GetScreen(), m_CurrentScreen->m_Curseur,
|
||||
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
|
||||
GetScreen()->m_Curseur,
|
||||
CurrentLibEntry, CurrentUnit,
|
||||
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
||||
}
|
||||
|
@ -154,7 +156,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
else
|
||||
DeleteOneLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, DrawEntry, TRUE );
|
||||
DrawEntry = NULL;
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
break;
|
||||
|
||||
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 )
|
||||
/*************************************************************************/
|
||||
|
||||
/* Appelé sur un double click:
|
||||
* pour un élément editable (textes, composant):
|
||||
/* Appel<EFBFBD> sur un double click:
|
||||
* pour un <EFBFBD>l<EFBFBD>ment editable (textes, composant):
|
||||
* appel de l'editeur correspondant.
|
||||
* pour une connexion en cours:
|
||||
* 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
|
||||
|| (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
|
||||
{
|
||||
DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry,
|
||||
DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
|
||||
CurrentUnit, CurrentConvert );
|
||||
if( DrawEntry == NULL )
|
||||
DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry,
|
||||
DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
|
||||
CurrentUnit, CurrentConvert );
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) m_CurrentScreen,
|
||||
m_CurrentScreen->m_MousePosition,
|
||||
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
||||
GetScreen()->m_MousePosition,
|
||||
CurrentLibEntry, CurrentUnit,
|
||||
CurrentConvert,
|
||||
LOCATE_ALL_DRAW_ITEM );
|
||||
}
|
||||
if( DrawEntry == NULL )
|
||||
{
|
||||
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) m_CurrentScreen,
|
||||
m_CurrentScreen->m_Curseur,
|
||||
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
||||
GetScreen()->m_Curseur,
|
||||
CurrentLibEntry, CurrentUnit,
|
||||
CurrentConvert,
|
||||
LOCATE_ALL_DRAW_ITEM );
|
||||
|
@ -247,7 +249,7 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
switch( DrawEntry->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 );
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu
|
|||
/********************************************************************************/
|
||||
{
|
||||
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;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ EDA_LibComponentStruct * CopyItem;
|
|||
while ( GetScreen()->m_RedoList )
|
||||
{
|
||||
item = GetScreen()->m_RedoList->Pnext;
|
||||
delete GetScreen()->m_RedoList;
|
||||
delete (GetScreen()->m_RedoList);
|
||||
GetScreen()->m_RedoList = item;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,10 +35,10 @@ static void ExitMoveField(WinEDA_DrawPanel * Panel, wxDC * DC)
|
|||
if(CurrentDrawItem == NULL) return;
|
||||
|
||||
wxPoint curpos;
|
||||
curpos = Panel->m_Parent->m_CurrentScreen->m_Curseur;
|
||||
Panel->m_Parent->m_CurrentScreen->m_Curseur = StartCursor;
|
||||
curpos = Panel->m_Parent->GetScreen()->m_Curseur;
|
||||
Panel->m_Parent->GetScreen()->m_Curseur = StartCursor;
|
||||
ShowMoveField(Panel, DC, TRUE);
|
||||
Panel->m_Parent->m_CurrentScreen->m_Curseur = curpos;
|
||||
Panel->m_Parent->GetScreen()->m_Curseur = curpos;
|
||||
CurrentDrawItem->m_Flags = 0;
|
||||
|
||||
CurrentDrawItem = NULL;
|
||||
|
@ -61,13 +61,13 @@ wxPoint startPos;
|
|||
startPos.x = LastTextPosition.x;
|
||||
startPos.y = -LastTextPosition.y;
|
||||
DrawPanel->CursorOff(DC);
|
||||
m_CurrentScreen->m_Curseur = startPos;
|
||||
GetScreen()->m_Curseur = startPos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
||||
DrawPanel->ManageCurseur = ShowMoveField;
|
||||
DrawPanel->ForceCloseManageCurseur = ExitMoveField;
|
||||
DrawPanel->ManageCurseur(DrawPanel, DC, TRUE);
|
||||
StartCursor = m_CurrentScreen->m_Curseur;
|
||||
StartCursor = GetScreen()->m_Curseur;
|
||||
|
||||
DrawPanel->CursorOn(DC);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth);
|
|||
|
||||
DrawPanel->CursorOn(DC);
|
||||
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
CurrentDrawItem = NULL;
|
||||
|
@ -228,7 +228,7 @@ int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth);
|
|||
Field->m_Size,
|
||||
Field->m_HJustify, Field->m_VJustify, LineWidth);
|
||||
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
|
||||
if ( Field->m_FieldId == VALUE ) ReCreateHToolbar();
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ int color;
|
|||
|
||||
if( Field == NULL) return;
|
||||
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
switch (Field->m_FieldId)
|
||||
{
|
||||
case REFERENCE:
|
||||
|
@ -312,8 +312,8 @@ int hjustify, vjustify;
|
|||
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 += dy;
|
||||
x1 = x0 + dx; y1 = y0 + dy;
|
||||
|
||||
if( (m_CurrentScreen->m_Curseur.x >= x0) && ( m_CurrentScreen->m_Curseur.x <= x1) &&
|
||||
(m_CurrentScreen->m_Curseur.y >= y0) && ( m_CurrentScreen->m_Curseur.y <= y1) )
|
||||
if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) &&
|
||||
(GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) )
|
||||
return &LibEntry->m_Name;
|
||||
|
||||
/* Localisation du Prefix */
|
||||
|
@ -329,8 +329,8 @@ int hjustify, vjustify;
|
|||
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy;
|
||||
x1 = x0 + dx; y1 = y0 + dy;
|
||||
|
||||
if( (m_CurrentScreen->m_Curseur.x >= x0) && ( m_CurrentScreen->m_Curseur.x <= x1) &&
|
||||
(m_CurrentScreen->m_Curseur.y >= y0) && ( m_CurrentScreen->m_Curseur.y <= y1) )
|
||||
if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) &&
|
||||
(GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) )
|
||||
return &LibEntry->m_Prefix;
|
||||
|
||||
/* Localisation des autres fields */
|
||||
|
@ -349,8 +349,8 @@ int hjustify, vjustify;
|
|||
if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2;
|
||||
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy;
|
||||
x1 = x0 + dx; y1 = y0 + dy;
|
||||
if( (m_CurrentScreen->m_Curseur.x >= x0) && ( m_CurrentScreen->m_Curseur.x <= x1) &&
|
||||
(m_CurrentScreen->m_Curseur.y >= y0) && ( m_CurrentScreen->m_Curseur.y <= y1) )
|
||||
if( (GetScreen()->m_Curseur.x >= x0) && ( GetScreen()->m_Curseur.x <= x1) &&
|
||||
(GetScreen()->m_Curseur.y >= y0) && ( GetScreen()->m_Curseur.y <= y1) )
|
||||
return(Field);
|
||||
}
|
||||
|
||||
|
@ -367,16 +367,16 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor()
|
|||
|
||||
if ( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
|
||||
{ // Simple localisation des elements
|
||||
DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert);
|
||||
DrawEntry = LocatePin(GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert);
|
||||
if ( DrawEntry == NULL )
|
||||
{
|
||||
DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(),
|
||||
DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)GetScreen(),
|
||||
GetScreen()->m_MousePosition,CurrentLibEntry,CurrentUnit,
|
||||
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
|
||||
}
|
||||
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);
|
||||
}
|
||||
if ( DrawEntry == NULL )
|
||||
|
|
|
@ -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,
|
||||
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()
|
||||
|
@ -90,7 +90,7 @@ WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
|
|||
/**********************************************/
|
||||
{
|
||||
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;
|
||||
|
||||
if( m_CurrentScreen->IsModify() )
|
||||
if( GetScreen()->IsModify() )
|
||||
{
|
||||
if( !IsOK( this, _( "Component was modified!\nDiscard changes?" ) ) )
|
||||
{
|
||||
Event.Veto(); return;
|
||||
}
|
||||
else
|
||||
m_CurrentScreen->ClrModify();
|
||||
GetScreen()->ClrModify();
|
||||
}
|
||||
|
||||
for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
|
||||
|
@ -261,8 +261,8 @@ int WinEDA_LibeditFrame::BestZoom()
|
|||
}
|
||||
else
|
||||
{
|
||||
dx = m_CurrentScreen->m_CurrentSheet->m_Size.x;
|
||||
dy = m_CurrentScreen->m_CurrentSheet->m_Size.y;
|
||||
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
|
||||
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
|
||||
}
|
||||
|
||||
size = DrawPanel->GetClientSize();
|
||||
|
@ -275,12 +275,12 @@ int WinEDA_LibeditFrame::BestZoom()
|
|||
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
m_CurrentScreen->m_Curseur = BoundaryBox.Centre();
|
||||
GetScreen()->m_Curseur = BoundaryBox.Centre();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentScreen->m_Curseur.x = 0;
|
||||
m_CurrentScreen->m_Curseur.y = 0;
|
||||
GetScreen()->m_Curseur.x = 0;
|
||||
GetScreen()->m_Curseur.y = 0;
|
||||
}
|
||||
|
||||
return bestzoom;
|
||||
|
@ -303,7 +303,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
wxGetMousePosition( &pos.x, &pos.y );
|
||||
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_PIN_EDIT:
|
||||
|
@ -339,7 +339,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
switch( id )
|
||||
{
|
||||
case ID_LIBEDIT_SAVE_CURRENT_LIB:
|
||||
if( m_CurrentScreen->IsModify() )
|
||||
if( GetScreen()->IsModify() )
|
||||
{
|
||||
if( IsOK( this, _( "Include last component changes?" ) ) )
|
||||
SaveOnePartInMemory();
|
||||
|
@ -608,7 +608,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
CurrentDrawItem = NULL;
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
DrawPanel->CursorOn( &dc );
|
||||
break;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
/* Fonctions locales */
|
||||
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 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.
|
||||
* Returns TRUE if file has been loaded (at list partially.)
|
||||
* Returns TRUE if file has been loaded (at least partially.)
|
||||
*/
|
||||
{
|
||||
char Line[1024], * SLine;
|
||||
|
@ -105,7 +105,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
MsgDiag = _( "Loading " ) + FullFileName;
|
||||
screen->m_FileName = FullFileName;
|
||||
MsgDiag = _( "Loading " ) + screen->m_FileName;
|
||||
PrintMsg( MsgDiag );
|
||||
|
||||
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" ),
|
||||
LineCount );
|
||||
Failed = TRUE;
|
||||
delete SegmentStruct;
|
||||
SAFE_DELETE( SegmentStruct ) ;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -200,7 +201,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
|
|||
if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 )
|
||||
{
|
||||
MsgDiag.Printf(
|
||||
wxT( "EESchema file Raccord struct error at line %d, aborted" ),
|
||||
wxT( "EESchema file record struct error at line %d, aborted" ),
|
||||
LineCount );
|
||||
Failed = TRUE;
|
||||
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" ),
|
||||
LineCount );
|
||||
Failed = TRUE;
|
||||
delete RaccordStruct;
|
||||
SAFE_DELETE( RaccordStruct ) ;
|
||||
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" ),
|
||||
LineCount );
|
||||
Failed = TRUE;
|
||||
delete PolylineStruct;
|
||||
SAFE_DELETE( PolylineStruct ) ;
|
||||
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" ),
|
||||
LineCount );
|
||||
Failed = TRUE;
|
||||
delete ConnectionStruct;
|
||||
SAFE_DELETE( ConnectionStruct ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -380,10 +381,26 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
|
|||
TextStruct->m_Orient = orient;
|
||||
Struct = (EDA_BaseStruct*) TextStruct;
|
||||
}
|
||||
else if( Name1[0] == 'G' )
|
||||
else if( Name1[0] == 'G')
|
||||
{
|
||||
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;
|
||||
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
|
||||
TextStruct->m_Orient = orient;
|
||||
|
@ -448,6 +465,9 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
|
|||
|
||||
TestDanglingEnds( screen->EEDrawList, NULL );
|
||||
|
||||
MsgDiag = _( "Done Loading " ) + screen->m_FileName;
|
||||
PrintMsg( MsgDiag );
|
||||
|
||||
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 )
|
||||
{
|
||||
for( ii = 0; ii < (int) strlen( Name2 ); ii++ )
|
||||
bool isDigit = false;
|
||||
for( ii = 0; ii < (int) strlen( Name2 ); ii++ ){
|
||||
if( 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 )
|
||||
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
|
||||
* "U " = Num Unit, et Conversion
|
||||
* "Fn" = Champs ( n = 0.. = numero de champ )
|
||||
* "Ar" = AlternateReference, in the case of multiple sheets
|
||||
* referring to one schematic file.
|
||||
*/
|
||||
|
||||
/* Lecture des champs */
|
||||
|
@ -537,6 +578,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
|
|||
return TRUE;
|
||||
if( (Line[0] != 'F' )
|
||||
&& (Line[0] != 'P' )
|
||||
&& (Line[0] != 'A' )
|
||||
&& (Line[0] != 'U' ) )
|
||||
break;
|
||||
|
||||
|
@ -552,7 +594,32 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
|
|||
sscanf( Line + 1, "%d %d",
|
||||
&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' )
|
||||
{
|
||||
char FieldUserName[1024];
|
||||
|
@ -695,6 +762,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
|
|||
{
|
||||
LibItemStruct->Pnext = Window->EEDrawList;
|
||||
Window->EEDrawList = (EDA_BaseStruct*) LibItemStruct;
|
||||
LibItemStruct->m_Parent = Window;
|
||||
}
|
||||
|
||||
return Failed; /* Fin lecture 1 composant */
|
||||
|
@ -717,8 +785,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
|
|||
char* ptcar;
|
||||
|
||||
SheetStruct = new DrawSheetStruct();
|
||||
SheetStruct->m_TimeStamp = GetTimeStamp();
|
||||
SheetStruct->m_Parent = Window;
|
||||
SheetStruct->m_TimeStamp = GetTimeStamp();
|
||||
//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" */
|
||||
{
|
||||
|
@ -749,6 +821,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
|
|||
LineCount++;
|
||||
if( fgets( Line, 256 - 1, f ) == NULL )
|
||||
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' )
|
||||
break;
|
||||
sscanf( Line + 1, "%d", &fieldref );
|
||||
|
@ -804,6 +882,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
|
|||
else
|
||||
{
|
||||
SheetStruct->m_FileName = CONV_FROM_UTF8( Name1 );
|
||||
//printf("in ReadSheetDescr : SheetStruct->m_FileName = %s \n", Name1);
|
||||
SheetStruct->m_FileNameSize = size;
|
||||
}
|
||||
}
|
||||
|
@ -865,13 +944,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
|
|||
LineCount );
|
||||
Failed = TRUE;
|
||||
}
|
||||
|
||||
if( !Failed )
|
||||
{
|
||||
SheetStruct->Pnext = Window->EEDrawList;
|
||||
Window->EEDrawList = (EDA_BaseStruct*) SheetStruct;
|
||||
}
|
||||
|
||||
if( !Failed )
|
||||
{
|
||||
SheetStruct->Pnext = Window->EEDrawList;
|
||||
Window->EEDrawList = (EDA_BaseStruct*)SheetStruct;
|
||||
SheetStruct->m_Parent = Window;
|
||||
}
|
||||
return Failed; /* Fin lecture 1 composant */
|
||||
}
|
||||
|
||||
|
@ -918,7 +996,7 @@ static int ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* W
|
|||
}
|
||||
|
||||
/* Ajuste ecran */
|
||||
Window->m_CurrentSheet = wsheet;
|
||||
Window->m_CurrentSheetDesc = wsheet;
|
||||
|
||||
/* Recheche suite et fin de descr */
|
||||
for( ; ; )
|
||||
|
@ -930,7 +1008,7 @@ static int ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* W
|
|||
|
||||
if( strnicmp( Line, "Sheet", 2 ) == 0 )
|
||||
sscanf( Line + 5, " %d %d",
|
||||
&Window->m_SheetNumber, &Window->m_NumberOfSheet );
|
||||
&Window->m_ScreenNumber, &Window->m_NumberOfScreen );
|
||||
|
||||
if( strnicmp( Line, "Title", 2 ) == 0 )
|
||||
{
|
||||
|
|
|
@ -113,20 +113,19 @@ EDA_SchComponentStruct* LocateSmallestComponent( SCH_SCREEN* Screen )
|
|||
*/
|
||||
/***********************************************************************/
|
||||
EDA_BaseStruct* PickStruct( const wxPoint& refpos,
|
||||
EDA_BaseStruct* DrawList, int SearchMask )
|
||||
BASE_SCREEN* screen, int SearchMask)
|
||||
/************************************************************************/
|
||||
|
||||
/* Search an item at pos pos
|
||||
*/
|
||||
{
|
||||
bool Snapped;
|
||||
int zoom = ActiveScreen->GetZoom();
|
||||
|
||||
if( DrawList == NULL )
|
||||
return NULL;
|
||||
EDA_BaseStruct* DrawList = screen->EEDrawList;
|
||||
if( screen==NULL || DrawList == NULL )
|
||||
return NULL;
|
||||
|
||||
if( ( Snapped = SnapPoint2( refpos, SearchMask,
|
||||
DrawList, NULL, zoom ) ) != FALSE )
|
||||
DrawList, NULL, screen->GetZoom() ) ) != FALSE )
|
||||
{
|
||||
return LastSnappedStruct;
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ EDA_BaseStruct* PickStruct( const wxPoint& refpos,
|
|||
|
||||
/***********************************************************************/
|
||||
EDA_BaseStruct* PickStruct( EDA_Rect& block,
|
||||
EDA_BaseStruct* DrawList, int SearchMask )
|
||||
BASE_SCREEN* screen, int SearchMask )
|
||||
/************************************************************************/
|
||||
|
||||
/* Search items in block
|
||||
|
@ -156,6 +155,10 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
|
|||
if( 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 )
|
||||
{
|
||||
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): */
|
||||
PickedItem = PickedList;
|
||||
PickedList = (DrawPickedStruct*) PickedList->m_PickedStruct;
|
||||
delete PickedItem;
|
||||
SAFE_DELETE( PickedItem ) ;
|
||||
}
|
||||
|
||||
if( PickedList != NULL )
|
||||
|
@ -377,8 +380,9 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
|
|||
|
||||
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawGlobalLabelStruct*) DrawList )
|
||||
#define STRUCT ( (DrawLabelStruct*) DrawList )
|
||||
if( !(SearchMask & LABELITEM) )
|
||||
break;
|
||||
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;
|
||||
break;
|
||||
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawGlobalLabelStruct*) DrawStruct )
|
||||
#define STRUCT ( (DrawLabelStruct*) DrawStruct )
|
||||
dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* longueur totale */
|
||||
dy = STRUCT->m_Size.y / 2; /* Demi hauteur */
|
||||
xt1 = xt2 = STRUCT->m_Pos.x;
|
||||
|
|
|
@ -20,7 +20,7 @@ OBJECTS = eeschema.o\
|
|||
cross-probing.o\
|
||||
setpage.o\
|
||||
cmpclass.o\
|
||||
class_hierarchy_sheet.o\
|
||||
class_drawsheet.o\
|
||||
class_text-label.o\
|
||||
component_class.o\
|
||||
libclass.o\
|
||||
|
|
|
@ -209,7 +209,7 @@ wxString msg;
|
|||
if( m_FilesMenu->FindItem(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++ )
|
||||
|
|
|
@ -24,8 +24,9 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, bool use_
|
|||
|
||||
static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet );
|
||||
static void AddPinToComponentPinList( EDA_SchComponentStruct* Component,
|
||||
DrawSheetList* sheet,
|
||||
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 void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin );
|
||||
|
||||
|
@ -91,7 +92,7 @@ void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
|
|||
|
||||
/****************************************************************************/
|
||||
static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
|
||||
EDA_BaseStruct* DrawList )
|
||||
EDA_BaseStruct* DrawList, DrawSheetList* sheet)
|
||||
/****************************************************************************/
|
||||
|
||||
/* Find a "suitable" component from the DrawList
|
||||
|
@ -116,8 +117,18 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
|
|||
Component = (EDA_SchComponentStruct*) DrawList;
|
||||
|
||||
/* already tested ? : */
|
||||
if( Component->m_FlagControlMulti == 1 )
|
||||
continue; /* yes */
|
||||
bool found = false;
|
||||
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 );
|
||||
if( Entry == NULL )
|
||||
|
@ -125,11 +136,12 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
|
|||
|
||||
/* Power symbol and other component which have the reference starting by
|
||||
* "#" are not included in netlist (pseudo components) */
|
||||
if( Component->m_Field[REFERENCE].m_Text[0] == '#' )
|
||||
wxString str = Component->GetRef(sheet);
|
||||
if( str[0] == '#' )
|
||||
continue;
|
||||
|
||||
/* Create the pin table for this component */
|
||||
int ii = sizeof(ObjetNetListStruct) * MAXPIN;
|
||||
int ii = sizeof(ObjetNetListStruct*) * MAXPIN;
|
||||
if( s_SortedComponentPinList == NULL )
|
||||
s_SortedComponentPinList = (ObjetNetListStruct**) MyMalloc( ii );
|
||||
memset( s_SortedComponentPinList, 0, ii );
|
||||
|
@ -146,14 +158,15 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
|
|||
&& (DEntry->m_Convert != Component->m_Convert) )
|
||||
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 )
|
||||
FindOthersUnits( Component );
|
||||
FindOthersUnits( Component, sheet);
|
||||
|
||||
/* Tri sur le numero de Pin de TabListePin */
|
||||
qsort( s_SortedComponentPinList, s_SortedPinCount, sizeof(ObjetNetListStruct*),
|
||||
|
@ -195,9 +208,9 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
|
|||
{
|
||||
if( g_TabObjNet[jj].GetNet() != netcode )
|
||||
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_PINLABEL) )
|
||||
&& ( g_TabObjNet[jj].m_Type != NET_PINLABEL) )
|
||||
continue;
|
||||
|
||||
NetName = *g_TabObjNet[jj].m_Label;
|
||||
|
@ -206,8 +219,11 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
|
|||
|
||||
if( !NetName.IsEmpty() )
|
||||
{
|
||||
if( g_TabObjNet[jj].m_Type != NET_PINLABEL )
|
||||
NetName << wxT( "_" ) << g_TabObjNet[jj].m_SheetNumber;
|
||||
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
|
||||
NetName = g_TabObjNet[jj].m_SheetList.PathHumanReadable()
|
||||
+ NetName;
|
||||
}
|
||||
//NetName << wxT("_") << g_TabObjNet[jj].m_SheetList.PathHumanReadable();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -217,7 +233,6 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
|
|||
return NetName;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||
const wxString& FullFileName )
|
||||
|
@ -225,10 +240,11 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
|||
|
||||
/* Create a generic netlist, and call an external netlister
|
||||
* to change the netlist syntax and create the file
|
||||
* -- does this still work?
|
||||
*/
|
||||
{
|
||||
wxString Line, FootprintName;
|
||||
BASE_SCREEN* CurrScreen;
|
||||
DrawSheetList* sheet;
|
||||
EDA_BaseStruct* DrawList;
|
||||
EDA_SchComponentStruct* Component;
|
||||
wxString netname;
|
||||
|
@ -250,12 +266,14 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
|||
|
||||
/* Create netlist module section */
|
||||
fprintf( tmpfile, "$BeginComponentList\n" );
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
for( CurrScreen = ScreenList.GetFirst(); CurrScreen != NULL; CurrScreen = ScreenList.GetNext() )
|
||||
{
|
||||
for( DrawList = CurrScreen->EEDrawList; DrawList != NULL; DrawList = DrawList->Pnext )
|
||||
{
|
||||
DrawList = Component = FindNextComponentAndCreatPinList( DrawList );
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
{
|
||||
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext )
|
||||
{
|
||||
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
|
||||
|
||||
if( Component == NULL )
|
||||
break; // No component left
|
||||
|
||||
|
@ -269,7 +287,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
|||
fprintf( tmpfile, "\n$BeginComponent\n" );
|
||||
fprintf( tmpfile, "TimeStamp=%8.8lX\n", Component->m_TimeStamp );
|
||||
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( "_" ) );
|
||||
fprintf( tmpfile, CONV_TO_UTF8( Line ) );
|
||||
|
||||
|
@ -337,7 +355,7 @@ static void ClearUsedFlags( WinEDA_SchematicFrame* frame )
|
|||
SCH_SCREEN* screen;
|
||||
EDA_BaseStruct* DrawList;
|
||||
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
EDA_ScreenList ScreenList;
|
||||
|
||||
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 )
|
||||
{
|
||||
EDA_SchComponentStruct* Component = (EDA_SchComponentStruct*) DrawList;
|
||||
Component->m_FlagControlMulti = 0;
|
||||
//Component->m_FlagControlMulti = 0;
|
||||
Component->m_UsedOnSheets.Clear();
|
||||
}
|
||||
DrawList = DrawList->Pnext;
|
||||
}
|
||||
|
@ -365,14 +384,14 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
|||
* les nodes sont identifies par le netname
|
||||
* sinon les nodes sont identifies par le netnumber
|
||||
*
|
||||
* tous les textes graphiques commençant par [.-+]pspice ou [.-+]gnucap
|
||||
* sont considérés comme des commandes a placer dans la netliste
|
||||
* tous les textes graphiques commen<EFBFBD>ant par [.-+]pspice ou [.-+]gnucap
|
||||
* sont consid<EFBFBD>r<EFBFBD>s comme des commandes a placer dans la netliste
|
||||
* [.-]pspice ou gnucap sont en debut
|
||||
+pspice et +gnucap sont en fin de netliste
|
||||
*/
|
||||
{
|
||||
char Line[1024];
|
||||
SCH_SCREEN* screen;
|
||||
DrawSheetList* sheet;
|
||||
EDA_BaseStruct* DrawList;
|
||||
EDA_SchComponentStruct* Component;
|
||||
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) */
|
||||
/* and create text list starting by [+]pspice , or [+]gnucap (simulator commands) */
|
||||
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;
|
||||
if( DrawList->Type() != DRAW_TEXT_STRUCT_TYPE )
|
||||
|
@ -444,15 +463,15 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
|||
|
||||
/* Create component list */
|
||||
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 )
|
||||
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:
|
||||
for( ii = 0; ii < s_SortedPinCount; ii++ )
|
||||
|
@ -514,11 +533,11 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
|||
{
|
||||
wxString Line, FootprintName;
|
||||
char Buf[256];
|
||||
SCH_SCREEN* CurrScreen;
|
||||
DrawSheetList* sheet;
|
||||
EDA_BaseStruct* DrawList;
|
||||
EDA_SchComponentStruct* Component;
|
||||
int ii;
|
||||
EDA_SchComponentStruct** CmpList = NULL;
|
||||
ListComponent* CmpList = NULL;
|
||||
int CmpListCount = 0, CmpListSize = 1000;
|
||||
|
||||
DateAndTime( Buf );
|
||||
|
@ -528,16 +547,16 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
|||
fprintf( f, "( { %s created %s }\n", NETLIST_HEAD_STRING, Buf );
|
||||
|
||||
|
||||
/* Create netlist module section */
|
||||
/* Create netlist module section */
|
||||
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 )
|
||||
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( CmpList == NULL )
|
||||
CmpList = (EDA_SchComponentStruct**) MyZMalloc( sizeof(
|
||||
EDA_SchComponentStruct
|
||||
*) * CmpListSize );
|
||||
if( CmpList == NULL ){
|
||||
CmpList = (ListComponent*)
|
||||
MyZMalloc( sizeof(ListComponent) * CmpListSize );
|
||||
}
|
||||
if( CmpListCount >= CmpListSize )
|
||||
{
|
||||
CmpListSize += 1000;
|
||||
CmpList = (EDA_SchComponentStruct**) realloc(
|
||||
CmpList = (ListComponent*) realloc(
|
||||
CmpList,
|
||||
sizeof(
|
||||
EDA_SchComponentStruct*)
|
||||
* CmpListSize );
|
||||
sizeof(ListComponent) * CmpListSize );
|
||||
}
|
||||
CmpList[CmpListCount] = Component;
|
||||
CmpList[CmpListCount].m_Comp = Component;
|
||||
strcpy(CmpList[CmpListCount].m_Ref, Component->GetRef( sheet ).mb_str());
|
||||
CmpListCount++;
|
||||
}
|
||||
}
|
||||
|
@ -574,10 +592,9 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
|||
else
|
||||
FootprintName = wxT( "$noname" );
|
||||
|
||||
Line = Component->m_Field[REFERENCE].m_Text;
|
||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||
fprintf( f, " ( %8.8lX %s",
|
||||
Component->m_TimeStamp,
|
||||
Line = Component->GetRef(sheet);
|
||||
fprintf( f, " ( %s %s",
|
||||
CONV_TO_UTF8(Component->GetPath(sheet)),
|
||||
CONV_TO_UTF8( FootprintName ) );
|
||||
fprintf( f, " %s", CONV_TO_UTF8( Line ) );
|
||||
|
||||
|
@ -622,11 +639,16 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
|||
EDA_LibComponentStruct* Entry;
|
||||
for( ii = 0; ii < CmpListCount; ii++ )
|
||||
{
|
||||
Component = CmpList[ii];
|
||||
Component = CmpList[ii].m_Comp;
|
||||
Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
Line = Component->m_Field[REFERENCE].m_Text;
|
||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||
fprintf( f, "$component %s\n", CONV_TO_UTF8( Line ) );
|
||||
//Line.Printf(_("%s"), CmpList[ii].m_Ref);
|
||||
//Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||
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 */
|
||||
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
|
||||
|
@ -669,6 +692,8 @@ static void AddPinToComponentPinList( EDA_SchComponentStruct* Component, LibDraw
|
|||
continue;
|
||||
if( g_TabObjNet[ii].m_Link != Component )
|
||||
continue;
|
||||
if( g_TabObjNet[ii].m_SheetList != *sheetlist )
|
||||
continue;
|
||||
if( g_TabObjNet[ii].m_PinNum != Pin->m_PinNum )
|
||||
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,
|
||||
|
@ -728,13 +753,15 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component )
|
|||
EDA_SchComponentStruct* Component2;
|
||||
EDA_LibComponentStruct* Entry;
|
||||
LibEDA_BaseStruct* DEntry;
|
||||
SCH_SCREEN* screen;
|
||||
DrawSheetList* sheet;
|
||||
wxString str;
|
||||
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
|
||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
EDA_SheetList SheetList( NULL );
|
||||
unsigned int i;
|
||||
bool found;
|
||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
||||
{
|
||||
DrawList = screen->EEDrawList;
|
||||
DrawList = sheet->LastDrawList();
|
||||
while( DrawList )
|
||||
{
|
||||
switch( DrawList->Type() )
|
||||
|
@ -742,17 +769,24 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component )
|
|||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
Component2 = (EDA_SchComponentStruct*) DrawList;
|
||||
|
||||
if( Component2->m_FlagControlMulti == 1 )
|
||||
break;
|
||||
|
||||
if( Component2->m_Field[REFERENCE].m_Text.CmpNoCase(
|
||||
Component->m_Field[REFERENCE].m_Text ) != 0 )
|
||||
found = false;
|
||||
for( i =0; i<Component2->m_UsedOnSheets.GetCount(); i++){
|
||||
if( Component2->m_UsedOnSheets.Item(i) == *Sheet_in ){
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
Entry = FindLibPart( Component2->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
if( Entry == NULL )
|
||||
break;
|
||||
if( Component2->m_Field[REFERENCE].m_Text[0] == '#' )
|
||||
|
||||
if( str[0] == '#' )
|
||||
break;
|
||||
|
||||
if( Entry->m_Drawings != NULL )
|
||||
|
@ -769,11 +803,12 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component )
|
|||
&& (DEntry->m_Convert != Component2->m_Convert) )
|
||||
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;
|
||||
|
||||
default:
|
||||
|
@ -794,12 +829,12 @@ static int SortPinsByNum( ObjetNetListStruct** Pin1, ObjetNetListStruct** Pin2 )
|
|||
* du tableau des pins s_SortedComponentPinList par qsort()
|
||||
*/
|
||||
{
|
||||
ObjetNetListStruct* Obj1, * Obj2;
|
||||
ObjetNetListStruct* Obj1, * Obj2;
|
||||
int Num1, Num2;
|
||||
char Line[5];
|
||||
|
||||
Obj1 = *Pin1; Obj2 = *Pin2;
|
||||
Num1 = Obj1->m_PinNum; Num2 = Obj2->m_PinNum;
|
||||
Obj1 = *Pin1; Obj2 = *Pin2;
|
||||
Num1 = Obj1->m_PinNum; Num2 = Obj2->m_PinNum;
|
||||
Line[4] = 0; memcpy( Line, &Num1, 4 ); Num1 = atoi( Line );
|
||||
memcpy( Line, &Num2, 4 ); Num2 = atoi( Line );
|
||||
return Num1 - Num2;
|
||||
|
@ -832,7 +867,7 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
|
|||
{
|
||||
if( ObjNet[jj].GetNet() != NetCode )
|
||||
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_PINLABEL) )
|
||||
continue;
|
||||
|
@ -845,8 +880,13 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
|
|||
if( !NetName.IsEmpty() )
|
||||
{
|
||||
NetcodeName += NetName;
|
||||
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ) // usual net name, add it the sheet number
|
||||
NetcodeName << wxT( "_" ) << g_TabObjNet[jj].m_SheetNumber;
|
||||
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
|
||||
// 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( "\"" );
|
||||
LastNetCode = NetCode;
|
||||
|
@ -856,7 +896,7 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
|
|||
continue;
|
||||
|
||||
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( "#" ) ) )
|
||||
continue; // Pseudo component (Like Power symbol)
|
||||
|
||||
|
@ -919,7 +959,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
|||
wxString msg;
|
||||
wxString FootprintName;
|
||||
char Line[1024];
|
||||
BASE_SCREEN* CurrScreen;
|
||||
DrawSheetList* sheet;
|
||||
EDA_BaseStruct* DrawList;
|
||||
EDA_SchComponentStruct* Component;
|
||||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
||||
|
@ -933,13 +973,13 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
|||
|
||||
/* Create netlist module section */
|
||||
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 )
|
||||
break;
|
||||
|
||||
|
@ -951,8 +991,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
|||
else
|
||||
FootprintName = wxT( "$noname" );
|
||||
|
||||
msg = Component->m_Field[REFERENCE].m_Text;
|
||||
msg.Replace( wxT( " " ), wxT( "_" ) );
|
||||
msg = Component->GetRef(sheet);
|
||||
fprintf( f, "%s ", CONV_TO_UTF8( StartCmpDesc ) );
|
||||
fprintf( f, "%s", CONV_TO_UTF8( msg ) );
|
||||
|
||||
|
@ -1007,7 +1046,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
|
|||
{
|
||||
if( ObjNet[jj].GetNet() != NetCode )
|
||||
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_PINLABEL) )
|
||||
continue;
|
||||
|
@ -1019,8 +1058,12 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
|
|||
if( !NetName.IsEmpty() )
|
||||
{
|
||||
NetcodeName += NetName;
|
||||
if( g_TabObjNet[jj].m_Type != NET_PINLABEL )
|
||||
NetcodeName << wxT( "_" ) << g_TabObjNet[jj].m_SheetNumber;
|
||||
if( g_TabObjNet[jj].m_Type != NET_PINLABEL ){
|
||||
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>
|
||||
NetcodeName << wxT( "$" ) << NetCode;
|
||||
|
@ -1037,8 +1080,8 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
|
|||
continue;
|
||||
|
||||
Cmp = (EDA_SchComponentStruct*) ObjNet[ii].m_Link;
|
||||
|
||||
if( Cmp->m_Field[REFERENCE].m_Text[0] == '#' )
|
||||
wxString refstr = Cmp->GetRef(&(ObjNet[ii].m_SheetList));
|
||||
if( refstr[0] == '#' )
|
||||
continue; // Pseudo composant (symboles d'alims)
|
||||
|
||||
switch( print_ter )
|
||||
|
@ -1051,7 +1094,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
|
|||
str_pinnum = CONV_FROM_UTF8( buf );
|
||||
InitNetDescLine.Printf( wxT( "\n%s %s %.4s %s" ),
|
||||
InitNetDesc.GetData(),
|
||||
Cmp->m_Field[REFERENCE].m_Text.GetData(),
|
||||
refstr.GetData(),
|
||||
str_pinnum.GetData(), NetcodeName.GetData() );
|
||||
}
|
||||
print_ter++;
|
||||
|
@ -1061,14 +1104,14 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
|
|||
fprintf( f, "%s\n", CONV_TO_UTF8( InitNetDescLine ) );
|
||||
fprintf( f, "%s %s %.4s\n",
|
||||
CONV_TO_UTF8( StartNetDesc ),
|
||||
CONV_TO_UTF8( Cmp->m_Field[REFERENCE].m_Text ),
|
||||
CONV_TO_UTF8( refstr ),
|
||||
(char*) &ObjNet[ii].m_PinNum );
|
||||
print_ter++;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf( f, " %s %.4s\n",
|
||||
CONV_TO_UTF8( Cmp->m_Field[REFERENCE].m_Text ),
|
||||
CONV_TO_UTF8( refstr ),
|
||||
(char*) &ObjNet[ii].m_PinNum );
|
||||
break;
|
||||
}
|
||||
|
@ -1085,7 +1128,9 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
|
|||
continue;
|
||||
EDA_SchComponentStruct* tstcmp =
|
||||
(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;
|
||||
|
||||
if( ObjNet[jj].m_PinNum == ObjNet[ii].m_PinNum )
|
||||
|
|
|
@ -15,16 +15,16 @@
|
|||
|
||||
/* Routines locales */
|
||||
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,
|
||||
SCH_SCREEN* screen,
|
||||
DrawSheetList* sheetlist,
|
||||
ObjetNetListStruct* ObjNet );
|
||||
static int ConvertBusToMembers( ObjetNetListStruct* ObjNet );
|
||||
static void PointToPointConnect( ObjetNetListStruct* RefObj, int IsBus,
|
||||
static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus,
|
||||
int start );
|
||||
static void SegmentToPointConnect( ObjetNetListStruct* Jonction, int IsBus,
|
||||
int start );
|
||||
static void LabelConnection( ObjetNetListStruct* Label );
|
||||
static void LabelConnect( ObjetNetListStruct* Label );
|
||||
static int TriNetCode( const void* o1, const void* o2 );
|
||||
static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems );
|
||||
static void SetUnconnectedFlag( ObjetNetListStruct* ObjNet, int NbItems );
|
||||
|
@ -37,7 +37,7 @@ static int s_PassNumber;
|
|||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
#include <iostream>
|
||||
const char* ShowType( NetObjetType aType )
|
||||
{
|
||||
const char* ret;
|
||||
|
@ -48,9 +48,11 @@ const char* ShowType( NetObjetType aType )
|
|||
case NET_BUS: ret = "bus"; break;
|
||||
case NET_JONCTION: ret = "junction"; break;
|
||||
case NET_LABEL: ret = "label"; break;
|
||||
case NET_GLOBLABEL: ret = "glabel"; break;
|
||||
case NET_HIERLABEL: ret = "hierlabel"; break;
|
||||
case NET_GLOBLABEL: ret = "glabel"; break;
|
||||
case NET_BUSLABELMEMBER: ret = "buslblmember"; break;
|
||||
case NET_GLOBBUSLABELMEMBER: ret = "gbuslblmember"; break;
|
||||
case NET_HIERBUSLABELMEMBER: ret = "hierbuslblmember"; break;
|
||||
case NET_GLOBBUSLABELMEMBER: ret = "gbuslblmember"; break;
|
||||
case NET_SHEETBUSLABELMEMBER: ret = "sbuslblmember"; break;
|
||||
case NET_SHEETLABEL: ret = "sheetlabel"; break;
|
||||
case NET_PINLABEL: ret = "pinlabel"; break;
|
||||
|
@ -64,10 +66,11 @@ const char* ShowType( NetObjetType aType )
|
|||
|
||||
void ObjetNetListStruct::Show( std::ostream& out, int ndx )
|
||||
{
|
||||
wxString path = m_SheetList.PathHumanReadable();
|
||||
out << "<netItem ndx=\"" << ndx << '"' <<
|
||||
" type=\"" << ShowType(m_Type) << '"' <<
|
||||
" netCode=\"" << GetNet() << '"' <<
|
||||
" sheet=\"" << m_SheetNumber << '"' <<
|
||||
" sheet=\"" << CONV_TO_UTF8(path) << '"' <<
|
||||
">\n";
|
||||
|
||||
out << " <start " << m_Start << "/> <end " << m_End << "/>\n";
|
||||
|
@ -117,15 +120,18 @@ void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems )
|
|||
case NET_JONCTION:
|
||||
case NET_BUS:
|
||||
case NET_LABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_HIERLABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_PINLABEL:
|
||||
case NET_NOCONNECT:
|
||||
break;
|
||||
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_HIERBUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
case NET_BUSLABELMEMBER:
|
||||
delete TabNetItems[i].m_Label;
|
||||
SAFE_DELETE( TabNetItems[i].m_Label );
|
||||
//see the note in ConvertBustToMembers
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -137,16 +143,15 @@ void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems )
|
|||
/*****************************************************/
|
||||
void* WinEDA_SchematicFrame::BuildNetListBase()
|
||||
/*****************************************************/
|
||||
|
||||
/* Routine qui construit le tableau des elements connectes du projet
|
||||
* met a jour:
|
||||
* g_TabObjNet
|
||||
* g_NbrObjNet
|
||||
*/
|
||||
{
|
||||
int NetNumber, SheetNumber;
|
||||
int NetNumber;
|
||||
int i, istart, NetCode;
|
||||
SCH_SCREEN* screen;
|
||||
DrawSheetList* sheet;
|
||||
wxString msg;
|
||||
wxBusyCursor Busy;
|
||||
|
||||
|
@ -156,22 +161,19 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
|||
MsgPanel->EraseMsgBox();
|
||||
Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, LIGHTRED );
|
||||
|
||||
/* Build the screen list */
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
|
||||
/* Build the sheet (not screen) list (flattened)*/
|
||||
EDA_SheetList SheetListList( NULL );
|
||||
i=0;
|
||||
/* 1ere passe : Comptage du nombre d'objet de Net */
|
||||
g_NbrObjNet = 0;
|
||||
g_TabObjNet = NULL; /* Init pour le 1er passage dans ListeObjetConnection */
|
||||
|
||||
/* Update the sheet number, sheet count and date and count nelist items */
|
||||
ScreenSch->SetModify();
|
||||
int kk = 1;
|
||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
/* count nelist items */
|
||||
g_RootSheet->m_s->SetModify();
|
||||
|
||||
for( sheet = SheetListList.GetFirst(); sheet != NULL; sheet = SheetListList.GetNext() )
|
||||
{
|
||||
screen->m_SheetNumber = kk++;
|
||||
screen->m_NumberOfSheet = ScreenList.GetCount();
|
||||
screen->m_Date = GenDate();
|
||||
g_NbrObjNet += ListeObjetConnection( this, screen, NULL );
|
||||
g_NbrObjNet += ListeObjetConnection( this, sheet, NULL );
|
||||
}
|
||||
|
||||
if( g_NbrObjNet == 0 )
|
||||
|
@ -186,15 +188,16 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
|||
return NULL;
|
||||
|
||||
/* 2eme passe : Remplissage des champs des structures des objets de Net */
|
||||
/* second pass: fill the fields of the structures in the Net */
|
||||
|
||||
s_PassNumber++;
|
||||
Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, RED );
|
||||
|
||||
screen = ScreenList.GetFirst();
|
||||
sheet = SheetListList.GetFirst();
|
||||
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 );
|
||||
|
@ -209,14 +212,14 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
|||
|
||||
Affiche_1_Parametre( this, 18, _( "Conn" ), wxEmptyString, CYAN );
|
||||
|
||||
SheetNumber = g_TabObjNet[0].m_SheetNumber;
|
||||
sheet = &(g_TabObjNet[0].m_SheetList);
|
||||
LastNetCode = LastBusNetCode = 1;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -227,7 +230,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
|||
case NET_SHEETLABEL:
|
||||
case NET_NOCONNECT:
|
||||
if( g_TabObjNet[i].GetNet() != 0 )
|
||||
break; /* Deja connecte */
|
||||
break; /* Deja connecte */
|
||||
|
||||
case NET_SEGMENT:
|
||||
/* Controle des connexions type point a point ( Sans BUS ) */
|
||||
|
@ -258,7 +261,8 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
|||
break;
|
||||
|
||||
case NET_LABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_HIERLABEL:
|
||||
case NET_GLOBLABEL:
|
||||
/* Controle des connexions type jonction ( Sans BUS ) */
|
||||
if( g_TabObjNet[i].GetNet() == 0 )
|
||||
{
|
||||
|
@ -283,7 +287,8 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
|||
break;
|
||||
|
||||
case NET_BUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_HIERBUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
/* Controle des connexions semblables a des sur BUS */
|
||||
if( g_TabObjNet[i].GetNet() == 0 )
|
||||
{
|
||||
|
@ -297,7 +302,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
|||
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
std::cout << "after sheet local\n";
|
||||
std::cout << "\n\nafter sheet local\n\n";
|
||||
dumpNetTable();
|
||||
#endif
|
||||
|
||||
|
@ -323,20 +328,22 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
|||
break;
|
||||
|
||||
case NET_LABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_PINLABEL:
|
||||
case NET_BUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
LabelConnection( g_TabObjNet + i );
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
LabelConnect( g_TabObjNet + i );
|
||||
break;
|
||||
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
case NET_HIERLABEL:
|
||||
case NET_HIERBUSLABELMEMBER:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
std::cout << "after sheet global\n";
|
||||
std::cout << "\n\nafter sheet global\n\n";
|
||||
dumpNetTable();
|
||||
#endif
|
||||
|
||||
|
@ -349,7 +356,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
|||
{
|
||||
if( g_TabObjNet[i].m_Type == NET_SHEETLABEL
|
||||
|| g_TabObjNet[i].m_Type == NET_SHEETBUSLABELMEMBER )
|
||||
SheetLabelConnection( g_TabObjNet + i );
|
||||
SheetLabelConnect( g_TabObjNet + i );
|
||||
}
|
||||
|
||||
/* 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 *
|
||||
**************************************************************/
|
||||
static void SheetLabelConnection( ObjetNetListStruct* SheetLabel )
|
||||
static void SheetLabelConnect( ObjetNetListStruct* SheetLabel )
|
||||
{
|
||||
int i;
|
||||
ObjetNetListStruct* ObjetNet;
|
||||
|
@ -402,18 +409,18 @@ static void SheetLabelConnection( ObjetNetListStruct* SheetLabel )
|
|||
* pour regroupement des NetCodes */
|
||||
for( i = 0, ObjetNet = g_TabObjNet; i < g_NbrObjNet; i++ )
|
||||
{
|
||||
if( ObjetNet[i].m_SheetNumber != SheetLabel->m_NumInclude )
|
||||
continue;
|
||||
if( ObjetNet[i].m_SheetList != SheetLabel->m_SheetListInclude )
|
||||
continue; //use SheetInclude, not the sheet!!
|
||||
|
||||
if( (ObjetNet[i].m_Type != NET_GLOBLABEL )
|
||||
&& (ObjetNet[i].m_Type != NET_GLOBBUSLABELMEMBER ) )
|
||||
if( (ObjetNet[i].m_Type != NET_HIERLABEL )
|
||||
&& (ObjetNet[i].m_Type != NET_HIERBUSLABELMEMBER ) )
|
||||
continue;
|
||||
|
||||
if( ObjetNet[i].GetNet() == SheetLabel->GetNet() )
|
||||
continue;
|
||||
continue; //already connected.
|
||||
|
||||
if( ObjetNet[i].m_Label->CmpNoCase( *SheetLabel->m_Label ) != 0 )
|
||||
continue;
|
||||
continue; //different names.
|
||||
|
||||
/* Propagation du Netcode a tous les Objets de meme NetCode */
|
||||
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 )
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Routine generant la liste des objets relatifs aux connection
|
||||
* entree:
|
||||
* screen: pointeur sur l'ecran a traiter
|
||||
* sheetlist: pointer to a sheetlist.
|
||||
* ObjNet:
|
||||
* si NULL: la routine compte seulement le nombre des objets
|
||||
* sinon: pointe le tableau a remplir
|
||||
*/
|
||||
{
|
||||
int ii, NbrItem = 0, NumSheet;
|
||||
int ii, NbrItem = 0;
|
||||
EDA_BaseStruct* DrawList;
|
||||
EDA_SchComponentStruct* DrawLibItem;
|
||||
int TransMat[2][2], PartX, PartY, x2, y2;
|
||||
EDA_LibComponentStruct* Entry;
|
||||
LibEDA_BaseStruct* DEntry;
|
||||
DrawSheetLabelStruct* SheetLabel;
|
||||
int NumInclude;
|
||||
DrawSheetList list;
|
||||
|
||||
NumSheet = screen->m_SheetNumber;
|
||||
|
||||
DrawList = screen->EEDrawList;
|
||||
DrawList = sheetlist->LastScreen()->EEDrawList;
|
||||
for( ; DrawList; DrawList = DrawList->Pnext )
|
||||
{
|
||||
if( ObjNet ){
|
||||
ObjNet[NbrItem].m_SheetList = *sheetlist;
|
||||
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
|
||||
//used for DrawSheetLabels
|
||||
}
|
||||
switch( DrawList->Type() )
|
||||
{
|
||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||
|
@ -463,8 +473,6 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
|
|||
break;
|
||||
|
||||
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_End = STRUCT->m_End;
|
||||
|
||||
|
@ -486,9 +494,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
|
|||
if( ObjNet )
|
||||
{
|
||||
ObjNet[NbrItem].m_Comp = STRUCT;
|
||||
ObjNet[NbrItem].m_Screen = screen;
|
||||
ObjNet[NbrItem].m_Type = NET_JONCTION;
|
||||
ObjNet[NbrItem].m_SheetNumber = NumSheet;
|
||||
ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
|
||||
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
|
||||
}
|
||||
|
@ -501,9 +507,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
|
|||
if( ObjNet )
|
||||
{
|
||||
ObjNet[NbrItem].m_Comp = STRUCT;
|
||||
ObjNet[NbrItem].m_Screen = screen;
|
||||
ObjNet[NbrItem].m_Type = NET_NOCONNECT;
|
||||
ObjNet[NbrItem].m_SheetNumber = NumSheet;
|
||||
ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
|
||||
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
|
||||
}
|
||||
|
@ -517,14 +521,14 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
|
|||
if( ObjNet )
|
||||
{
|
||||
ObjNet[NbrItem].m_Comp = STRUCT;
|
||||
ObjNet[NbrItem].m_Screen = screen;
|
||||
ObjNet[NbrItem].m_Type = NET_LABEL;
|
||||
|
||||
if( STRUCT->m_Layer == LAYER_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_SheetNumber = NumSheet;
|
||||
ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
|
||||
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
|
||||
|
||||
|
@ -536,20 +540,21 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
|
|||
break;
|
||||
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawGlobalLabelStruct*) DrawList )
|
||||
#define STRUCT ( (DrawLabelStruct*) DrawList )
|
||||
ii = IsBusLabel( STRUCT->m_Text );
|
||||
if( ObjNet )
|
||||
{
|
||||
ObjNet[NbrItem].m_Comp = STRUCT;
|
||||
ObjNet[NbrItem].m_Screen = screen;
|
||||
ObjNet[NbrItem].m_Type = NET_LABEL;
|
||||
|
||||
if( STRUCT->m_Layer == LAYER_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_SheetNumber = NumSheet;
|
||||
ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
|
||||
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
|
||||
|
||||
|
@ -601,13 +606,12 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
|
|||
if( ObjNet )
|
||||
{
|
||||
ObjNet[NbrItem].m_Comp = DEntry;
|
||||
ObjNet[NbrItem].m_SheetList = *sheetlist;
|
||||
ObjNet[NbrItem].m_Type = NET_PIN;
|
||||
ObjNet[NbrItem].m_Link = DrawLibItem;
|
||||
ObjNet[NbrItem].m_Screen = screen;
|
||||
ObjNet[NbrItem].m_ElectricalType = Pin->m_PinType;
|
||||
ObjNet[NbrItem].m_PinNum = Pin->m_PinNum;
|
||||
ObjNet[NbrItem].m_Label = &Pin->m_PinName;
|
||||
ObjNet[NbrItem].m_SheetNumber = NumSheet;
|
||||
ObjNet[NbrItem].m_Start.x = x2;
|
||||
ObjNet[NbrItem].m_Start.y = y2;
|
||||
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
|
||||
|
@ -621,9 +625,8 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
|
|||
if( ObjNet )
|
||||
{
|
||||
ObjNet[NbrItem].m_Comp = NULL;
|
||||
ObjNet[NbrItem].m_SheetList = *sheetlist;
|
||||
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_Start.x = x2;
|
||||
ObjNet[NbrItem].m_Start.y = y2;
|
||||
|
@ -645,8 +648,8 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
|
|||
case DRAW_SHEET_STRUCT_TYPE:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (DrawSheetStruct*) DrawList )
|
||||
NumInclude = STRUCT->m_SheetNumber;
|
||||
|
||||
list = *sheetlist;
|
||||
list.Push(STRUCT);
|
||||
SheetLabel = STRUCT->m_Label;
|
||||
for( ; SheetLabel != NULL;
|
||||
SheetLabel = (DrawSheetLabelStruct*) SheetLabel->Pnext )
|
||||
|
@ -654,16 +657,15 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* scree
|
|||
ii = IsBusLabel( SheetLabel->m_Text );
|
||||
if( ObjNet )
|
||||
{
|
||||
ObjNet[NbrItem].m_Comp = SheetLabel;
|
||||
ObjNet[NbrItem].m_Link = DrawList;
|
||||
ObjNet[NbrItem].m_Type = NET_SHEETLABEL;
|
||||
ObjNet[NbrItem].m_Screen = screen;
|
||||
ObjNet[NbrItem].m_Comp = SheetLabel;
|
||||
ObjNet[NbrItem].m_SheetList = *sheetlist;
|
||||
ObjNet[NbrItem].m_Link = DrawList;
|
||||
ObjNet[NbrItem].m_Type = NET_SHEETLABEL;
|
||||
ObjNet[NbrItem].m_ElectricalType = SheetLabel->m_Shape;
|
||||
ObjNet[NbrItem].m_Label = &SheetLabel->m_Text;
|
||||
ObjNet[NbrItem].m_SheetNumber = NumSheet;
|
||||
ObjNet[NbrItem].m_NumInclude = NumInclude;
|
||||
ObjNet[NbrItem].m_Start = SheetLabel->m_Pos;
|
||||
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
|
||||
ObjNet[NbrItem].m_Label = &SheetLabel->m_Text;
|
||||
ObjNet[NbrItem].m_SheetListInclude = list;
|
||||
ObjNet[NbrItem].m_Start = SheetLabel->m_Pos;
|
||||
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
|
||||
|
||||
/* Si c'est un Bus, eclatement en Label */
|
||||
if( ii )
|
||||
|
@ -712,7 +714,7 @@ static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems )
|
|||
{
|
||||
if( (Label->m_Type == NET_SHEETBUSLABELMEMBER)
|
||||
|| (Label->m_Type == NET_BUSLABELMEMBER)
|
||||
|| (Label->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
|| (Label->m_Type == NET_HIERBUSLABELMEMBER) )
|
||||
{
|
||||
if( Label->GetNet() == 0 )
|
||||
{
|
||||
|
@ -724,7 +726,7 @@ static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems )
|
|||
{
|
||||
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
|
||||
|| (LabelInTst->m_Type == NET_BUSLABELMEMBER)
|
||||
|| (LabelInTst->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
|| (LabelInTst->m_Type == NET_HIERBUSLABELMEMBER) )
|
||||
{
|
||||
if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
|
||||
continue;
|
||||
|
@ -741,8 +743,6 @@ static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
int IsBusLabel( const wxString& LabelDrawList )
|
||||
/**************************************************/
|
||||
|
@ -830,8 +830,10 @@ static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )
|
|||
int NumItem, BusMember;
|
||||
wxString BufLine;
|
||||
|
||||
if( BusLabel->m_Type == NET_GLOBLABEL )
|
||||
BusLabel->m_Type = NET_GLOBBUSLABELMEMBER;
|
||||
if( BusLabel->m_Type == NET_HIERLABEL )
|
||||
BusLabel->m_Type = NET_HIERBUSLABELMEMBER;
|
||||
else if( BusLabel->m_Type == NET_GLOBLABEL )
|
||||
BusLabel->m_Type = NET_GLOBBUSLABELMEMBER;
|
||||
else if( BusLabel->m_Type == NET_SHEETLABEL )
|
||||
BusLabel->m_Type = NET_SHEETBUSLABELMEMBER;
|
||||
else
|
||||
|
@ -881,6 +883,9 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
|
|||
|
||||
if( OldNetCode == NewNetCode )
|
||||
return;
|
||||
#ifdef DEBUG
|
||||
//printf("replacing net %d with %d\n", OldNetCode,NewNetCode);
|
||||
#endif
|
||||
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* de la feuille de schema
|
||||
* ( il ne peut y avoir connexion physique entre elements de differentes sheets)
|
||||
|
@ -936,15 +941,17 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
|
|||
netCode = Ref->GetNet();
|
||||
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 )
|
||||
{
|
||||
case NET_SEGMENT:
|
||||
case NET_PIN:
|
||||
case NET_LABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_HIERLABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_SHEETLABEL:
|
||||
case NET_PINLABEL:
|
||||
case NET_JONCTION:
|
||||
|
@ -964,7 +971,8 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
|
|||
case NET_BUS:
|
||||
case NET_BUSLABELMEMBER:
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_HIERBUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -975,15 +983,16 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
|
|||
netCode = Ref->m_BusNetCode;
|
||||
for( i = start; i<g_NbrObjNet; i++ )
|
||||
{
|
||||
if( netTable[i].m_SheetNumber > Ref->m_SheetNumber )
|
||||
break;
|
||||
if( netTable[i].m_SheetList != Ref->m_SheetList )
|
||||
continue;
|
||||
|
||||
switch( netTable[i].m_Type )
|
||||
{
|
||||
case NET_SEGMENT:
|
||||
case NET_PIN:
|
||||
case NET_LABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_HIERLABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_SHEETLABEL:
|
||||
case NET_PINLABEL:
|
||||
case NET_NOCONNECT:
|
||||
|
@ -992,7 +1001,8 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
|
|||
case NET_BUS:
|
||||
case NET_BUSLABELMEMBER:
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_HIERBUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_JONCTION:
|
||||
if( Ref->m_Start == netTable[i].m_Start
|
||||
|| Ref->m_Start == netTable[i].m_End
|
||||
|
@ -1031,8 +1041,8 @@ static void SegmentToPointConnect( ObjetNetListStruct* Jonction,
|
|||
|
||||
for( i = start; i < g_NbrObjNet; i++ )
|
||||
{
|
||||
if( Segment[i].m_SheetNumber > Jonction->m_SheetNumber )
|
||||
break;
|
||||
if( Segment[i].m_SheetList != Jonction->m_SheetList )
|
||||
continue;
|
||||
|
||||
if( IsBus == 0 )
|
||||
{
|
||||
|
@ -1074,7 +1084,7 @@ static void SegmentToPointConnect( ObjetNetListStruct* Jonction,
|
|||
/*****************************************************************
|
||||
* 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 )
|
||||
return;
|
||||
|
@ -1086,13 +1096,18 @@ static void LabelConnection( ObjetNetListStruct* LabelRef )
|
|||
if( netTable[i].GetNet() == LabelRef->GetNet() )
|
||||
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;
|
||||
}
|
||||
|
||||
if( netTable[i].m_Type == NET_LABEL
|
||||
//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
|
||||
|| netTable[i].m_Type == NET_GLOBLABEL
|
||||
|| netTable[i].m_Type == NET_BUSLABELMEMBER
|
||||
|| netTable[i].m_Type == NET_GLOBBUSLABELMEMBER
|
||||
|
@ -1100,10 +1115,7 @@ static void LabelConnection( ObjetNetListStruct* LabelRef )
|
|||
{
|
||||
if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )
|
||||
continue;
|
||||
|
||||
/* Ici 2 labels identiques */
|
||||
|
||||
/* Propagation du Netcode a tous les Objets de meme NetCode */
|
||||
// Propagation du Netcode a tous les Objets de meme NetCode
|
||||
if( netTable[i].GetNet() )
|
||||
PropageNetCode( netTable[i].GetNet(), LabelRef->GetNet(), 0 );
|
||||
else
|
||||
|
@ -1112,7 +1124,6 @@ static void LabelConnection( ObjetNetListStruct* LabelRef )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
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* Objet2 = (ObjetNetListStruct*) o2;
|
||||
|
||||
return Objet1->m_SheetNumber - Objet2->m_SheetNumber;
|
||||
return Objet1->m_SheetList.Cmp(Objet2->m_SheetList);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems )
|
||||
/**********************************************************************/
|
||||
|
@ -1202,13 +1210,15 @@ static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems )
|
|||
{
|
||||
case NET_SEGMENT:
|
||||
case NET_LABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_HIERLABEL:
|
||||
case NET_GLOBLABEL:
|
||||
case NET_SHEETLABEL:
|
||||
case NET_PINLABEL:
|
||||
case NET_BUS:
|
||||
case NET_BUSLABELMEMBER:
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_HIERBUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_JONCTION:
|
||||
break;
|
||||
|
||||
|
|
|
@ -39,10 +39,12 @@ enum NetObjetType { /* Type des objets de Net */
|
|||
NET_JONCTION,
|
||||
NET_LABEL,
|
||||
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_GLOBBUSLABELMEMBER,
|
||||
NET_HIERBUSLABELMEMBER,
|
||||
NET_SHEETBUSLABELMEMBER,
|
||||
NET_SHEETLABEL,
|
||||
NET_PINLABEL,
|
||||
NET_PIN,
|
||||
NET_NOCONNECT
|
||||
|
@ -60,22 +62,21 @@ enum IsConnectType { /* Valeur du Flag de connection */
|
|||
class ObjetNetListStruct
|
||||
{
|
||||
public:
|
||||
EDA_BaseStruct* m_Comp; /* Pointeur sur la definition de l'objet */
|
||||
void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
|
||||
* Pour les Pins: pointeur sur le composant */
|
||||
int m_Flag; /* flag pour calculs internes */
|
||||
SCH_SCREEN* m_Screen; /* Ecran d'appartenance */
|
||||
EDA_BaseStruct* m_Comp; /* Pointeur sur la definition de l'objet */
|
||||
void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
|
||||
* Pour les Pins: pointeur sur le composant */
|
||||
int m_Flag; /* flag pour calculs internes */
|
||||
DrawSheetList m_SheetList;
|
||||
NetObjetType m_Type;
|
||||
int m_ElectricalType; /* Pour Pins et sheet labels: type electrique */
|
||||
int m_ElectricalType;/* Pour Pins et sheet labels: type electrique */
|
||||
private:
|
||||
int m_NetCode; /* pour elements simples */
|
||||
int m_NetCode; /* pour elements simples */
|
||||
public:
|
||||
int m_BusNetCode; /* pour connexions type bus */
|
||||
int m_Member; /* pour les labels type BUSWIRE ( labels de bus eclate )
|
||||
int m_BusNetCode; /* pour connexions type bus */
|
||||
int m_Member; /* pour les labels type BUSWIRE ( labels de bus eclate )
|
||||
* numero de membre */
|
||||
IsConnectType m_FlagOfConnection;
|
||||
int m_SheetNumber; /* Sheet number for this item */
|
||||
int m_NumInclude; /* Numero de sous schema correpondant a la sheet (Gestion des GLabels et Pin Sheet)*/
|
||||
DrawSheetList m_SheetListInclude; /* sheet that the hierarchal label connects to.*/
|
||||
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 */
|
||||
wxPoint m_Start, m_End;
|
||||
|
@ -89,8 +90,22 @@ public:
|
|||
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
|
||||
{
|
||||
public:
|
||||
|
@ -98,14 +113,15 @@ public:
|
|||
int m_NbParts; /* Nombre de parts par boitier */
|
||||
bool m_PartsLocked; // For multi part components: True if the part cannot be changed
|
||||
int m_Unit; /* Numero de part */
|
||||
int m_Sheet; /* Numero de hierarchie */
|
||||
unsigned long m_TimeStamp; /* Signature temporelle */
|
||||
DrawSheetList m_SheetList;
|
||||
unsigned long m_TimeStamp; /* unique identification number */
|
||||
int m_IsNew; /* != 0 pour composants non annotes */
|
||||
char m_TextValue[32]; /* Valeur */
|
||||
char m_TextRef[32]; /* Reference ( hors numero ) */
|
||||
int m_NumRef; /* Numero de reference */
|
||||
int m_Flag; /* flag pour calculs internes */
|
||||
wxPoint m_Pos; /* position components */
|
||||
char m_Path[128]; // the 'path' of the object in the sheet hierarchy.
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -539,7 +539,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
|
|||
g_NetFormat = CurrPage->m_IdNetType;
|
||||
|
||||
/* Calculate the netlist filename */
|
||||
FullFileName = ScreenSch->m_FileName;
|
||||
FullFileName = g_RootSheet->m_s->m_FileName;
|
||||
|
||||
switch( g_NetFormat )
|
||||
{
|
||||
|
@ -558,7 +558,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
|
|||
|
||||
Mask = wxT( "*" ) + FileExt + wxT( "*" );
|
||||
ChangeFileNameExt( FullFileName, FileExt );
|
||||
|
||||
FullFileName = FullFileName.AfterLast('/');
|
||||
FullFileName = EDA_FileSelector( _( "Netlist files:" ),
|
||||
wxEmptyString, /* Defaut path */
|
||||
FullFileName, /* Defaut filename */
|
||||
|
@ -581,7 +581,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
/* Cleanup the entire hierarchy */
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
EDA_ScreenList ScreenList;
|
||||
for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
bool ModifyWires;
|
||||
|
@ -649,7 +649,7 @@ void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event )
|
|||
CommandLine = g_SimulatorCommandLine.AfterFirst( ' ' );
|
||||
|
||||
/* Calculate the netlist filename */
|
||||
NetlistFullFileName = ScreenSch->m_FileName;
|
||||
NetlistFullFileName = g_RootSheet->m_s->m_FileName;
|
||||
ChangeFileNameExt( NetlistFullFileName, wxT( ".cir" ) );
|
||||
AddDelimiterString( NetlistFullFileName );
|
||||
CommandLine += wxT( " " ) + NetlistFullFileName;
|
||||
|
|
|
@ -22,11 +22,11 @@ static wxArrayString s_PowerNameList;
|
|||
void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||
/**********************************************************************************/
|
||||
|
||||
/* Traite les commandes declenchée par le bouton gauche de la souris,
|
||||
* quand un outil est deja selectionné
|
||||
/* Traite les commandes declench<EFBFBD>e par le bouton gauche de la souris,
|
||||
* 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 ) )
|
||||
{
|
||||
|
@ -39,6 +39,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
case DRAW_SHEETLABEL_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_PART_TEXT_STRUCT_TYPE:
|
||||
DrawStruct->Place( this, DC );
|
||||
m_CurrentScreen->SetCurItem( NULL );
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
return;
|
||||
|
||||
case SCREEN_STRUCT_TYPE:
|
||||
|
@ -91,14 +92,14 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
InstallNextScreen( (DrawSheetStruct*) DrawStruct );
|
||||
}
|
||||
else
|
||||
InstallPreviousScreen();
|
||||
InstallPreviousSheet();
|
||||
break;
|
||||
|
||||
case ID_NOCONN_BUTT:
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
g_ItemToRepeat = CreateNewNoConnectStruct( DC );
|
||||
m_CurrentScreen->SetCurItem( g_ItemToRepeat );
|
||||
GetScreen()->SetCurItem( g_ItemToRepeat );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -106,14 +107,14 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
DrawStruct->Place( this, DC );
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
}
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
break;
|
||||
|
||||
case ID_JUNCTION_BUTT:
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
g_ItemToRepeat = CreateNewJunctionStruct( DC, m_CurrentScreen->m_Curseur, TRUE );
|
||||
m_CurrentScreen->SetCurItem( g_ItemToRepeat );
|
||||
g_ItemToRepeat = CreateNewJunctionStruct( DC, GetScreen()->m_Curseur, TRUE );
|
||||
GetScreen()->SetCurItem( g_ItemToRepeat );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -121,7 +122,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
DrawStruct->Place( this, DC );
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
}
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
break;
|
||||
|
||||
case ID_WIRETOBUS_ENTRY_BUTT:
|
||||
|
@ -132,23 +133,23 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
CreateBusEntry( DC,
|
||||
(m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT) ?
|
||||
WIRE_TO_BUS : BUS_TO_BUS );
|
||||
m_CurrentScreen->SetCurItem( DrawStruct );
|
||||
GetScreen()->SetCurItem( DrawStruct );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawStruct->Place( this, DC );
|
||||
m_CurrentScreen->SetCurItem( NULL );
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
||||
LocateAndDeleteItem( this, DC );
|
||||
m_CurrentScreen->SetModify();
|
||||
m_CurrentScreen->SetCurItem( NULL );
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
break;
|
||||
|
||||
case ID_WIRE_BUTT:
|
||||
|
@ -169,7 +170,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
case ID_TEXT_COMMENT_BUTT:
|
||||
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;
|
||||
}
|
||||
else
|
||||
|
@ -182,42 +183,59 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
case ID_LABEL_BUTT:
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawStruct->Place( this, DC );
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_GLABEL_BUTT:
|
||||
case ID_HIERLABEL_BUTT:
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawStruct->Place( this, DC );
|
||||
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;
|
||||
|
||||
case ID_SHEET_SYMBOL_BUTT:
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
m_CurrentScreen->SetCurItem( CreateSheet( DC ) );
|
||||
GetScreen()->SetCurItem( CreateSheet( DC ) );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawStruct->Place( this, DC );
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -233,24 +251,24 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
&& (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
if( m_ID_current_state == ID_IMPORT_GLABEL_BUTT )
|
||||
m_CurrentScreen->SetCurItem(
|
||||
GetScreen()->SetCurItem(
|
||||
Import_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
|
||||
else
|
||||
m_CurrentScreen->SetCurItem(
|
||||
GetScreen()->SetCurItem(
|
||||
Create_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
|
||||
}
|
||||
else if( (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE)
|
||||
&& (DrawStruct->m_Flags != 0) )
|
||||
{
|
||||
DrawStruct->Place( this, DC );
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_COMPONENT_BUTT:
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
m_CurrentScreen->SetCurItem( Load_Component( DC, wxEmptyString,
|
||||
GetScreen()->SetCurItem( Load_Component( DC, wxEmptyString,
|
||||
s_CmpNameList, TRUE ) );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
}
|
||||
|
@ -258,14 +276,14 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
DrawStruct->Place( this, DC );
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_PLACE_POWER_BUTT:
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
{
|
||||
m_CurrentScreen->SetCurItem(
|
||||
GetScreen()->SetCurItem(
|
||||
Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) );
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
}
|
||||
|
@ -273,7 +291,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
{
|
||||
DrawStruct->Place( this, DC );
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, DC );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -294,14 +312,14 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||
/***************************************************************************/
|
||||
|
||||
/* Appelé sur un double click:
|
||||
* pour un élément editable (textes, composant):
|
||||
/* Appel<EFBFBD> sur un double click:
|
||||
* pour un <EFBFBD>l<EFBFBD>ment editable (textes, composant):
|
||||
* appel de l'editeur correspondant.
|
||||
* pour une connexion en cours:
|
||||
* termine la connexion
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* DrawStruct = m_CurrentScreen->GetCurItem();
|
||||
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
||||
wxPoint pos = GetPosition();
|
||||
|
||||
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) )
|
||||
break;
|
||||
|
||||
// Element localisé
|
||||
// Element localis<EFBFBD>
|
||||
switch( DrawStruct->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_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
EditSchematicText( (DrawTextStruct*) DrawStruct, DC );
|
||||
break;
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ static void AddMenusForPinSheet( wxMenu* PopMenu, DrawSheetLabelStruct* PinSheet
|
|||
static void AddMenusForText( wxMenu* PopMenu, DrawTextStruct* Text );
|
||||
static void AddMenusForLabel( wxMenu* PopMenu, DrawLabelStruct* Label );
|
||||
static void AddMenusForGLabel( wxMenu* PopMenu, DrawGlobalLabelStruct* GLabel );
|
||||
static void AddMenusForHLabel( wxMenu* PopMenu, DrawHierLabelStruct* GLabel );
|
||||
static void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component );
|
||||
static void AddMenusForComponentField( wxMenu* PopMenu, PartTextStruct* Field );
|
||||
static void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
|
||||
|
@ -82,13 +83,13 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
|||
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.
|
||||
* 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();
|
||||
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
|
||||
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
||||
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
|
||||
|
||||
|
||||
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;
|
||||
slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct,
|
||||
m_CurrentScreen->m_Curseur );
|
||||
GetScreen()->m_Curseur );
|
||||
if( slabel )
|
||||
DrawStruct = slabel;
|
||||
}
|
||||
|
@ -138,7 +139,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
|||
|
||||
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 );
|
||||
PopMenu->AppendSeparator();
|
||||
|
@ -146,7 +147,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
|||
return true;
|
||||
}
|
||||
|
||||
m_CurrentScreen->SetCurItem( DrawStruct );
|
||||
GetScreen()->SetCurItem( DrawStruct );
|
||||
|
||||
int flags = DrawStruct->m_Flags;
|
||||
bool is_new = (flags & IS_NEW) ? TRUE : FALSE;
|
||||
|
@ -191,6 +192,10 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
|||
AddMenusForGLabel( PopMenu, (DrawGlobalLabelStruct*) DrawStruct );
|
||||
break;
|
||||
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
AddMenusForHLabel( PopMenu, (DrawHierLabelStruct*) DrawStruct );
|
||||
break;
|
||||
|
||||
case DRAW_PART_TEXT_STRUCT_TYPE:
|
||||
{
|
||||
AddMenusForComponentField( PopMenu, (PartTextStruct*) DrawStruct );
|
||||
|
@ -198,7 +203,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
|||
break;
|
||||
|
||||
// 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 )
|
||||
{
|
||||
PopMenu->AppendSeparator();
|
||||
|
@ -378,6 +383,28 @@ void AddMenusForGLabel( wxMenu* PopMenu, DrawGlobalLabelStruct* GLabel )
|
|||
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type,
|
||||
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( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen()->EEDrawList,
|
||||
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(),
|
||||
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_DELETE, _( "delete junction" ), delete_xpm );
|
||||
|
||||
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen()->EEDrawList,
|
||||
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(),
|
||||
WIREITEM | BUSITEM ) )
|
||||
{
|
||||
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, _(
|
||||
"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 ) )
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ static int LastPinType = PIN_INPUT,
|
|||
/*************************************************************************/
|
||||
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;
|
||||
|
@ -282,7 +282,7 @@ wxPoint startPos;
|
|||
startPos.x = OldPos.x;
|
||||
startPos.y = -OldPos.y;
|
||||
DrawPanel->CursorOff(DC);
|
||||
m_CurrentScreen->m_Curseur = startPos;
|
||||
GetScreen()->m_Curseur = startPos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
||||
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)
|
||||
/************************************************************************/
|
||||
/* 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;
|
||||
wxString msg;
|
||||
|
|
|
@ -379,7 +379,7 @@ int orient, color = -1;
|
|||
}
|
||||
|
||||
SetCurrentLineWidth(-1);
|
||||
|
||||
//not sure what to do here in terms of plotting components that may have multiple REFERENCE entries.
|
||||
if( !IsMulti || (FieldNumber != REFERENCE) )
|
||||
{
|
||||
PlotGraphicText( g_PlotFormat, wxPoint(px, py), color, Field->m_Text,
|
||||
|
@ -520,6 +520,7 @@ int HalfSize;
|
|||
switch ( Struct->Type() )
|
||||
{
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
Text = ((DrawTextStruct*)Struct)->m_Text;
|
||||
|
@ -529,8 +530,9 @@ int HalfSize;
|
|||
pX = ((DrawTextStruct*)Struct)->m_Pos.x;
|
||||
pY = ((DrawTextStruct*)Struct)->m_Pos.y;
|
||||
offset = TXTMARGE;
|
||||
if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE)
|
||||
offset += Size.x; // We must also draw the Glabel graphic symbol
|
||||
if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
|
||||
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 )
|
||||
color = ReturnLayerColor(((DrawTextStruct*)Struct)->m_Layer);
|
||||
break;
|
||||
|
@ -545,7 +547,8 @@ int HalfSize;
|
|||
switch(Orient)
|
||||
{
|
||||
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),
|
||||
color, Text, TEXT_ORIENT_HORIZ, Size,
|
||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER);
|
||||
|
@ -556,7 +559,8 @@ int HalfSize;
|
|||
break;
|
||||
|
||||
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),
|
||||
color, Text, TEXT_ORIENT_VERT, Size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP);
|
||||
|
@ -567,7 +571,8 @@ int HalfSize;
|
|||
break;
|
||||
|
||||
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),
|
||||
color, Text, TEXT_ORIENT_HORIZ, Size,
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
|
||||
|
@ -578,7 +583,8 @@ int HalfSize;
|
|||
break;
|
||||
|
||||
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),
|
||||
color, Text, TEXT_ORIENT_VERT, Size,
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);
|
||||
|
@ -590,7 +596,8 @@ int HalfSize;
|
|||
}
|
||||
|
||||
/* 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;
|
||||
HalfSize = Size.x / 2;
|
||||
|
|
|
@ -477,9 +477,9 @@ void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN * screen,
|
|||
{
|
||||
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;
|
||||
SheetOffset = PlotSheet->m_Offset;
|
||||
|
@ -499,10 +499,10 @@ int margin;
|
|||
g_PlotFormat = PLOT_FORMAT_HPGL;
|
||||
|
||||
/* Build the screen list */
|
||||
EDA_ScreenList ScreenList(NULL);
|
||||
EDA_ScreenList ScreenList;
|
||||
|
||||
if ( Select_PlotAll == TRUE ) screen = ScreenList.GetFirst();
|
||||
else screen = ActiveScreen;
|
||||
else screen = m_Parent->GetScreen();
|
||||
for ( ; screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
ReturnSheetDims(screen, SheetSize, SheetOffset);
|
||||
|
@ -511,7 +511,7 @@ int margin;
|
|||
g_PlotScaleY = Scale_Y * SCALE_HPGL ;
|
||||
|
||||
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_PlotScaleY = g_PlotScaleY * (SheetSize.y - 2 * margin) / PlotSheet->m_Size.y;
|
||||
|
||||
|
@ -636,6 +636,7 @@ wxString msg;
|
|||
case DRAW_TEXT_STRUCT_TYPE :
|
||||
case DRAW_LABEL_STRUCT_TYPE :
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE :
|
||||
PlotTextStruct(DrawList);
|
||||
break;
|
||||
|
||||
|
|
|
@ -328,13 +328,13 @@ wxPoint plot_offset;
|
|||
g_PlotFormat = PLOT_FORMAT_POST;
|
||||
|
||||
/* Build the screen list */
|
||||
EDA_ScreenList ScreenList(NULL);
|
||||
EDA_ScreenList ScreenList;
|
||||
|
||||
if ( AllPages == TRUE ) screen = ScreenList.GetFirst();
|
||||
else screen = ActiveScreen;
|
||||
for ( ; screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
PlotSheet = screen->m_CurrentSheet;
|
||||
PlotSheet = screen->m_CurrentSheetDesc;
|
||||
RealSheet = &g_Sheet_A4;
|
||||
if ( pagesize == PAGE_SIZE_AUTO ) RealSheet = PlotSheet;
|
||||
else if ( pagesize == PAGE_SIZE_A ) RealSheet = &g_Sheet_A;
|
||||
|
@ -472,6 +472,7 @@ wxPoint StartPos, EndPos;
|
|||
case DRAW_TEXT_STRUCT_TYPE :
|
||||
case DRAW_LABEL_STRUCT_TYPE :
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE :
|
||||
PlotTextStruct(DrawList);
|
||||
break;
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct
|
|||
public:
|
||||
int m_Layer;
|
||||
int m_Shape;
|
||||
bool m_IsDangling; // TRUE si non connecté
|
||||
bool m_IsDangling; // TRUE si non connect<EFBFBD>
|
||||
|
||||
public:
|
||||
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
|
||||
|
@ -280,8 +280,8 @@ public:
|
|||
class DrawGlobalLabelStruct : public DrawTextStruct
|
||||
{
|
||||
public:
|
||||
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString );
|
||||
DrawGlobalLabelStruct(const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString);
|
||||
~DrawGlobalLabelStruct() { }
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
||||
int Color = -1 );
|
||||
|
@ -291,7 +291,20 @@ public:
|
|||
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
|
||||
class LayerStruct
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*****************************************/
|
||||
//*****************************************/
|
||||
/* prototypage des fonctions de EESchema */
|
||||
/*****************************************/
|
||||
void FreeLibraryEntry(LibCmpEntry * Entry);
|
||||
|
@ -10,11 +10,9 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
|
|||
|
||||
const wxString& ReturnDefaultFieldName( int aFieldNdx );
|
||||
|
||||
|
||||
/***************/
|
||||
/* 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 */
|
||||
|
||||
EDA_BaseStruct * PickStruct(EDA_Rect & block,
|
||||
EDA_BaseStruct *DrawList, int SearchMask );
|
||||
BASE_SCREEN* screen, int SearchMask );
|
||||
EDA_BaseStruct * PickStruct(const wxPoint & refpos,
|
||||
EDA_BaseStruct *DrawList, int SearchMask );
|
||||
BASE_SCREEN* screen, int SearchMask);
|
||||
/* 2 functions EDA_BaseStruct * PickStruct:
|
||||
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 quelconque */
|
||||
|
||||
|
||||
/***************/
|
||||
/* EEREDRAW.CPP */
|
||||
/***************/
|
||||
|
@ -303,7 +302,7 @@ void ReAnnotatePowerSymbolsOnly();
|
|||
|
||||
void InstallAnnotateFrame(WinEDA_SchematicFrame * parent, wxPoint &pos);
|
||||
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
|
||||
else: recherche sur toute la hierarchie */
|
||||
|
||||
|
@ -328,7 +327,6 @@ void PlotTextStruct(EDA_BaseStruct *Struct);
|
|||
/* DELSHEET.CPP */
|
||||
/***************/
|
||||
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);
|
||||
/* free the draw list screen->EEDrawList and the subhierarchies
|
||||
clear the screen datas (filenames ..)
|
||||
|
@ -411,7 +409,8 @@ bool LibArchive(wxWindow * frame, const wxString & ArchFullFileName);
|
|||
/* GENLISTE.CPP */
|
||||
/***************/
|
||||
void InstallToolsFrame(WinEDA_DrawFrame *parent, wxPoint &pos);
|
||||
int GenListeCmp( EDA_BaseStruct ** List );
|
||||
struct ListComponent;
|
||||
int GenListeCmp( ListComponent * List );
|
||||
|
||||
/**************/
|
||||
/* CLEANUP.CPP */
|
||||
|
|
|
@ -31,18 +31,18 @@ static void SaveLayers(FILE *f);
|
|||
*****************************************************************************/
|
||||
bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
|
||||
{
|
||||
wxString msg;
|
||||
wxString Name, BakName;
|
||||
const wxChar **LibNames;
|
||||
const char * layer, *width;
|
||||
int ii, shape;
|
||||
bool Failed = FALSE;
|
||||
EDA_BaseStruct *Phead;
|
||||
Ki_PageDescr * PlotSheet;
|
||||
FILE *f;
|
||||
wxString dirbuf;
|
||||
wxString msg;
|
||||
wxString Name, BakName;
|
||||
const wxChar **LibNames;
|
||||
const char * layer, *width;
|
||||
int ii, shape;
|
||||
bool Failed = FALSE;
|
||||
EDA_BaseStruct *Phead;
|
||||
Ki_PageDescr * PlotSheet;
|
||||
FILE *f;
|
||||
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( screen->m_FileName.IsEmpty() ) FileSave = FILE_SAVE_NEW;
|
||||
|
@ -58,8 +58,7 @@ wxString dirbuf;
|
|||
{
|
||||
ChangeFileNameExt(BakName, wxT(".bak"));
|
||||
wxRemoveFile(BakName); /* delete Old .bak file */
|
||||
if( ! wxRenameFile(Name, BakName) )
|
||||
{
|
||||
if( ! wxRenameFile(Name, BakName) ){
|
||||
DisplayError(this, wxT("Warning: unable to rename old file"), 10);
|
||||
}
|
||||
}
|
||||
|
@ -69,8 +68,8 @@ wxString dirbuf;
|
|||
{
|
||||
wxString mask = wxT("*") + g_SchExtBuffer;
|
||||
Name = EDA_FileSelector(_("Schematic files:"),
|
||||
wxEmptyString, /* Chemin par defaut */
|
||||
screen->m_FileName, /* nom fichier par defaut, et resultat */
|
||||
wxEmptyString, /* Chemin par defaut */
|
||||
screen->m_FileName, /* nom fichier par defaut, et resultat */
|
||||
g_SchExtBuffer, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
this,
|
||||
|
@ -122,11 +121,11 @@ wxString dirbuf;
|
|||
SaveLayers(f);
|
||||
/* 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),
|
||||
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,"Date \"%s\"\n",CONV_TO_UTF8(screen->m_Date));
|
||||
fprintf(f,"Rev \"%s\"\n",CONV_TO_UTF8(screen->m_Revision));
|
||||
|
@ -258,12 +257,23 @@ wxString dirbuf;
|
|||
Failed = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: /* Its a Global label item. */
|
||||
#undef STRUCT
|
||||
#define STRUCT ((DrawGlobalLabelStruct *) Phead)
|
||||
shape = STRUCT->m_Shape;
|
||||
if (fprintf(f, "Text GLabel %-4d %-4d %-4d %-4d %s\n%s\n",
|
||||
if (fprintf(f, "Text GLabel %-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_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],
|
||||
|
@ -322,18 +332,27 @@ int ii, Failed = FALSE;
|
|||
char Name1[256], Name2[256];
|
||||
int hjustify, vjustify;
|
||||
|
||||
strcpy(Name1, CONV_TO_UTF8(LibItemStruct->m_Field[REFERENCE].m_Text));
|
||||
for (ii = 0; ii < (int)strlen(Name1); ii++)
|
||||
if (Name1[ii] <= ' ') Name1[ii] = '~';
|
||||
|
||||
//this is redundant with the AR entries below, but it makes the
|
||||
//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 ( ! 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++)
|
||||
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");
|
||||
|
||||
|
@ -355,10 +374,28 @@ int hjustify, vjustify;
|
|||
/* Sortie de la position */
|
||||
if(fprintf(f, "P %d %d\n",
|
||||
LibItemStruct->m_Pos.x, LibItemStruct->m_Pos.y) == EOF)
|
||||
{
|
||||
{
|
||||
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++ )
|
||||
{
|
||||
PartTextStruct * field = & LibItemStruct->m_Field[ii];
|
||||
|
@ -437,10 +474,14 @@ DrawSheetLabelStruct * SheetLabel;
|
|||
|
||||
if (fprintf(f, "S %-4d %-4d %-4d %-4d\n",
|
||||
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);
|
||||
}
|
||||
|
||||
/* Generation de la liste des 2 textes (sheetname et filename) */
|
||||
if ( ! SheetStruct->m_SheetName.IsEmpty())
|
||||
|
|
|
@ -609,7 +609,7 @@ int SaveOneLibrary( wxWindow* frame, const wxString& FullFileName, LibraryStruct
|
|||
Library->m_Modified = 0;
|
||||
|
||||
/* Creation de l'entete de la librairie */
|
||||
Library->m_TimeStamp = GetTimeStamp();
|
||||
Library->m_TimeStamp = GetTimeStamp();
|
||||
Library->WriteHeader( SaveFile );
|
||||
fprintf( SaveDocFile, "%s Date: %s\n", DOCFILE_IDENT,
|
||||
DateAndTime( Line ) );
|
||||
|
|
|
@ -114,7 +114,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break; // Do nothing:
|
||||
|
||||
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->
|
||||
m_PanelDefaultCursor ) );
|
||||
|
||||
|
@ -123,11 +123,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||
}
|
||||
/* 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;
|
||||
m_CurrentScreen->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
m_CurrentScreen->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
GetScreen()->BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->BlockLocate.m_State = STATE_NO_BLOCK;
|
||||
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -166,7 +166,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_LOAD_ONE_SHEET:
|
||||
LoadOneSheet( GetScreen(), wxEmptyString );
|
||||
//how is this different from above?
|
||||
//LoadOneSheet( GetSheet(), wxEmptyString );
|
||||
break;
|
||||
|
||||
case ID_LOAD_FILE_1:
|
||||
|
@ -202,9 +203,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_TO_PCB:
|
||||
{
|
||||
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 );
|
||||
ChangeFileNameExt( Line, wxEmptyString );
|
||||
ExecuteFile( this, PCBNEW_EXE, Line );
|
||||
|
@ -217,9 +218,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_TO_CVPCB:
|
||||
{
|
||||
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 );
|
||||
ChangeFileNameExt( Line, wxEmptyString );
|
||||
ExecuteFile( this, CVPCB_EXE, Line );
|
||||
|
@ -248,7 +249,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case wxID_CUT:
|
||||
if( m_CurrentScreen->BlockLocate.m_Command != BLOCK_MOVE )
|
||||
if( GetScreen()->BlockLocate.m_Command != BLOCK_MOVE )
|
||||
break;
|
||||
HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
|
||||
g_ItemToRepeat = NULL;
|
||||
|
@ -256,7 +257,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
|
||||
case wxID_PASTE:
|
||||
HandleBlockBegin( &dc, BLOCK_PASTE, m_CurrentScreen->m_Curseur );
|
||||
HandleBlockBegin( &dc, BLOCK_PASTE, GetScreen()->m_Curseur );
|
||||
break;
|
||||
|
||||
case ID_GET_ANNOTATE:
|
||||
|
@ -311,6 +312,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Global label" ) );
|
||||
break;
|
||||
|
||||
case ID_HIERLABEL_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Hierarchal label" ) );
|
||||
break;
|
||||
|
||||
case ID_TEXT_COMMENT_BUTT:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
|
||||
break;
|
||||
|
@ -346,13 +351,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
SetBusEntryShape( &dc,
|
||||
(DrawBusEntryStruct*) m_CurrentScreen->GetCurItem(), '/' );
|
||||
(DrawBusEntryStruct*) GetScreen()->GetCurItem(), '/' );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
SetBusEntryShape( &dc,
|
||||
(DrawBusEntryStruct*) m_CurrentScreen->GetCurItem(), '\\' );
|
||||
(DrawBusEntryStruct*) GetScreen()->GetCurItem(), '\\' );
|
||||
break;
|
||||
|
||||
case ID_NO_SELECT_BUTT:
|
||||
|
@ -370,85 +375,83 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_SCH_EDIT_TEXT:
|
||||
EditSchematicText(
|
||||
(DrawTextStruct*) m_CurrentScreen->GetCurItem(), &dc );
|
||||
EditSchematicText((DrawTextStruct*) GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_ROTATE_TEXT:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
ChangeTextOrient(
|
||||
(DrawTextStruct*) m_CurrentScreen->GetCurItem(), &dc );
|
||||
ChangeTextOrient((DrawTextStruct*) GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
ConvertTextType( (DrawTextStruct*) m_CurrentScreen->GetCurItem(),
|
||||
ConvertTextType( (DrawTextStruct*) GetScreen()->GetCurItem(),
|
||||
&dc, DRAW_LABEL_STRUCT_TYPE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
ConvertTextType( (DrawTextStruct*) m_CurrentScreen->GetCurItem(),
|
||||
ConvertTextType( (DrawTextStruct*) GetScreen()->GetCurItem(),
|
||||
&dc, DRAW_GLOBAL_LABEL_STRUCT_TYPE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
ConvertTextType( (DrawTextStruct*) m_CurrentScreen->GetCurItem(),
|
||||
ConvertTextType( (DrawTextStruct*) GetScreen()->GetCurItem(),
|
||||
&dc, DRAW_TEXT_STRUCT_TYPE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_SET_SHAPE_TEXT:
|
||||
|
||||
// Non utilisé
|
||||
// Non utilis<EFBFBD>
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_ROTATE_FIELD:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
RotateCmpField( (PartTextStruct*) m_CurrentScreen->GetCurItem(), &dc );
|
||||
RotateCmpField( (PartTextStruct*) GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_EDIT_FIELD:
|
||||
EditCmpFieldText( (PartTextStruct*) m_CurrentScreen->GetCurItem(), &dc );
|
||||
EditCmpFieldText( (PartTextStruct*) GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_DELETE_NODE:
|
||||
case ID_POPUP_SCH_DELETE_CONNECTION:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
DeleteConnection( &dc, id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE );
|
||||
m_CurrentScreen->SetCurItem( NULL );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
g_ItemToRepeat = NULL;
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_BREAK_WIRE:
|
||||
{
|
||||
DrawPickedStruct* ListForUndo;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
ListForUndo = BreakSegment( (SCH_SCREEN*) m_CurrentScreen,
|
||||
m_CurrentScreen->m_Curseur, TRUE );
|
||||
ListForUndo = BreakSegment( (SCH_SCREEN*) GetScreen(),
|
||||
GetScreen()->m_Curseur, TRUE );
|
||||
if( ListForUndo )
|
||||
SaveCopyInUndoList( ListForUndo, IS_NEW | IS_CHANGED );
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, &dc );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_DELETE_CMP:
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
|
||||
// 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 )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
|
||||
case ID_POPUP_SCH_DELETE:
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
DeleteStruct( this->DrawPanel, &dc, m_CurrentScreen->GetCurItem() );
|
||||
m_CurrentScreen->SetCurItem( NULL );
|
||||
DeleteStruct( this->DrawPanel, &dc, GetScreen()->GetCurItem() );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
g_ItemToRepeat = NULL;
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc );
|
||||
m_CurrentScreen->SetModify();
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, &dc );
|
||||
GetScreen()->SetModify();
|
||||
break;
|
||||
|
||||
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
||||
|
@ -457,43 +460,43 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_SCH_END_SHEET:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
m_CurrentScreen->GetCurItem()->Place( this, &dc );
|
||||
GetScreen()->GetCurItem()->Place( this, &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_RESIZE_SHEET:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
ReSizeSheet( (DrawSheetStruct*)
|
||||
m_CurrentScreen->GetCurItem(), &dc );
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc );
|
||||
GetScreen()->GetCurItem(), &dc );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_EDIT_SHEET:
|
||||
EditSheet( (DrawSheetStruct*)
|
||||
m_CurrentScreen->GetCurItem(), &dc );
|
||||
GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_CLEANUP_SHEET:
|
||||
( (DrawSheetStruct*)
|
||||
m_CurrentScreen->GetCurItem() )->CleanupSheet( this, &dc );
|
||||
GetScreen()->GetCurItem() )->CleanupSheet( this, &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_EDIT_PINSHEET:
|
||||
Edit_PinSheet( (DrawSheetLabelStruct*)
|
||||
m_CurrentScreen->GetCurItem(), &dc );
|
||||
GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_MOVE_PINSHEET:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
StartMove_PinSheet( (DrawSheetLabelStruct*)
|
||||
m_CurrentScreen->GetCurItem(), &dc );
|
||||
GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_DRAG_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..)
|
||||
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
@ -505,17 +508,17 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
HandleBlockEnd( &dc );
|
||||
}
|
||||
}
|
||||
else Process_Move_Item( m_CurrentScreen->GetCurItem(), &dc );
|
||||
else Process_Move_Item( GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_EDIT_CMP:
|
||||
// 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 )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
InstallCmpeditFrame( this, pos,
|
||||
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem() );
|
||||
(EDA_SchComponentStruct*) GetScreen()->GetCurItem() );
|
||||
break;
|
||||
|
||||
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:
|
||||
|
||||
// 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 )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
{
|
||||
int option;
|
||||
|
@ -552,10 +555,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
if( m_CurrentScreen->GetCurItem()->m_Flags == 0 )
|
||||
SaveCopyInUndoList( m_CurrentScreen->GetCurItem(), IS_CHANGED );
|
||||
if( GetScreen()->GetCurItem()->m_Flags == 0 )
|
||||
SaveCopyInUndoList( GetScreen()->GetCurItem(), IS_CHANGED );
|
||||
CmpRotationMiroir(
|
||||
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(),
|
||||
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(),
|
||||
&dc, option );
|
||||
break;
|
||||
}
|
||||
|
@ -567,47 +570,47 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_SCH_EDIT_VALUE_CMP:
|
||||
|
||||
// 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 )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
EditComponentValue(
|
||||
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), &dc );
|
||||
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_EDIT_REF_CMP:
|
||||
|
||||
// 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 )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
EditComponentReference(
|
||||
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), &dc );
|
||||
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
|
||||
|
||||
// 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 )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
EditComponentFootprint(
|
||||
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), &dc );
|
||||
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(), &dc );
|
||||
break;
|
||||
|
||||
|
||||
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
|
||||
|
||||
// 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 )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
ConvertPart(
|
||||
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(),
|
||||
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(),
|
||||
&dc );
|
||||
break;
|
||||
|
||||
|
@ -615,13 +618,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
DrawPanel->MouseToCursorSchema();
|
||||
{
|
||||
EDA_SchComponentStruct* olditem, * newitem;
|
||||
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
olditem = (EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem();
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
olditem = (EDA_SchComponentStruct*) GetScreen()->GetCurItem();
|
||||
if( olditem == NULL )
|
||||
break;
|
||||
newitem = olditem->GenCopy();
|
||||
newitem->m_TimeStamp = GetTimeStamp();
|
||||
newitem->m_TimeStamp = GetTimeStamp();
|
||||
newitem->ClearAnnotation();
|
||||
newitem->m_Flags = IS_NEW;
|
||||
StartMovePart( newitem, &dc );
|
||||
|
@ -658,13 +661,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_SCH_SELECT_UNIT26:
|
||||
|
||||
// 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 )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
SelPartUnit(
|
||||
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(),
|
||||
(EDA_SchComponentStruct*) GetScreen()->GetCurItem(),
|
||||
id + 1 - ID_POPUP_SCH_SELECT_UNIT1,
|
||||
&dc );
|
||||
break;
|
||||
|
@ -672,14 +675,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
||||
|
||||
// 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 )
|
||||
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
|
||||
if( m_CurrentScreen->GetCurItem() == NULL )
|
||||
if( GetScreen()->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
GetScreen()->SetCurItem( LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ) );
|
||||
if( GetScreen()->GetCurItem() == NULL )
|
||||
break;
|
||||
{
|
||||
EDA_LibComponentStruct* LibEntry;
|
||||
LibEntry = FindLibPart( ( (EDA_SchComponentStruct*)
|
||||
m_CurrentScreen->GetCurItem() )->m_ChipName,
|
||||
GetScreen()->GetCurItem() )->m_ChipName,
|
||||
wxEmptyString, FIND_ALIAS );
|
||||
if( LibEntry && LibEntry->m_DocFile != wxEmptyString )
|
||||
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:
|
||||
{
|
||||
EDA_BaseStruct* DrawStruct = m_CurrentScreen->GetCurItem();
|
||||
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
||||
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
|
||||
{
|
||||
InstallNextScreen( (DrawSheetStruct*) DrawStruct );
|
||||
|
@ -697,7 +700,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_SCH_LEAVE_SHEET:
|
||||
InstallPreviousScreen();
|
||||
InstallPreviousSheet();
|
||||
break;
|
||||
|
||||
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
||||
|
@ -746,22 +749,22 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_SCH_ADD_JUNCTION:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
m_CurrentScreen->SetCurItem(
|
||||
CreateNewJunctionStruct( &dc, m_CurrentScreen->m_Curseur, TRUE ) );
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc );
|
||||
m_CurrentScreen->SetCurItem( NULL );
|
||||
GetScreen()->SetCurItem(
|
||||
CreateNewJunctionStruct( &dc, GetScreen()->m_Curseur, TRUE ) );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, &dc );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_ADD_LABEL:
|
||||
case ID_POPUP_SCH_ADD_GLABEL:
|
||||
m_CurrentScreen->SetCurItem( CreateNewText( &dc,
|
||||
GetScreen()->SetCurItem( CreateNewText( &dc,
|
||||
id == ID_POPUP_SCH_ADD_LABEL ?
|
||||
LAYER_LOCLABEL : LAYER_GLOBLABEL ) );
|
||||
if( m_CurrentScreen->GetCurItem() )
|
||||
if( GetScreen()->GetCurItem() )
|
||||
{
|
||||
m_CurrentScreen->GetCurItem()->Place( this, &dc );
|
||||
TestDanglingEnds( m_CurrentScreen->EEDrawList, &dc );
|
||||
m_CurrentScreen->SetCurItem( NULL );
|
||||
GetScreen()->GetCurItem()->Place( this, &dc );
|
||||
TestDanglingEnds( GetScreen()->EEDrawList, &dc );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -812,6 +815,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( EDA_BaseStruct* DrawStruct,
|
|||
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
StartMoveTexte( (DrawTextStruct*) DrawStruct, DC );
|
||||
break;
|
||||
|
|
|
@ -90,6 +90,7 @@ void SwapData( EDA_BaseStruct* Item )
|
|||
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
#undef SOURCE
|
||||
#undef DEST
|
||||
|
@ -285,7 +286,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
|
|||
GetScreen()->AddItemToUndoList( NewList );
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
@ -361,7 +362,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
|
|||
while( PickedList )
|
||||
{
|
||||
item = PickedList->m_Image;
|
||||
GetScreen()->RemoveFromDrawList( item );
|
||||
((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( item );
|
||||
item->m_Flags = IS_DELETED;
|
||||
PickedList->m_PickedStruct = item;
|
||||
PickedList->m_Flags = IS_DELETED;
|
||||
|
@ -371,7 +372,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
|
|||
else
|
||||
{
|
||||
FirstItem = List->m_Image;
|
||||
GetScreen()->RemoveFromDrawList( FirstItem );
|
||||
((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( FirstItem );
|
||||
FirstItem->m_Flags = IS_DELETED;
|
||||
List->m_Son = FirstItem;
|
||||
}
|
||||
|
@ -406,7 +407,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
|
|||
|
||||
case IS_WIRE_IMAGE:
|
||||
/* Exchange the current wires and the oild wires */
|
||||
List->m_Son = GetScreen()->ExtractWires( FALSE );
|
||||
List->m_Son = ((SCH_SCREEN*)GetScreen())->ExtractWires( FALSE );
|
||||
while( FirstItem )
|
||||
{
|
||||
EDA_BaseStruct* nextitem = FirstItem->Pnext;
|
||||
|
@ -436,7 +437,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
|
|||
|
||||
case IS_NEW:
|
||||
item = PickedList->m_Image;
|
||||
GetScreen()->RemoveFromDrawList( item );
|
||||
((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( item );
|
||||
item->m_Flags = IS_DELETED;
|
||||
PickedList->m_PickedStruct = item;
|
||||
PickedList->m_Flags = IS_DELETED;
|
||||
|
@ -516,7 +517,7 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
|
|||
FirstItem = List->m_Son;
|
||||
CmdType = List->m_Flags;
|
||||
|
||||
delete List;
|
||||
SAFE_DELETE( List );
|
||||
|
||||
if( FirstItem == NULL )
|
||||
continue;
|
||||
|
@ -541,18 +542,22 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
|
|||
{
|
||||
if( (item->m_Flags & IS_NEW) == 0 )
|
||||
{
|
||||
printf("schematic undo_redo.cpp: undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n");
|
||||
/*
|
||||
sheet->EEDrawList = NULL;
|
||||
sheet->m_UndoList = NULL;
|
||||
sheet->m_RedoList = NULL;
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
if( (item->m_Flags & IS_NEW) == 0 )
|
||||
delete item;
|
||||
if( (item->m_Flags & IS_NEW) == 0 ){
|
||||
SAFE_DELETE( item );
|
||||
}
|
||||
}
|
||||
DrawPickedStruct* wrapper = PickedList;
|
||||
PickedList = PickedList->Next();
|
||||
delete wrapper;
|
||||
SAFE_DELETE( wrapper );
|
||||
}
|
||||
}
|
||||
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 )
|
||||
{
|
||||
printf("schematic undo_redo.cpp undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n");
|
||||
/*
|
||||
sheet->EEDrawList = NULL;
|
||||
sheet->m_UndoList = NULL;
|
||||
sheet->m_RedoList = NULL;
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
if( (FirstItem->m_Flags & IS_NEW) == 0 )
|
||||
delete FirstItem;
|
||||
if( (FirstItem->m_Flags & IS_NEW) == 0 ){
|
||||
SAFE_DELETE( FirstItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ BEGIN_EVENT_TABLE(WinEDA_SchematicFrame, wxFrame)
|
|||
|
||||
EVT_TOOL_RCLICKED(ID_LABEL_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,
|
||||
WinEDA_SchematicFrame::Process_Special_Functions )
|
||||
|
@ -115,7 +116,7 @@ END_EVENT_TABLE()
|
|||
/* 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) :
|
||||
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_Grid = g_ShowGrid; // TRUE to show a grid
|
||||
m_Draw_Sheet_Ref = TRUE; // TRUE to show sheet references
|
||||
m_CurrentSheet = new DrawSheetList();
|
||||
|
||||
CreateScreens();
|
||||
|
||||
// Give an icon
|
||||
#ifdef __WINDOWS__
|
||||
|
@ -132,7 +136,6 @@ WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *par
|
|||
SetIcon(wxICON(icon_eeschema));
|
||||
#endif
|
||||
|
||||
m_CurrentScreen = ScreenSch;
|
||||
g_ItemToRepeat = NULL;
|
||||
/* Get config */
|
||||
GetSettings();
|
||||
|
@ -156,28 +159,79 @@ WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *par
|
|||
WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
|
||||
{
|
||||
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)
|
||||
/**************************************************************/
|
||||
{
|
||||
SCH_SCREEN * screen;
|
||||
DrawSheetList* sheet;
|
||||
|
||||
if ( m_Parent->m_LibeditFrame ) // Can close component editor ?
|
||||
{
|
||||
if ( ! m_Parent->m_LibeditFrame->Close() ) return;
|
||||
}
|
||||
|
||||
screen = ScreenSch ;
|
||||
while( screen )
|
||||
{
|
||||
if(screen->IsModify()) break;
|
||||
screen = (SCH_SCREEN*)screen->Pnext;
|
||||
EDA_SheetList sheets( g_RootSheet );
|
||||
|
||||
for(sheet = sheets.GetFirst(); sheet != NULL; sheet = sheets.GetNext() ){
|
||||
if(sheet->LastScreen() && sheet->LastScreen()->IsModify()) break;
|
||||
}
|
||||
|
||||
if ( screen )
|
||||
if ( sheet )
|
||||
{
|
||||
unsigned ii;
|
||||
wxMessageDialog dialog(this, _("Schematic modified, Save before exit ?"),
|
||||
|
@ -194,25 +248,24 @@ SCH_SCREEN * screen;
|
|||
|
||||
case wxID_OK:
|
||||
case wxID_YES:
|
||||
SaveProject(this);
|
||||
SaveProject();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
screen = ScreenSch ;
|
||||
while( screen ) // Clear "flag modify" to avoid alert messages when closing sub sheets
|
||||
{
|
||||
screen->ClrModify();
|
||||
screen = (SCH_SCREEN*)screen->Pnext;
|
||||
for(sheet = sheets.GetFirst(); sheet != NULL; sheet = sheets.GetNext() ){
|
||||
if(sheet->LastScreen()){
|
||||
sheet->LastScreen()->ClrModify();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! ScreenSch->m_FileName.IsEmpty() && (ScreenSch->EEDrawList != NULL) )
|
||||
SetLastProject(ScreenSch->m_FileName);
|
||||
if ( ! GetScreen()->m_FileName.IsEmpty() && (GetScreen()->EEDrawList != NULL) )
|
||||
SetLastProject(GetScreen()->m_FileName);
|
||||
|
||||
ClearProjectDrawList(ScreenSch, TRUE);
|
||||
ClearProjectDrawList(g_RootSheet->m_s, TRUE);
|
||||
|
||||
/* allof sub sheets are deleted, only the main sheet is useable */
|
||||
m_CurrentScreen = ActiveScreen = ScreenSch;
|
||||
m_CurrentSheet->Clear();
|
||||
|
||||
SaveSettings();
|
||||
|
||||
|
@ -231,7 +284,7 @@ void WinEDA_SchematicFrame::SetToolbars()
|
|||
{
|
||||
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_COPY,TRUE);
|
||||
|
@ -246,7 +299,7 @@ void WinEDA_SchematicFrame::SetToolbars()
|
|||
else m_HToolBar->EnableTool(wxID_PASTE,FALSE);
|
||||
|
||||
wxMenuBar * menuBar = GetMenuBar();
|
||||
if ( GetScreen()->m_RedoList )
|
||||
if ( GetScreen() && GetScreen()->m_RedoList )
|
||||
{
|
||||
m_HToolBar->EnableTool(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);
|
||||
menuBar->Enable(ID_SCHEMATIC_REDO,FALSE);
|
||||
}
|
||||
if ( GetScreen()->m_UndoList )
|
||||
if ( GetScreen() && GetScreen()->m_UndoList )
|
||||
{
|
||||
m_HToolBar->EnableTool(ID_SCHEMATIC_UNDO,TRUE);
|
||||
menuBar->Enable(ID_SCHEMATIC_UNDO,TRUE);
|
||||
|
@ -300,17 +353,17 @@ int dx, dy, ii,jj ;
|
|||
int bestzoom;
|
||||
wxSize size;
|
||||
|
||||
dx = m_CurrentScreen->m_CurrentSheet->m_Size.x;
|
||||
dy = m_CurrentScreen->m_CurrentSheet->m_Size.y;
|
||||
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
|
||||
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
|
||||
|
||||
size = DrawPanel->GetClientSize();
|
||||
ii = dx / size.x;
|
||||
jj = dy / size.y;
|
||||
bestzoom = MAX(ii, jj) + 1;
|
||||
|
||||
m_CurrentScreen->SetZoom(ii);
|
||||
m_CurrentScreen->m_Curseur.x = dx / 2;
|
||||
m_CurrentScreen->m_Curseur.y = dy / 2;
|
||||
GetScreen()->SetZoom(ii);
|
||||
GetScreen()->m_Curseur.x = dx / 2;
|
||||
GetScreen()->m_Curseur.y = dy / 2;
|
||||
|
||||
return(bestzoom);
|
||||
}
|
||||
|
|
|
@ -292,12 +292,21 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
|
|||
{
|
||||
m_CurrentSheet->m_FileName = FileName;
|
||||
|
||||
if( wxFileExists( FileName ) ) /* do we reload the data from the existing file */
|
||||
if( wxFileExists( FileName ) )//do we reload the data from the existing file
|
||||
{
|
||||
msg.Printf( _( "A file named %s exists, load it ?" ), FileName.GetData() );
|
||||
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;
|
||||
|
||||
DrawSheetStruct* Sheet = new DrawSheetStruct( m_CurrentScreen->m_Curseur );
|
||||
DrawSheetStruct* Sheet = new DrawSheetStruct( GetScreen()->m_Curseur );
|
||||
|
||||
Sheet->m_Flags = IS_NEW | IS_RESIZED;
|
||||
Sheet->m_TimeStamp = GetTimeStamp();
|
||||
Sheet->m_Parent = m_CurrentScreen;
|
||||
Sheet->m_TimeStamp = GetTimeStamp();
|
||||
Sheet->m_Parent = GetScreen();
|
||||
Sheet->m_s = NULL;
|
||||
s_SheetMindx = SHEET_MIN_WIDTH;
|
||||
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->ForceCloseManageCurseur = ExitSheet;
|
||||
|
@ -424,7 +437,7 @@ void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC )
|
|||
return;
|
||||
|
||||
DrawPanel->CursorOff( DC );
|
||||
m_CurrentScreen->m_Curseur = Sheet->m_Pos;
|
||||
GetScreen()->m_Curseur = Sheet->m_Pos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
||||
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. */
|
||||
/********************************************************/
|
||||
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
{
|
||||
wxPoint move_vector;
|
||||
DrawSheetLabelStruct* SheetLabel;
|
||||
BASE_SCREEN* screen = panel->m_Parent->m_CurrentScreen;
|
||||
BASE_SCREEN* screen = panel->m_Parent->GetScreen();
|
||||
|
||||
DrawSheetStruct* Sheet = (DrawSheetStruct*)
|
||||
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 */
|
||||
/****************************************/
|
||||
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();
|
||||
|
||||
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 */
|
||||
{
|
||||
RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
|
||||
delete Sheet;
|
||||
SAFE_DELETE( Sheet );
|
||||
}
|
||||
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 */
|
||||
{
|
||||
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 );
|
||||
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
|
||||
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
|
||||
|
@ -609,5 +554,4 @@ void WinEDA_SheetPropertiesFrame::OnCancelClick( wxCommandEvent& event )
|
|||
void WinEDA_SheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
|
||||
{
|
||||
SheetPropertiesAccept( event );
|
||||
EndModal( 1 );
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ public:
|
|||
////@end WinEDA_SheetPropertiesFrame member variables
|
||||
|
||||
WinEDA_SchematicFrame * m_Parent;
|
||||
DrawSheetStruct * m_CurrentSheet;
|
||||
DrawSheetStruct* m_CurrentSheet;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -150,7 +150,7 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
if( SheetLabel->m_Flags & IS_NEW )
|
||||
{ /* Nouveau Placement en cours, on l'efface */
|
||||
RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode );
|
||||
delete SheetLabel;
|
||||
SAFE_DELETE( SheetLabel );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -354,23 +354,23 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S
|
|||
* de la feuille de sous hierarchie correspondante
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* DrawStruct;
|
||||
DrawSheetLabelStruct* NewSheetLabel, * SheetLabel = NULL;
|
||||
DrawGlobalLabelStruct* GLabel = NULL;
|
||||
EDA_BaseStruct* DrawStruct;
|
||||
DrawSheetLabelStruct* NewSheetLabel, * SheetLabel = NULL;
|
||||
DrawHierLabelStruct* HLabel = NULL;
|
||||
|
||||
DrawStruct = Sheet->EEDrawList;
|
||||
GLabel = NULL;
|
||||
DrawStruct = Sheet->m_s->EEDrawList;
|
||||
HLabel = NULL;
|
||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
|
||||
{
|
||||
if( DrawStruct->Type() != DRAW_GLOBAL_LABEL_STRUCT_TYPE )
|
||||
if( DrawStruct->Type() != DRAW_HIER_LABEL_STRUCT_TYPE )
|
||||
continue;
|
||||
GLabel = (DrawGlobalLabelStruct*) DrawStruct;
|
||||
HLabel = (DrawHierLabelStruct*) DrawStruct;
|
||||
|
||||
/* Ici un G-Label a ete trouve: y a t-il un SheetLabel correspondant */
|
||||
SheetLabel = Sheet->m_Label;
|
||||
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;
|
||||
}
|
||||
|
@ -381,20 +381,20 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S
|
|||
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;
|
||||
}
|
||||
|
||||
/* 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();
|
||||
/* 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_Size = NetSheetTextSize;
|
||||
CurrentTypeLabel = NewSheetLabel->m_Shape = GLabel->m_Shape;
|
||||
CurrentTypeLabel = NewSheetLabel->m_Shape = HLabel->m_Shape;
|
||||
|
||||
GetScreen()->SetCurItem( NewSheetLabel );
|
||||
DrawPanel->ManageCurseur = Move_PinSheet;
|
||||
|
|
|
@ -100,7 +100,7 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
|
|||
}
|
||||
CurrentLibEntry->SortDrawItems();
|
||||
|
||||
m_Parent->m_CurrentScreen->SetModify();
|
||||
m_Parent->GetScreen()->SetModify();
|
||||
|
||||
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, 0, 0,
|
||||
CurrentDrawItem, CurrentUnit, g_XorMode );
|
||||
|
@ -150,7 +150,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
else
|
||||
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, 0, 0,
|
||||
CurrentDrawItem, CurrentUnit, g_XorMode );
|
||||
delete CurrentDrawItem;
|
||||
SAFE_DELETE( CurrentDrawItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -164,8 +164,6 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
|
||||
CurrentDrawItem->m_Flags = 0;
|
||||
}
|
||||
|
||||
CurrentDrawItem = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -226,8 +224,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
|
|||
LibDrawArc* Arc = new LibDrawArc();
|
||||
|
||||
CurrentDrawItem = Arc;
|
||||
ArcStartX = ArcEndX = m_CurrentScreen->m_Curseur.x;
|
||||
ArcStartY = ArcEndY = -m_CurrentScreen->m_Curseur.y;
|
||||
ArcStartX = ArcEndX = GetScreen()->m_Curseur.x;
|
||||
ArcStartY = ArcEndY = -( GetScreen()->m_Curseur.y );
|
||||
StateDrawArc = 1;
|
||||
Arc->m_Fill = FlSymbol_Fill;
|
||||
Arc->m_Width = g_LibSymbolDefaultLineWidth;
|
||||
|
@ -239,8 +237,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
|
|||
LibDrawCircle* Circle = new LibDrawCircle();
|
||||
|
||||
CurrentDrawItem = Circle;
|
||||
Circle->m_Pos.x = m_CurrentScreen->m_Curseur.x;
|
||||
Circle->m_Pos.y = -m_CurrentScreen->m_Curseur.y;
|
||||
Circle->m_Pos.x = GetScreen()->m_Curseur.x;
|
||||
Circle->m_Pos.y = -( GetScreen()->m_Curseur.y );
|
||||
Circle->m_Fill = FlSymbol_Fill;
|
||||
Circle->m_Width = g_LibSymbolDefaultLineWidth;
|
||||
}
|
||||
|
@ -251,8 +249,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
|
|||
LibDrawSquare* Square = new LibDrawSquare();
|
||||
|
||||
CurrentDrawItem = Square;
|
||||
Square->m_Pos.x = m_CurrentScreen->m_Curseur.x;
|
||||
Square->m_Pos.y = -m_CurrentScreen->m_Curseur.y;
|
||||
Square->m_Pos.x = GetScreen()->m_Curseur.x;
|
||||
Square->m_Pos.y = -( GetScreen()->m_Curseur.y );
|
||||
Square->m_End = Square->m_Pos;
|
||||
Square->m_Fill = FlSymbol_Fill;
|
||||
Square->m_Width = g_LibSymbolDefaultLineWidth;
|
||||
|
@ -267,8 +265,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
|
|||
polyline->n = 2;
|
||||
ptpoly = (int*) MyZMalloc( 4 * sizeof(int) );
|
||||
polyline->PolyList = ptpoly;
|
||||
ptpoly[0] = ptpoly[2] = m_CurrentScreen->m_Curseur.x;
|
||||
ptpoly[1] = ptpoly[3] = -m_CurrentScreen->m_Curseur.y;
|
||||
ptpoly[0] = ptpoly[2] = GetScreen()->m_Curseur.x;
|
||||
ptpoly[1] = ptpoly[3] = -( GetScreen()->m_Curseur.y );
|
||||
polyline->m_Fill = FlSymbol_Fill;
|
||||
polyline->m_Width = g_LibSymbolDefaultLineWidth;
|
||||
}
|
||||
|
@ -279,8 +277,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
|
|||
LibDrawSegment* Segment = new LibDrawSegment();
|
||||
|
||||
CurrentDrawItem = Segment;
|
||||
Segment->m_Pos.x = m_CurrentScreen->m_Curseur.x;
|
||||
Segment->m_Pos.y = -m_CurrentScreen->m_Curseur.y;
|
||||
Segment->m_Pos.x = GetScreen()->m_Curseur.x;
|
||||
Segment->m_Pos.y = -( GetScreen()->m_Curseur.y );
|
||||
Segment->m_End = Segment->m_Pos;
|
||||
Segment->m_Width = g_LibSymbolDefaultLineWidth;
|
||||
}
|
||||
|
@ -293,12 +291,12 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
|
|||
CurrentDrawItem = Text;
|
||||
Text->m_Size.x = Text->m_Size.y = g_LastTextSize;
|
||||
Text->m_Horiz = g_LastTextOrient;
|
||||
Text->m_Pos.x = m_CurrentScreen->m_Curseur.x;
|
||||
Text->m_Pos.y = -m_CurrentScreen->m_Curseur.y;
|
||||
Text->m_Pos.x = GetScreen()->m_Curseur.x;
|
||||
Text->m_Pos.y = -( GetScreen()->m_Curseur.y );
|
||||
EditSymbolText( NULL, Text );
|
||||
if( Text->m_Text.IsEmpty() )
|
||||
{
|
||||
delete Text;
|
||||
SAFE_DELETE( Text );
|
||||
CurrentDrawItem = NULL;
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
|
@ -364,7 +362,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
|
|||
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||
{
|
||||
wxPoint pos = m_CurrentScreen->m_Curseur;
|
||||
wxPoint pos = GetScreen()->m_Curseur;
|
||||
( (LibDrawPolyline*) CurrentDrawItem )->AddPoint( pos );
|
||||
}
|
||||
break;
|
||||
|
@ -385,7 +383,7 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool era
|
|||
/* Redraw the graphoc shape while moving
|
||||
*/
|
||||
{
|
||||
BASE_SCREEN* Screen = panel->m_Parent->m_CurrentScreen;
|
||||
BASE_SCREEN* Screen = panel->m_Parent->GetScreen();
|
||||
int mx, my;
|
||||
|
||||
/* Erase shape in the old positon*/
|
||||
|
@ -483,7 +481,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
|
|||
SetCursor( wxCURSOR_HAND );
|
||||
|
||||
CurrentDrawItem->m_Flags |= IS_MOVED;
|
||||
StartCursor = m_CurrentScreen->m_Curseur;
|
||||
StartCursor = GetScreen()->m_Curseur;
|
||||
|
||||
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->ForceCloseManageCurseur = AbortSymbolTraceOn;
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
|
||||
|
@ -531,7 +529,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
int DrawMode = g_XorMode;
|
||||
int* ptpoly;
|
||||
int dx, dy;
|
||||
BASE_SCREEN* Screen = panel->m_Parent->m_CurrentScreen;
|
||||
BASE_SCREEN* Screen = panel->m_Parent->GetScreen();
|
||||
int mx = Screen->m_Curseur.x,
|
||||
my = Screen->m_Curseur.y;
|
||||
|
||||
|
@ -722,7 +720,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
|
|||
CurrentDrawItem->m_Flags = 0;
|
||||
CurrentDrawItem = NULL;
|
||||
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
|
@ -834,11 +832,11 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
|
|||
{
|
||||
Poly->n--;
|
||||
ptpoly = Poly->PolyList + ( 2 * (Poly->n - 1) );
|
||||
if( (ptpoly[0] != m_CurrentScreen->m_Curseur.x)
|
||||
|| (ptpoly[1] != -m_CurrentScreen->m_Curseur.y) )
|
||||
if( (ptpoly[0] != GetScreen()->m_Curseur.x)
|
||||
|| (ptpoly[1] != -GetScreen()->m_Curseur.y) )
|
||||
{
|
||||
ptpoly[0] = m_CurrentScreen->m_Curseur.x;
|
||||
ptpoly[1] = -m_CurrentScreen->m_Curseur.y;
|
||||
ptpoly[0] = GetScreen()->m_Curseur.x;
|
||||
ptpoly[1] = -( GetScreen()->m_Curseur.y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( wxDC* DC )
|
|||
}
|
||||
|
||||
SuppressDuplicateDrawItem( CurrentLibEntry );
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
|
||||
// Move (and place ) the new draw items:
|
||||
HandleBlockBegin( DC, -1, GetScreen()->m_Curseur );
|
||||
|
@ -434,14 +434,14 @@ void WinEDA_LibeditFrame::PlaceAncre()
|
|||
EDA_LibComponentStruct* LibEntry;
|
||||
LibEDA_BaseStruct* DrawEntry;
|
||||
|
||||
dx = -m_CurrentScreen->m_Curseur.x;
|
||||
dy = m_CurrentScreen->m_Curseur.y;
|
||||
dx = -( GetScreen()->m_Curseur.x );
|
||||
dy = GetScreen()->m_Curseur.y;
|
||||
|
||||
LibEntry = CurrentLibEntry;
|
||||
if( LibEntry == NULL )
|
||||
return;
|
||||
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
|
||||
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;
|
||||
|
@ -510,7 +510,7 @@ void WinEDA_LibeditFrame::PlaceAncre()
|
|||
}
|
||||
|
||||
/* 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 );
|
||||
m_CurrentScreen->SetRefreshReq();
|
||||
GetScreen()->SetRefreshReq();
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ int DrawMode = g_XorMode;
|
|||
new WinEDA_bodytext_PropertiesFrame(this);
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
|
||||
/* Affichage nouveau texte */
|
||||
if( ((LibDrawText*)DrawItem)->m_Text && DC)
|
||||
|
@ -328,7 +328,7 @@ LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
|
|||
DrawItem->m_Horiz = TEXT_ORIENT_VERT;
|
||||
else DrawItem->m_Horiz = TEXT_ORIENT_HORIZ;
|
||||
|
||||
m_CurrentScreen->SetModify();
|
||||
GetScreen()->SetModify();
|
||||
|
||||
/* Redraw item with new orient */
|
||||
if ( DrawPanel->ManageCurseur == NULL)
|
||||
|
|
|
@ -203,6 +203,10 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
|
|||
BITMAP( add_glabel_xpm ),
|
||||
_( "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,
|
||||
BITMAP( add_junction_xpm ),
|
||||
_( "Add junction" ), wxITEM_CHECK );
|
||||
|
@ -214,7 +218,7 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
|
|||
|
||||
m_VToolBar->AddTool( ID_IMPORT_GLABEL_BUTT, wxEmptyString,
|
||||
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,
|
||||
BITMAP( add_hierar_pin_xpm ),
|
||||
|
|
|
@ -71,7 +71,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame(wxWindow * father, WinEDA_App *parent,
|
|||
if ( m_Semaphore ) SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP);
|
||||
|
||||
m_CurrentScreen = new SCH_SCREEN(VIEWER_FRAME);
|
||||
m_CurrentScreen->SetZoom(16);
|
||||
GetScreen()->SetZoom(16);
|
||||
|
||||
if ( Library == NULL )
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame(wxWindow * father, WinEDA_App *parent,
|
|||
|
||||
WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
|
||||
{
|
||||
delete m_CurrentScreen;
|
||||
SAFE_DELETE( m_CurrentScreen );
|
||||
m_Parent->m_ViewlibFrame = NULL;
|
||||
}
|
||||
|
||||
|
@ -185,8 +185,8 @@ EDA_LibComponentStruct * CurrentLibEntry = NULL;
|
|||
if( CurrentLibEntry == NULL )
|
||||
{
|
||||
bestzoom = 16;
|
||||
m_CurrentScreen->m_Curseur.x = 0;
|
||||
m_CurrentScreen->m_Curseur.y = 0;
|
||||
GetScreen()->m_Curseur.x = 0;
|
||||
GetScreen()->m_Curseur.y = 0;
|
||||
return(bestzoom);
|
||||
}
|
||||
|
||||
|
@ -205,8 +205,8 @@ EDA_LibComponentStruct * CurrentLibEntry = NULL;
|
|||
if(bestzoom > ii ) break;
|
||||
}
|
||||
|
||||
m_CurrentScreen->m_Curseur = BoundaryBox.Centre();
|
||||
m_CurrentScreen->m_Curseur.y = - m_CurrentScreen->m_Curseur.y;
|
||||
GetScreen()->m_Curseur = BoundaryBox.Centre();
|
||||
GetScreen()->m_Curseur.y = -( GetScreen()->m_Curseur.y );
|
||||
|
||||
return(bestzoom);
|
||||
}
|
||||
|
@ -236,8 +236,8 @@ bool found = FALSE;
|
|||
|
||||
free (ListNames);
|
||||
|
||||
/* Librairie courante peut etre non retrouvée en liste
|
||||
(peut etre effacée lors d'une modification de configuration) */
|
||||
/* Librairie courante peut etre non retrouv<EFBFBD>e en liste
|
||||
(peut etre effac<EFBFBD>e lors d'une modification de configuration) */
|
||||
if ( ! found )
|
||||
{
|
||||
g_CurrentViewLibraryName.Empty();
|
||||
|
@ -262,7 +262,7 @@ LibraryStruct *Library = FindLibrary(g_CurrentViewLibraryName.GetData());
|
|||
ii = 0;
|
||||
g_CurrentViewComponentName.Empty();
|
||||
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 )
|
||||
LibEntry = (EDA_LibComponentStruct *) PQFirst(&Library->m_Entries, FALSE);
|
||||
while( LibEntry )
|
||||
|
|
|
@ -66,7 +66,8 @@ void Affiche_Infos_Piste( WinEDA_BasePcbFrame* frame, TRACK* pt_piste )
|
|||
{
|
||||
int d_index, ii = -1;
|
||||
D_CODE* pt_D_code;
|
||||
int layer = frame->GetScreen()->m_Active_Layer;
|
||||
|
||||
int layer = ((PCB_SCREEN*)(frame->GetScreen()))->m_Active_Layer;
|
||||
wxString msg;
|
||||
|
||||
frame->MsgPanel->EraseMsgBox();
|
||||
|
|
|
@ -55,8 +55,8 @@ Outils et D_CODES
|
|||
D_CODES:
|
||||
|
||||
D01 ... D9 = codes d'action:
|
||||
D01 = activation de lumiere (baisser de plume) lors du déplacement
|
||||
D02 = extinction de lumiere (lever 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<EFBFBD>placement
|
||||
D03 = Flash
|
||||
D09 = VAPE Flash
|
||||
|
||||
|
@ -107,7 +107,7 @@ void GERBER_Descr::ResetDefaultValues()
|
|||
m_ImageNegative = FALSE; // TRUE = Negative image
|
||||
m_GerbMetric = FALSE; // FALSE = Inches, TRUE = metric
|
||||
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_MirorB = FALSE; // True: miror / axe B (Y)
|
||||
m_As_DCode = FALSE; // TRUE = DCodes in file (FALSE = no DCode->
|
||||
|
@ -158,7 +158,7 @@ int ii, jj;
|
|||
void GERBER_Descr::InitToolTable()
|
||||
/******************************/
|
||||
/* 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;
|
||||
|
@ -237,7 +237,7 @@ char Line[2000];
|
|||
wxString msg;
|
||||
D_CODE * pt_Dcode;
|
||||
FILE * dest;
|
||||
int layer = GetScreen()->m_Active_Layer;
|
||||
int layer = GetPCBScreen()->m_Active_Layer;
|
||||
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
|
||||
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)*/
|
||||
track->m_Shape = S_SPOT_CIRCLE;
|
||||
break ;
|
||||
|
@ -430,7 +430,7 @@ D_CODE * pt_D_code ;
|
|||
wxString Line;
|
||||
WinEDA_TextFrame * List;
|
||||
int scale = 10000;
|
||||
int curr_layer = GetScreen()->m_Active_Layer;
|
||||
int curr_layer = GetPCBScreen()->m_Active_Layer;
|
||||
int layer;
|
||||
GERBER_Descr * DcodeList;
|
||||
|
||||
|
@ -471,7 +471,7 @@ GERBER_Descr * DcodeList;
|
|||
if (ii < 0) return;
|
||||
|
||||
#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);
|
||||
net_code_Surbrillance = (GetScreen()->m_Active_Layer<< 16) + ii;
|
||||
Hight_Light(DrawPanel, DC);
|
||||
|
|
|
@ -19,8 +19,8 @@ static void Process_Move_Item( WinEDA_GerberFrame* frame,
|
|||
void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||
/************************************************************************/
|
||||
|
||||
/* Traite les commandes declenchée par le bouton gauche de la souris,
|
||||
* quand un outil est deja selectionné
|
||||
/* Traite les commandes declench<EFBFBD>e par le bouton gauche de la souris,
|
||||
* quand un outil est deja selectionn<EFBFBD>
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
||||
|
@ -84,7 +84,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
*/
|
||||
{
|
||||
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];
|
||||
wxPoint pos;
|
||||
wxClientDC dc( DrawPanel );
|
||||
|
@ -95,7 +95,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
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_COPY:
|
||||
|
@ -126,7 +126,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
|
||||
break;
|
||||
|
||||
default: // Arret dea commande de déplacement en cours
|
||||
default: // Arret dea commande de d<EFBFBD>placement en cours
|
||||
if( DrawPanel->ManageCurseur
|
||||
&& DrawPanel->ForceCloseManageCurseur )
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
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 );
|
||||
break;
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS:
|
||||
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;
|
||||
|
||||
default:
|
||||
|
@ -326,8 +326,8 @@ static void Process_Move_Item( WinEDA_GerberFrame* frame,
|
|||
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||
/**************************************************************************/
|
||||
|
||||
/* Appelé sur un double click:
|
||||
* pour un élément editable (textes, composant):
|
||||
/* Appel<EFBFBD> sur un double click:
|
||||
* pour un <EFBFBD>l<EFBFBD>ment editable (textes, composant):
|
||||
* appel de l'editeur correspondant.
|
||||
* pour une connexion en cours:
|
||||
* termine la connexion
|
||||
|
@ -349,7 +349,7 @@ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
|
||||
break;
|
||||
|
||||
// Element localisé
|
||||
// Element localis<EFBFBD>
|
||||
switch( DrawStruct->Type() )
|
||||
{
|
||||
default:
|
||||
|
|
|
@ -41,10 +41,10 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
|
|||
case ID_MENU_INC_LAYER_AND_APPEND_FILE:
|
||||
case ID_INC_LAYER_AND_APPEND_FILE:
|
||||
{
|
||||
int layer = GetScreen()->m_Active_Layer;
|
||||
GetScreen()->m_Active_Layer++;
|
||||
int layer = GetPCBScreen()->m_Active_Layer;
|
||||
((PCB_SCREEN*)GetScreen())->m_Active_Layer++;
|
||||
if( !LoadOneGerberFile( wxEmptyString, &dc, 0 ) )
|
||||
GetScreen()->m_Active_Layer = layer;
|
||||
((PCB_SCREEN*)GetScreen())->m_Active_Layer = layer;
|
||||
SetToolbars();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -114,7 +114,7 @@ BEGIN_EVENT_TABLE(WinEDA_GerberFrame, wxFrame)
|
|||
WinEDA_GerberFrame::OnSelectOptionToolbar)
|
||||
|
||||
|
||||
// PopUp Menu traités dans drawpanel.cpp
|
||||
// PopUp Menu trait<EFBFBD>s dans drawpanel.cpp
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
@ -131,7 +131,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame(wxWindow * father, WinEDA_App *parent,
|
|||
m_AboutTitle = g_GerbviewAboutTitle;
|
||||
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
|
||||
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_ZoomMaxValue = 1024;
|
||||
if ( DrawPanel ) DrawPanel->m_Block_Enable = TRUE;
|
||||
|
@ -189,7 +189,7 @@ PCB_SCREEN * screen;
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
SaveSettings();
|
||||
|
@ -203,7 +203,7 @@ void WinEDA_GerberFrame::SetToolbars()
|
|||
* 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];
|
||||
|
||||
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 )
|
||||
|
|
|
@ -137,13 +137,13 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
break;
|
||||
|
||||
case HK_SWITCH_LAYER_TO_PREVIOUS:
|
||||
if( GetScreen()->m_Active_Layer > 0 )
|
||||
GetScreen()->m_Active_Layer--;
|
||||
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer > 0 )
|
||||
((PCB_SCREEN*)GetScreen())->m_Active_Layer--;
|
||||
break;
|
||||
|
||||
case HK_SWITCH_LAYER_TO_NEXT:
|
||||
if( GetScreen()->m_Active_Layer < 31 )
|
||||
GetScreen()->m_Active_Layer++;
|
||||
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer < 31 )
|
||||
((PCB_SCREEN*)GetScreen())->m_Active_Layer++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
|
|||
|
||||
/* Init parametres de gestion des ecrans PAD et PCB */
|
||||
m_CurrentScreen = ActiveScreen = ScreenPcb;
|
||||
GetScreen()->Init();
|
||||
GetPCBScreen()->Init();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ void WinEDA_GerberFrame::Erase_Segments_Pcb( bool all_layers, bool query )
|
|||
{
|
||||
BOARD_ITEM* PtStruct;
|
||||
BOARD_ITEM* PtNext;
|
||||
int layer = GetScreen()->m_Active_Layer;
|
||||
int layer = GetPCBScreen()->m_Active_Layer;
|
||||
|
||||
if( all_layers )
|
||||
layer = -1;
|
||||
|
@ -189,7 +189,7 @@ void WinEDA_GerberFrame::Erase_Textes_Pcb( bool query )
|
|||
void WinEDA_GerberFrame::Erase_Current_Layer( bool query )
|
||||
/*********************************************************/
|
||||
{
|
||||
int layer = GetScreen()->m_Active_Layer;
|
||||
int layer = GetPCBScreen()->m_Active_Layer;
|
||||
wxString msg;
|
||||
|
||||
msg.Printf( _( "Delete Layer %d" ), layer + 1 );
|
||||
|
|
|
@ -38,7 +38,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
|
|||
/*************************************************************/
|
||||
|
||||
/* 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
|
||||
*/
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
|
|||
int layer;
|
||||
|
||||
/* 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 );
|
||||
if( Track != NULL )
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
|
|||
}
|
||||
|
||||
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 );
|
||||
return TrackLocate;
|
||||
|
|
|
@ -53,8 +53,8 @@
|
|||
* D_CODES:
|
||||
*
|
||||
* D01 ... D9 = codes d'action:
|
||||
* D01 = activation de lumiere (baisser de plume) lors du déplacement
|
||||
* D02 = extinction de lumiere (lever 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<EFBFBD>placement
|
||||
* D03 = Flash
|
||||
* D09 = VAPE Flash
|
||||
* D51 = precede par G54 -> Select VAPE
|
||||
|
@ -91,11 +91,11 @@
|
|||
*
|
||||
* Representation interne:
|
||||
*
|
||||
* Les lignes sont représentées par des TRACKS standards
|
||||
* Les Flash sont représentées par des DRAWSEGMENTS
|
||||
* Les lignes sont repr<EFBFBD>sent<EFBFBD>es par des TRACKS standards
|
||||
* Les Flash sont repr<EFBFBD>sent<EFBFBD>es par des DRAWSEGMENTS
|
||||
* - ronds ou ovales: 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;
|
||||
int error = 0;
|
||||
|
||||
layer = GetScreen()->m_Active_Layer;
|
||||
layer = GetPCBScreen()->m_Active_Layer;
|
||||
|
||||
if( g_GERBER_Descr_List[layer] == NULL )
|
||||
{
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
* D_CODES:
|
||||
*
|
||||
* D01 ... D9 = codes d'action:
|
||||
* D01 = activation de lumiere (baisser de plume) lors du déplacement
|
||||
* D02 = extinction de lumiere (lever 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<EFBFBD>placement
|
||||
* D03 = Flash
|
||||
* D09 = VAPE Flash
|
||||
* 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->SetLayer( frame->GetScreen()->m_Active_Layer );
|
||||
track->SetLayer( frame->GetPCBScreen()->m_Active_Layer );
|
||||
track->m_Width = diametre;
|
||||
track->m_Start = track->m_End = pos;
|
||||
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->SetLayer( frame->GetScreen()->m_Active_Layer );
|
||||
track->SetLayer( frame->GetPCBScreen()->m_Active_Layer );
|
||||
track->m_Width = width;
|
||||
track->m_Start = track->m_End = pos;
|
||||
NEGATE( track->m_Start.y );
|
||||
|
@ -150,7 +150,7 @@ static void Append_1_Flash_GERBER( int Dcode_index,
|
|||
if( forme == PAD_OVAL )
|
||||
track->m_Shape = S_SPOT_OVALE;
|
||||
else
|
||||
track->m_Shape = S_SPOT_RECT; // donc rectangle ou carré
|
||||
track->m_Shape = S_SPOT_RECT; // donc rectangle ou carr<EFBFBD>
|
||||
|
||||
len >>= 1;
|
||||
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->SetLayer( frame->GetScreen()->m_Active_Layer );
|
||||
track->SetLayer( frame->GetPCBScreen()->m_Active_Layer );
|
||||
track->m_Width = largeur;
|
||||
track->m_Start = startpoint;
|
||||
NEGATE( track->m_Start.y );
|
||||
|
@ -203,10 +203,10 @@ static void Append_1_SEG_ARC_GERBER( int Dcode_index,
|
|||
|
||||
/* creation d'un arc:
|
||||
* 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
|
||||
* et rel_center est la coordonnée du centre relativement au startpoint,
|
||||
* si multiquadrant == FALSE arc de 0 <EFBFBD> 90 entierement contenu dans le meme quadrant
|
||||
* 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
|
||||
* 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->m_Shape = S_ARC;
|
||||
track->SetLayer( frame->GetScreen()->m_Active_Layer );
|
||||
track->SetLayer( frame->GetPCBScreen()->m_Active_Layer );
|
||||
track->m_Width = largeur;
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
|
@ -436,7 +436,7 @@ wxPoint GERBER_Descr::ReadIJCoord( char*& Text )
|
|||
/************************************************/
|
||||
|
||||
/* 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
|
||||
*/
|
||||
{
|
||||
|
@ -741,7 +741,7 @@ bool GERBER_Descr::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
|
||||
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_Start = m_PreviousPos;
|
||||
NEGATE( edge_poly->m_Start.y );
|
||||
|
@ -850,7 +850,7 @@ bool GERBER_Descr::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
|
|||
PAD_RECT );
|
||||
break;
|
||||
|
||||
default: // Special (Macro) : Non implanté
|
||||
default: // Special (Macro) : Non implant<EFBFBD>
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
|
|||
|
||||
if( GetScreen() )
|
||||
{
|
||||
layer = GetScreen()->m_Active_Layer;
|
||||
layer = GetPCBScreen()->m_Active_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,
|
||||
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->AddSeparator();
|
||||
|
|
|
@ -64,7 +64,7 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
/* Trace le PCB, et les elements complementaires ( axes, grille .. )
|
||||
*/
|
||||
{
|
||||
PCB_SCREEN* screen = GetScreen();
|
||||
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
|
||||
|
||||
if( !m_Pcb )
|
||||
return;
|
||||
|
|
|
@ -50,6 +50,7 @@ enum KICAD_T {
|
|||
DRAW_TEXT_STRUCT_TYPE,
|
||||
DRAW_LABEL_STRUCT_TYPE,
|
||||
DRAW_GLOBAL_LABEL_STRUCT_TYPE,
|
||||
DRAW_HIER_LABEL_STRUCT_TYPE,
|
||||
DRAW_LIB_ITEM_STRUCT_TYPE,
|
||||
DRAW_PICK_ITEM_STRUCT_TYPE,
|
||||
DRAW_SEGMENT_STRUCT_TYPE,
|
||||
|
|
|
@ -340,7 +340,7 @@ COMMON_GLOBL int g_GridColor
|
|||
#endif
|
||||
;
|
||||
|
||||
/* Current used screen: */
|
||||
/* Current used screen: (not used in eeshema)*/
|
||||
COMMON_GLOBL BASE_SCREEN* ActiveScreen;
|
||||
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ class wxSVGFileDC : public wxDC
|
|||
void SetFont(const wxFont& font) ;
|
||||
|
||||
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 ) ;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue