mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-19 09:41:41 +00:00
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
CMakeLists.txtchange_log.txt
common
base_screen.cppbase_struct.cppbasicframe.cppcommon_plot_functions.cppcopy_to_clipboard.cppgestfich.cppworksheet.cpp
eeschema
CMakeLists.txtaffiche.cppannotate.cppblock.cppbus-wire-junction.cppclass_drawsheet.cppclass_hierarchy_sheet.cppclass_screen.cppclass_screen.hclass_text-label.cppcleanup.cppcomponent_class.cppcomponent_class.hcontrole.cppdangling_ends.cppdelete.cppdelsheet.cppdialog_build_BOM.cppdialog_build_BOM.hdialog_edit_label.cppdialog_options.cppdivers.cppedit_component_in_lib.cppedit_component_in_schematic.cppedit_label.cppeeconfig.cppeecreate.cppeelibs_draw_components.cppeelibs_read_libraryfiles.cppeeload.cppeeredraw.cppeeschema.cpperc.cppfiles-io.cppfind.cppgeneral.hgetpart.cpphierarch.cpphotkeys.cpplibarch.cpplibclass.cpplibedit.cpplibedit_onleftclick.cpplibedit_onrightclick.cpplibedit_undo_redo.cpplibfield.cpplibframe.cppload_one_schematic_file.cpplocate.cppmakefile.includemenubar.cppnetform.cppnetlist.cppnetlist.hnetlist_control.cpponleftclick.cpponrightclick.cpppinedit.cppplot.cppplothpgl.cppplotps.cppprogram.hprotos.hsave_schemas.cppsavelib.cppschedit.cppschematic_undo_redo.cppschframe.cppsheet.cppsheet.hsheetlab.cppsymbdraw.cppsymbedit.cppsymbtext.cpptool_sch.cppviewlib_frame.cpp
gerbview
affiche.cppdcode.cppedit.cppfiles.cppgerberframe.cpphotkeys.cppinitpcb.cpplocate.cppreadgerb.cpprs274d.cpptool_gerber.cpptracepcb.cpp
include
kicad
libs.linuxpcbnew
autorout.cppbasepcbframe.cppclass_board.cppclass_module.cppclass_module.hcleaningoptions_dialog.cppcleaningoptions_dialog.hcotation.cppdeltrack.cppdialog_drc.cppdialog_drc.hdialog_netlist.hdialog_zones_by_polygon.cppedit.cppeditedge.cppeditrack-part2.cppeditrack.cppexport_gencad.cppfind.cppgendrill.cpphotkeys.cppinitpcb.cppioascii.cpplocate.cppmakefile.gtkmakefile.includenetlist.cpponleftclick.cpponrightclick.cpppcbnew.hpcbtexte.cppplothpgl.cppplotps.cppset_grid.cpptool_pcb.cpptracepcb.cppxchgmod.cppzones_by_polygon.cpp
share
@ -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,24 +643,19 @@ 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 );
|
||||
|
||||
/* Break full components reference in name (prefix) and number: example: IC1 become IC, and 1 */
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
625
eeschema/class_drawsheet.cpp
Normal file
625
eeschema/class_drawsheet.cpp
Normal file
@ -0,0 +1,625 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Name: DrawSheet.cpp
|
||||
// Purpose: member functions for DrawSheetStruct and DrawSheetLabelStruct
|
||||
// header = class_screen.h
|
||||
// Author: jean-pierre Charras
|
||||
// Modified by:
|
||||
// Created: 08/02/2006 18:37:02
|
||||
// RCS-ID:
|
||||
// Copyright: License GNU
|
||||
// Licence:
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "program.h"
|
||||
#include "libcmp.h"
|
||||
#include "general.h"
|
||||
|
||||
#include "protos.h"
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
|
||||
EDA_BaseStruct( DRAW_SHEET_STRUCT_TYPE )
|
||||
/***********************************************************/
|
||||
{
|
||||
m_Label = NULL;
|
||||
m_NbLabel = 0;
|
||||
m_Layer = LAYER_SHEET;
|
||||
m_Pos = pos;
|
||||
m_SheetNameSize = m_FileNameSize = 60;
|
||||
m_s = NULL;
|
||||
m_SheetName = wxT("Root");
|
||||
m_FileName = wxT(" ");
|
||||
}
|
||||
|
||||
|
||||
/**************************************/
|
||||
DrawSheetStruct::~DrawSheetStruct()
|
||||
/**************************************/
|
||||
{
|
||||
DrawSheetLabelStruct* label = m_Label, * next_label;
|
||||
while( label ){
|
||||
next_label = (DrawSheetLabelStruct*) label->Pnext;
|
||||
delete label;
|
||||
label = next_label;
|
||||
}
|
||||
|
||||
//also, look at the associated sheet & its reference count
|
||||
//perhaps it should be deleted also.
|
||||
if(m_s){
|
||||
m_s->m_RefCount--;
|
||||
if(m_s->m_RefCount == 0)
|
||||
delete m_s;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
DrawSheetStruct* DrawSheetStruct::GenCopy()
|
||||
/***********************************************/
|
||||
|
||||
/* creates a copy of a sheet
|
||||
* The linked data itself (EEDrawList) is not duplicated
|
||||
*/
|
||||
{
|
||||
DrawSheetStruct* newitem = new DrawSheetStruct( m_Pos );
|
||||
|
||||
|
||||
newitem->m_Size = m_Size;
|
||||
newitem->m_Parent = m_Parent;
|
||||
newitem->m_TimeStamp = GetTimeStamp();
|
||||
|
||||
newitem->m_FileName = m_FileName;
|
||||
newitem->m_FileNameSize = m_FileNameSize;
|
||||
newitem->m_SheetName = m_SheetName;
|
||||
newitem->m_SheetNameSize = m_SheetNameSize;
|
||||
|
||||
newitem->m_Label = NULL;
|
||||
|
||||
DrawSheetLabelStruct* Slabel = NULL, *label = m_Label;
|
||||
|
||||
if( label )
|
||||
{
|
||||
Slabel = newitem->m_Label = label->GenCopy();
|
||||
Slabel->m_Parent = newitem;
|
||||
label = (DrawSheetLabelStruct*) label->Pnext;
|
||||
}
|
||||
|
||||
while( label )
|
||||
{
|
||||
Slabel->Pnext = label->GenCopy();
|
||||
Slabel = (DrawSheetLabelStruct*) Slabel->Pnext;
|
||||
Slabel->m_Parent = newitem;
|
||||
label = (DrawSheetLabelStruct*) label->Pnext;
|
||||
}
|
||||
|
||||
/* don't copy screen data - just reference it. */
|
||||
newitem->m_s = m_s;
|
||||
if(m_s)
|
||||
m_s->m_RefCount++;
|
||||
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
|
||||
/**********************************************************/
|
||||
/* Used if undo / redo command:
|
||||
* swap data between this and copyitem
|
||||
*/
|
||||
{
|
||||
EXCHG( m_Pos, copyitem->m_Pos );
|
||||
EXCHG( m_Size, copyitem->m_Size );
|
||||
EXCHG( m_SheetName, copyitem->m_SheetName );
|
||||
EXCHG( m_SheetNameSize, copyitem->m_SheetNameSize );
|
||||
EXCHG( m_FileNameSize, copyitem->m_FileNameSize );
|
||||
EXCHG( m_Label, copyitem->m_Label );
|
||||
EXCHG( m_NbLabel, copyitem->m_NbLabel );
|
||||
}
|
||||
/****************************************************************/
|
||||
void DrawSheetStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
|
||||
/****************************************************************/
|
||||
{
|
||||
/* Placement en liste des structures si nouveau composant:*/
|
||||
if( m_Flags & IS_NEW )
|
||||
{
|
||||
if( !( (WinEDA_SchematicFrame*) frame )->EditSheet( this, DC ) )
|
||||
{
|
||||
frame->GetScreen()->SetCurItem( NULL );
|
||||
frame->DrawPanel->ManageCurseur = NULL;
|
||||
frame->DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
RedrawOneStruct( frame->DrawPanel, DC, this, g_XorMode );
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EDA_BaseStruct::Place( frame, DC ); //puts it on the EEDrawList.
|
||||
}
|
||||
/********************************************************************/
|
||||
void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
/********************************************************************/
|
||||
/* Delete pinsheets which are not corresponding to a hierarchal label
|
||||
* if DC != NULL, redraw Sheet
|
||||
*/
|
||||
{
|
||||
DrawSheetLabelStruct* Pinsheet, * NextPinsheet;
|
||||
|
||||
if( !IsOK( frame, _( "Ok to cleanup this sheet" ) ) )
|
||||
return;
|
||||
|
||||
Pinsheet = m_Label;
|
||||
while( Pinsheet )
|
||||
{
|
||||
/* Search Glabel corresponding to this Pinsheet */
|
||||
|
||||
EDA_BaseStruct* DrawStruct = m_s->EEDrawList;
|
||||
DrawHierLabelStruct* HLabel = NULL;
|
||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
|
||||
{
|
||||
if( DrawStruct->Type() != DRAW_HIER_LABEL_STRUCT_TYPE )
|
||||
continue;
|
||||
HLabel = (DrawHierLabelStruct*) DrawStruct;
|
||||
if( Pinsheet->m_Text.CmpNoCase( HLabel->m_Text ) == 0 )
|
||||
break; // Found!
|
||||
HLabel = NULL;
|
||||
}
|
||||
|
||||
NextPinsheet = (DrawSheetLabelStruct*) Pinsheet->Pnext;
|
||||
if( HLabel == NULL ) // Hlabel not found: delete pinsheet
|
||||
{
|
||||
frame->GetScreen()->SetModify();
|
||||
frame->DeleteSheetLabel( DC, Pinsheet );
|
||||
}
|
||||
Pinsheet = NextPinsheet;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************************/
|
||||
void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int DrawMode, int Color )
|
||||
/**************************************************************************************/
|
||||
/* Draw the hierarchical sheet shape */
|
||||
{
|
||||
DrawSheetLabelStruct* SheetLabelStruct;
|
||||
int txtcolor;
|
||||
wxString Text;
|
||||
int color;
|
||||
wxPoint pos = m_Pos + offset;
|
||||
int LineWidth = g_DrawMinimunLineWidth;
|
||||
|
||||
if( Color >= 0 )
|
||||
color = Color;
|
||||
else
|
||||
color = ReturnLayerColor( m_Layer );
|
||||
GRSetDrawMode( DC, DrawMode );
|
||||
|
||||
GRRect( &panel->m_ClipBox, DC, pos.x, pos.y,
|
||||
pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color );
|
||||
|
||||
/* Draw text : SheetName */
|
||||
if( Color > 0 )
|
||||
txtcolor = Color;
|
||||
else
|
||||
txtcolor = ReturnLayerColor( LAYER_SHEETNAME );
|
||||
|
||||
Text = wxT( "Sheet: " ) + m_SheetName;
|
||||
DrawGraphicText( panel, DC,
|
||||
wxPoint( pos.x, pos.y - 8 ), txtcolor,
|
||||
Text, TEXT_ORIENT_HORIZ, wxSize( m_SheetNameSize, m_SheetNameSize ),
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
|
||||
|
||||
/* Draw text : FileName */
|
||||
if( Color >= 0 )
|
||||
txtcolor = Color;
|
||||
else
|
||||
txtcolor = ReturnLayerColor( LAYER_SHEETFILENAME );
|
||||
Text = wxT( "File: " ) + m_FileName;
|
||||
DrawGraphicText( panel, DC,
|
||||
wxPoint( pos.x, pos.y + m_Size.y + 4 ),
|
||||
txtcolor,
|
||||
Text, TEXT_ORIENT_HORIZ, wxSize( m_FileNameSize, m_FileNameSize ),
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, LineWidth );
|
||||
|
||||
|
||||
/* Draw text : SheetLabel */
|
||||
SheetLabelStruct = m_Label;
|
||||
while( SheetLabelStruct != NULL )
|
||||
{
|
||||
SheetLabelStruct->Draw( panel, DC, offset, DrawMode, Color );
|
||||
SheetLabelStruct = (DrawSheetLabelStruct*) (SheetLabelStruct->Pnext);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************************/
|
||||
void DrawSheetStruct::DeleteAnnotation( bool recurse )
|
||||
/**************************************************************************************/
|
||||
{
|
||||
if(recurse && m_s){
|
||||
EDA_BaseStruct* strct = m_s->EEDrawList;
|
||||
for(; strct; strct = strct->Pnext){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* sheet = (DrawSheetStruct*)strct;
|
||||
sheet->DeleteAnnotation(recurse);
|
||||
}
|
||||
}
|
||||
}
|
||||
EDA_BaseStruct* comp = m_s->EEDrawList;
|
||||
for( ; comp ; comp = comp->Pnext ){
|
||||
if(comp->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ){
|
||||
((EDA_SchComponentStruct*)comp)->ClearAnnotation();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*******************************************************************/
|
||||
int DrawSheetStruct::ComponentCount( )
|
||||
/*******************************************************************/
|
||||
{
|
||||
//count our own components, without the power components.
|
||||
/* Routine retournant le nombre de composants dans le schema,
|
||||
* powers non comprises */
|
||||
int n = 0;
|
||||
if(m_s){
|
||||
EDA_BaseStruct* bs;
|
||||
for( bs = m_s->EEDrawList; bs != NULL; bs = bs->Pnext ){
|
||||
if( bs->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ){
|
||||
DrawPartStruct* Cmp = (DrawPartStruct*) bs;
|
||||
if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
|
||||
n++;
|
||||
}
|
||||
if(bs->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* sheet = (DrawSheetStruct*)bs;
|
||||
n += sheet->ComponentCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
/*******************************************************************************/
|
||||
bool DrawSheetStruct::SearchHierarchy(wxString filename, SCH_SCREEN **screen)
|
||||
/*******************************************************************************/
|
||||
{
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
if(m_s){
|
||||
EDA_BaseStruct* strct = m_s->EEDrawList;
|
||||
while(strct){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*)strct;
|
||||
if(ss->m_s && ss->m_s->m_FileName.CmpNoCase(filename) == 0){
|
||||
*screen = ss->m_s;
|
||||
return true;
|
||||
}
|
||||
if(ss->SearchHierarchy(filename, screen))
|
||||
return true;
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*******************************************************************************/
|
||||
bool DrawSheetStruct::LocatePathOfScreen(SCH_SCREEN *screen, DrawSheetList* list)
|
||||
/*******************************************************************************/
|
||||
{
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
//don't bother looking at the root sheet - it must be unique,
|
||||
//no other references to its m_s otherwise there would be loops
|
||||
//in the heirarchy.
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
if(m_s){
|
||||
list->Push(this);
|
||||
if(m_s == screen)
|
||||
return true;
|
||||
EDA_BaseStruct* strct = m_s->EEDrawList;
|
||||
while(strct){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*)strct;
|
||||
if(ss->LocatePathOfScreen(screen, list))
|
||||
return true;
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
list->Pop();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
bool DrawSheetStruct::Load(WinEDA_SchematicFrame* frame)
|
||||
/*******************************************************************************/
|
||||
{
|
||||
if(!m_s){
|
||||
SCH_SCREEN* screen = NULL;
|
||||
g_RootSheet->SearchHierarchy(m_FileName, &screen);
|
||||
if(screen){
|
||||
m_s = screen;
|
||||
m_s->m_RefCount++;
|
||||
//do not need to load the sub-sheets - this has already been done.
|
||||
}else{
|
||||
m_s = new SCH_SCREEN(SCHEMATIC_FRAME);
|
||||
if(!frame->LoadOneEEFile(m_s, m_FileName))
|
||||
return false;
|
||||
m_s->m_RefCount++;
|
||||
EDA_BaseStruct* bs = m_s->EEDrawList;
|
||||
while(bs){
|
||||
if(bs->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*)bs;
|
||||
if(!ss->Load(frame))
|
||||
return false;
|
||||
}
|
||||
bs = bs->Pnext;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*******************************************************************************/
|
||||
int DrawSheetStruct::CountSheets()
|
||||
/*******************************************************************************/
|
||||
{
|
||||
int count = 1; //1 = this!!
|
||||
if(m_s){
|
||||
EDA_BaseStruct* strct = m_s->EEDrawList;
|
||||
for(; strct; strct = strct->Pnext){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*)strct;
|
||||
count += ss->CountSheets();
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/************************/
|
||||
/* DrawSheetLabelStruct */
|
||||
/************************/
|
||||
|
||||
/*******************************************************************/
|
||||
DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent,
|
||||
const wxPoint& pos, const wxString& text ) :
|
||||
EDA_BaseStruct( DRAW_SHEETLABEL_STRUCT_TYPE ),
|
||||
EDA_TextStruct( text )
|
||||
/*******************************************************************/
|
||||
{
|
||||
m_Layer = LAYER_SHEETLABEL;
|
||||
m_Parent = parent;
|
||||
m_Pos = pos;
|
||||
m_Edge = 0;
|
||||
m_Shape = NET_INPUT;
|
||||
m_IsDangling = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
DrawSheetLabelStruct* DrawSheetLabelStruct::GenCopy()
|
||||
/***********************************************************/
|
||||
{
|
||||
DrawSheetLabelStruct* newitem =
|
||||
new DrawSheetLabelStruct( (DrawSheetStruct*) m_Parent, m_Pos, m_Text );
|
||||
|
||||
newitem->m_Edge = m_Edge;
|
||||
newitem->m_Shape = m_Shape;
|
||||
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************************/
|
||||
void DrawSheetLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int DrawMode, int Color )
|
||||
/********************************************************************************************/
|
||||
/* Routine de dessin des Labels type hierarchie */
|
||||
{
|
||||
int side, txtcolor;
|
||||
int posx, tposx, posy, size2;
|
||||
wxSize size;
|
||||
int NbSegm, coord[20];
|
||||
int LineWidth = g_DrawMinimunLineWidth;
|
||||
|
||||
if( Color >= 0 )
|
||||
txtcolor = Color;
|
||||
else
|
||||
txtcolor = ReturnLayerColor( m_Layer );
|
||||
GRSetDrawMode( DC, DrawMode );
|
||||
|
||||
posx = m_Pos.x + offset.x; posy = m_Pos.y + offset.y; size = m_Size;
|
||||
if( !m_Text.IsEmpty() )
|
||||
{
|
||||
if( m_Edge )
|
||||
{
|
||||
tposx = posx - size.x;
|
||||
side = GR_TEXT_HJUSTIFY_RIGHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
tposx = posx + size.x + (size.x / 8);
|
||||
side = GR_TEXT_HJUSTIFY_LEFT;
|
||||
}
|
||||
DrawGraphicText( panel, DC, wxPoint( tposx, posy ), txtcolor,
|
||||
m_Text, TEXT_ORIENT_HORIZ, size,
|
||||
side, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
|
||||
}
|
||||
/* dessin du symbole de connexion */
|
||||
|
||||
if( m_Edge )
|
||||
{
|
||||
size.x = -size.x;
|
||||
size.y = -size.y;
|
||||
}
|
||||
|
||||
coord[0] = posx; coord[1] = posy; size2 = size.x / 2;
|
||||
NbSegm = 0;
|
||||
|
||||
switch( m_Shape )
|
||||
{
|
||||
case 0: /* input |> */
|
||||
coord[2] = posx; coord[3] = posy - size2;
|
||||
coord[4] = posx + size2; coord[5] = posy - size2;
|
||||
coord[6] = posx + size.x; coord[7] = posy;
|
||||
coord[8] = posx + size2; coord[9] = posy + size2;
|
||||
coord[10] = posx; coord[11] = posy + size2;
|
||||
coord[12] = coord[0]; coord[13] = coord[1];
|
||||
NbSegm = 7;
|
||||
break;
|
||||
|
||||
case 1: /* output <| */
|
||||
coord[2] = posx + size2; coord[3] = posy - size2;
|
||||
coord[4] = posx + size.x; coord[5] = posy - size2;
|
||||
coord[6] = posx + size.x; coord[7] = posy + size2;
|
||||
coord[8] = posx + size2; coord[9] = posy + size2;
|
||||
coord[10] = coord[0]; coord[11] = coord[1];
|
||||
NbSegm = 6;
|
||||
break;
|
||||
|
||||
case 2: /* bidi <> */
|
||||
case 3: /* TriSt <> */
|
||||
coord[2] = posx + size2; coord[3] = posy - size2;
|
||||
coord[4] = posx + size.x; coord[5] = posy;
|
||||
coord[6] = posx + size2; coord[7] = posy + size2;
|
||||
coord[8] = coord[0]; coord[9] = coord[1];
|
||||
NbSegm = 5;
|
||||
break;
|
||||
|
||||
default: /* unsp []*/
|
||||
coord[2] = posx; coord[3] = posy - size2;
|
||||
coord[4] = posx + size.x; coord[5] = posy - size2;
|
||||
coord[6] = posx + size.x; coord[7] = posy + size2;
|
||||
coord[8] = posx; coord[9] = posy + size2;
|
||||
coord[10] = coord[0]; coord[11] = coord[1];
|
||||
NbSegm = 6;
|
||||
break;
|
||||
}
|
||||
|
||||
int FillShape = FALSE;
|
||||
GRPoly( &panel->m_ClipBox, DC, NbSegm, coord, FillShape, LineWidth, txtcolor, txtcolor ); /* Poly Non rempli */
|
||||
}
|
||||
|
||||
/**********************************************/
|
||||
/* class to handle a series of sheets *********/
|
||||
/* a 'path' so to speak.. *********************/
|
||||
/**********************************************/
|
||||
DrawSheetList::DrawSheetList(){
|
||||
for(int i=0; i<DSLSZ ; i++)
|
||||
m_sheets[i] = NULL;
|
||||
m_numSheets = 0;
|
||||
}
|
||||
int DrawSheetList::Cmp(DrawSheetList& d){
|
||||
if(m_numSheets > d.m_numSheets)
|
||||
return 1;
|
||||
if(m_numSheets < d.m_numSheets)
|
||||
return -1;
|
||||
//otherwise, same number of sheets.
|
||||
for(int i=0; i<m_numSheets; i++){
|
||||
if(m_sheets[i]->m_TimeStamp > d.m_sheets[i]->m_TimeStamp)
|
||||
return 1;
|
||||
if(m_sheets[i]->m_TimeStamp < d.m_sheets[i]->m_TimeStamp)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
DrawSheetStruct* DrawSheetList::Last(){
|
||||
if(m_numSheets)
|
||||
return m_sheets[m_numSheets-1];
|
||||
return NULL;
|
||||
}
|
||||
SCH_SCREEN* DrawSheetList::LastScreen(){
|
||||
if(m_numSheets)
|
||||
return m_sheets[m_numSheets-1]->m_s;
|
||||
return NULL;
|
||||
}
|
||||
EDA_BaseStruct* DrawSheetList::LastDrawList(){
|
||||
if(m_numSheets && m_sheets[m_numSheets-1]->m_s)
|
||||
return m_sheets[m_numSheets-1]->m_s->EEDrawList;
|
||||
return NULL;
|
||||
}
|
||||
void DrawSheetList::Push(DrawSheetStruct* sheet){
|
||||
if(m_numSheets < DSLSZ){
|
||||
m_sheets[m_numSheets] = sheet;
|
||||
m_numSheets++;
|
||||
}
|
||||
}
|
||||
DrawSheetStruct* DrawSheetList::Pop(){
|
||||
if(m_numSheets > 0){
|
||||
m_numSheets --;
|
||||
return m_sheets[m_numSheets];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
wxString DrawSheetList::Path(){
|
||||
wxString s, t;
|
||||
s = wxT("/");
|
||||
//start at 1 to avoid the root sheet,
|
||||
//which does not need to be added to the path
|
||||
//it's timestamp changes anyway.
|
||||
for(int i=1; i< m_numSheets; i++){
|
||||
t.Printf(_("%8.8lX/"), m_sheets[i]->m_TimeStamp);
|
||||
s = s + t;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
wxString DrawSheetList::PathHumanReadable(){
|
||||
wxString s, t;
|
||||
s = wxT("/");
|
||||
//start at 1 to avoid the root sheet, as above.
|
||||
for(int i=1; i< m_numSheets; i++){
|
||||
s = s + m_sheets[i]->m_SheetName + wxT("/");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
void DrawSheetList::UpdateAllScreenReferences(){
|
||||
EDA_BaseStruct* t = LastDrawList();
|
||||
while(t){
|
||||
if(t->Type() == DRAW_LIB_ITEM_STRUCT_TYPE){
|
||||
EDA_SchComponentStruct* d = (EDA_SchComponentStruct*)t;
|
||||
d->m_Field[REFERENCE].m_Text = d->GetRef(this);
|
||||
}
|
||||
t = t->Pnext;
|
||||
}
|
||||
printf( "on sheet: %s \n", CONV_TO_UTF8(PathHumanReadable()) );
|
||||
}
|
||||
bool DrawSheetList::operator= (const DrawSheetList& d1){
|
||||
m_numSheets = d1.m_numSheets;
|
||||
int i;
|
||||
for(i=0; i<m_numSheets; i++){
|
||||
m_sheets[i] = d1.m_sheets[i];
|
||||
}
|
||||
for(; i<DSLSZ; i++){
|
||||
m_sheets[i] = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool DrawSheetList::operator==(const DrawSheetList &d1){
|
||||
if(m_numSheets != d1.m_numSheets)
|
||||
return false;
|
||||
for(int i=0; i<m_numSheets; i++){
|
||||
if(m_sheets[i] != d1.m_sheets[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool DrawSheetList::operator!=(const DrawSheetList &d1){
|
||||
if(m_numSheets != d1.m_numSheets)
|
||||
return true;
|
||||
for(int i=0; i<m_numSheets; i++){
|
||||
if(m_sheets[i] != d1.m_sheets[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
@ -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;
|
||||
|
||||
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 */
|
||||
/*********************************************************************/
|
||||
|
||||
if( (index >= 0) && index < m_Count )
|
||||
screen = m_List[index];
|
||||
|
||||
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];
|
||||
|
||||
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;
|
||||
|
||||
/* Class to handle the list of screens in a hierarchy */
|
||||
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,7 +89,72 @@ 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
|
||||
{
|
||||
// avoid unnecessarily copying wxStrings.
|
||||
@ -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 ) { }
|
||||
@ -142,7 +143,13 @@ public:
|
||||
void SwapData( EDA_SchComponentStruct* copyitem );
|
||||
|
||||
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
||||
|
||||
|
||||
|
||||
//returns a unique ID, in the form of a path.
|
||||
wxString GetPath( DrawSheetList* sheet);
|
||||
const wxString GetRef( DrawSheetList* sheet );
|
||||
void SetRef( DrawSheetList* sheet, wxString ref );
|
||||
void ClearRefs();
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* 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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user