Commit c5cd8502 authored by lifekidyeaa's avatar lifekidyeaa

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.
parent 27bd742a
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# #
# CMAKE_VERBOSE_MAKEFILE ON/OFF (OPTIONAL) # CMAKE_VERBOSE_MAKEFILE ON/OFF (OPTIONAL)
# Turns ON/OFF verbose build messages. # Turns ON/OFF verbose build messages.
# you can also pass VERBOSE=1 to make for the same effect.
# #
# CMAKE_INSTALL_PREFIX (OPTIONAL) # CMAKE_INSTALL_PREFIX (OPTIONAL)
# #
......
...@@ -6,6 +6,19 @@ Please add newer entries at the top, list the date and your name with ...@@ -6,6 +6,19 @@ Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Feb-12 UPDATE Tim Hanson sideskate@gmail.com
================================================================================
+eeschema
* commiting my changes to allow multiple instances of a given schematic file within a hierarchy:
** internally, m_currentScreen has been replaced with m_currentSheet,
which is a list or 'path' of screens. The path of screens is used to generate
a series of timestamps, which is converted to flat component reference via a look-up
table in the schematic files.
** this means that m_currentScreen is no longer used -- use GetScreen().
** GetScreen is virtual, as some of the dialogs keep around a WinEDA_BaseScreen pointer.
** all sub-sheets in a given schematic must have different names to generate a meaningful netlist.
=======
2008-Feb-12 UPDATE Igor Plyatov <plyatov@mail.ru> 2008-Feb-12 UPDATE Igor Plyatov <plyatov@mail.ru>
================================================================================ ================================================================================
+eeschema +eeschema
...@@ -13,7 +26,6 @@ email address. ...@@ -13,7 +26,6 @@ email address.
+all +all
Russian translation update. Russian translation update.
2008-Feb-11 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Feb-11 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+pcbnew +pcbnew
......
...@@ -49,7 +49,7 @@ BASE_SCREEN::~BASE_SCREEN() ...@@ -49,7 +49,7 @@ BASE_SCREEN::~BASE_SCREEN()
void BASE_SCREEN::InitDatas() void BASE_SCREEN::InitDatas()
/*******************************/ /*******************************/
{ {
m_SheetNumber = m_NumberOfSheet = 1; /* gestion hierarchie: Root: SheetNumber = 1 */ m_ScreenNumber = m_NumberOfScreen = 1; /* gestion hierarchie: Root: ScreenNumber = 1 */
m_Zoom = 32; m_Zoom = 32;
m_Grid = wxSize( 50, 50 ); /* pas de la grille */ m_Grid = wxSize( 50, 50 ); /* pas de la grille */
m_UserGrid = g_UserGrid; /* pas de la grille "utilisateur" */ m_UserGrid = g_UserGrid; /* pas de la grille "utilisateur" */
...@@ -63,18 +63,18 @@ void BASE_SCREEN::InitDatas() ...@@ -63,18 +63,18 @@ void BASE_SCREEN::InitDatas()
{ {
case SCHEMATIC_FRAME: case SCHEMATIC_FRAME:
m_Center = FALSE; m_Center = FALSE;
m_CurrentSheet = &g_Sheet_A4; m_CurrentSheetDesc = &g_Sheet_A4;
break; break;
default: default:
case CVPCB_DISPLAY_FRAME: case CVPCB_DISPLAY_FRAME:
case MODULE_EDITOR_FRAME: case MODULE_EDITOR_FRAME:
case PCB_FRAME: case PCB_FRAME:
m_CurrentSheet = &g_Sheet_A4; m_CurrentSheetDesc = &g_Sheet_A4;
break; break;
case GERBER_FRAME: case GERBER_FRAME:
m_CurrentSheet = &g_Sheet_GERBER; m_CurrentSheetDesc = &g_Sheet_GERBER;
break; break;
} }
...@@ -158,15 +158,15 @@ wxSize BASE_SCREEN::ReturnPageSize() ...@@ -158,15 +158,15 @@ wxSize BASE_SCREEN::ReturnPageSize()
{ {
default: default:
case SCHEMATIC_FRAME: case SCHEMATIC_FRAME:
PageSize = m_CurrentSheet->m_Size; PageSize = m_CurrentSheetDesc->m_Size;
break; break;
case GERBER_FRAME: case GERBER_FRAME:
case CVPCB_DISPLAY_FRAME: case CVPCB_DISPLAY_FRAME:
case MODULE_EDITOR_FRAME: case MODULE_EDITOR_FRAME:
case PCB_FRAME: case PCB_FRAME:
PageSize.x = m_CurrentSheet->m_Size.x * (PCB_INTERNAL_UNIT / 1000); PageSize.x = m_CurrentSheetDesc->m_Size.x * (PCB_INTERNAL_UNIT / 1000);
PageSize.y = m_CurrentSheet->m_Size.y * (PCB_INTERNAL_UNIT / 1000); PageSize.y = m_CurrentSheetDesc->m_Size.y * (PCB_INTERNAL_UNIT / 1000);
break; break;
} }
......
...@@ -186,7 +186,9 @@ std::ostream& operator<<( std::ostream& out, const wxPoint& pt ) ...@@ -186,7 +186,9 @@ std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
void EDA_BaseStruct::Show( int nestLevel, std::ostream& os ) void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
{ {
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n"; wxString s = GetClass();
s = s + wxT(" ");
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">\n";
/* /*
EDA_BaseStruct* kid = m_Son; EDA_BaseStruct* kid = m_Son;
...@@ -195,9 +197,9 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os ) ...@@ -195,9 +197,9 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
kid->Show( nestLevel+1, os ); kid->Show( nestLevel+1, os );
} }
*/ */
NestedSpace( nestLevel+1, os ) << "Need ::Show() override, shown class is using EDA_BaseStruct::Show()\n"; NestedSpace( nestLevel+1, os ) << "Need ::Show() override\n";
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n";
} }
......
...@@ -122,6 +122,9 @@ void WinEDA_BasicFrame::PrintMsg(const wxString & text) ...@@ -122,6 +122,9 @@ void WinEDA_BasicFrame::PrintMsg(const wxString & text)
/******************************************************/ /******************************************************/
{ {
SetStatusText(text); SetStatusText(text);
#ifdef DEBUG
printf("%s\n", (const char*)text.mb_str() );
#endif
} }
/*************************************************************************/ /*************************************************************************/
......
...@@ -80,7 +80,7 @@ void PlotWorkSheet(int format_plot, BASE_SCREEN * screen) ...@@ -80,7 +80,7 @@ void PlotWorkSheet(int format_plot, BASE_SCREEN * screen)
*/ */
{ {
#define WSTEXTSIZE 50 // Text size in mils #define WSTEXTSIZE 50 // Text size in mils
Ki_PageDescr * Sheet = screen->m_CurrentSheet; Ki_PageDescr * Sheet = screen->m_CurrentSheetDesc;
int ii, jj, xg , yg, ipas, gxpas, gypas; int ii, jj, xg , yg, ipas, gxpas, gypas;
wxSize PageSize; wxSize PageSize;
wxPoint pos, ref; wxPoint pos, ref;
...@@ -234,11 +234,11 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION; ...@@ -234,11 +234,11 @@ int UpperLimit = VARIABLE_BLOCK_START_POSITION;
break; break;
case WS_SIZESHEET: case WS_SIZESHEET:
msg += screen->m_CurrentSheet->m_Name; msg += screen->m_CurrentSheetDesc->m_Name;
break; break;
case WS_IDENTSHEET: case WS_IDENTSHEET:
msg << screen->m_SheetNumber << wxT("/") << screen->m_NumberOfSheet; msg << screen->m_ScreenNumber << wxT("/") << screen->m_NumberOfScreen;
break; break;
case WS_COMPANY_NAME: case WS_COMPANY_NAME:
......
...@@ -40,7 +40,7 @@ void WinEDA_DrawFrame::CopyToClipboard(wxCommandEvent& event) ...@@ -40,7 +40,7 @@ void WinEDA_DrawFrame::CopyToClipboard(wxCommandEvent& event)
if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD ) if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
{ {
if (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE) if (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE)
DrawPanel->SetCursor(wxCursor(DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor) ); DrawPanel->SetCursor(wxCursor(DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor) );
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
......
...@@ -505,7 +505,7 @@ void SetRealLibraryPath( const wxString& shortlibname ) ...@@ -505,7 +505,7 @@ void SetRealLibraryPath( const wxString& shortlibname )
* Sinon g_UserLibDirBuffer = /usr/share/kicad/shortlibname/ * Sinon g_UserLibDirBuffer = /usr/share/kicad/shortlibname/
* *
* Remarque: * Remarque:
* Les \ sont remplacs par / (a la mode Unix) * Les \ sont remplac�s par / (a la mode Unix)
*/ */
{ {
bool PathFound = FALSE; bool PathFound = FALSE;
...@@ -545,7 +545,7 @@ wxString ReturnKicadDatasPath() ...@@ -545,7 +545,7 @@ wxString ReturnKicadDatasPath()
* Sinon retourne /usr/share/kicad/ * Sinon retourne /usr/share/kicad/
* *
* Remarque: * Remarque:
* Les \ sont remplacs par / (a la mode Unix) * Les \ sont remplac�s par / (a la mode Unix)
*/ */
{ {
bool PathFound = FALSE; bool PathFound = FALSE;
......
...@@ -21,7 +21,7 @@ void WinEDA_DrawFrame::TraceWorkSheet(wxDC * DC, BASE_SCREEN * screen, int line_ ...@@ -21,7 +21,7 @@ void WinEDA_DrawFrame::TraceWorkSheet(wxDC * DC, BASE_SCREEN * screen, int line_
{ {
if ( ! m_Draw_Sheet_Ref ) return; if ( ! m_Draw_Sheet_Ref ) return;
Ki_PageDescr * Sheet = screen->m_CurrentSheet; Ki_PageDescr * Sheet = screen->m_CurrentSheetDesc;
int ii, jj, xg , yg, ipas, gxpas, gypas; int ii, jj, xg , yg, ipas, gxpas, gypas;
wxPoint pos; wxPoint pos;
int refx, refy,Color; int refx, refy,Color;
...@@ -179,10 +179,8 @@ int width = line_width; ...@@ -179,10 +179,8 @@ int width = line_width;
case WS_IDENTSHEET: case WS_IDENTSHEET:
if(WsItem->m_Legende) msg = WsItem->m_Legende; if(WsItem->m_Legende) msg = WsItem->m_Legende;
msg << screen->m_SheetNumber << wxT("/") <<
screen->m_NumberOfSheet;
DrawGraphicText(DrawPanel, DC, pos, Color, DrawGraphicText(DrawPanel, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size, GetScreenDesc(), TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width);
break; break;
...@@ -273,3 +271,12 @@ int width = line_width; ...@@ -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 ...@@ -12,7 +12,7 @@ SET(EESCHEMA_SRCS
block_libedit.cpp block_libedit.cpp
busentry.cpp busentry.cpp
bus-wire-junction.cpp bus-wire-junction.cpp
class_hierarchy_sheet.cpp class_drawsheet.cpp
class_screen.cpp class_screen.cpp
class_text-label.cpp class_text-label.cpp
cleanup.cpp cleanup.cpp
......
...@@ -35,7 +35,7 @@ void EDA_SchComponentStruct::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -35,7 +35,7 @@ void EDA_SchComponentStruct::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
Affiche_1_Parametre( frame, 1, _( "Ref" ), Affiche_1_Parametre( frame, 1, _( "Ref" ),
m_Field[REFERENCE].m_Text, DARKCYAN ); GetRef(((WinEDA_SchematicFrame*)frame)->GetSheet()), DARKCYAN );
if( Entry && Entry->m_Options == ENTRY_POWER ) if( Entry && Entry->m_Options == ENTRY_POWER )
msg = _( "Pwr Symb" ); msg = _( "Pwr Symb" );
......
This diff is collapsed.
...@@ -201,7 +201,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -201,7 +201,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
* retourne : * retourne :
* 0 si aucun composant selectionne * 0 si aucun composant selectionne
* 1 sinon * 1 sinon
* -1 si commande termine et composants trouvs (block delete, block save) * -1 si commande termin�e et composants trouv�s (block delete, block save)
*/ */
{ {
int ii = 0; int ii = 0;
...@@ -232,18 +232,18 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -232,18 +232,18 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
break; break;
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
BreakSegmentOnJunction( GetScreen() ); BreakSegmentOnJunction( (SCH_SCREEN*)GetScreen() );
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
block->m_BlockDrawStruct = block->m_BlockDrawStruct =
PickStruct( GetScreen()->BlockLocate, GetScreen()->EEDrawList, SEARCHALL ); PickStruct( GetScreen()->BlockLocate, GetScreen(), SEARCHALL );
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
ii = 1; ii = 1;
CollectStructsToDrag( GetScreen() ); CollectStructsToDrag( (SCH_SCREEN*)GetScreen() );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
...@@ -260,7 +260,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -260,7 +260,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
block->m_BlockDrawStruct = block->m_BlockDrawStruct =
PickStruct( GetScreen()->BlockLocate, PickStruct( GetScreen()->BlockLocate,
GetScreen()->EEDrawList, SEARCHALL ); GetScreen(), SEARCHALL );
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE ); DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
...@@ -275,7 +275,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -275,7 +275,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE: /* Save */
block->m_BlockDrawStruct = block->m_BlockDrawStruct =
PickStruct( GetScreen()->BlockLocate, PickStruct( GetScreen()->BlockLocate,
GetScreen()->EEDrawList, SEARCHALL ); GetScreen(), SEARCHALL );
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE ); DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
...@@ -379,14 +379,14 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -379,14 +379,14 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
} }
block->m_BlockDrawStruct = NULL; block->m_BlockDrawStruct = NULL;
} }
BreakSegmentOnJunction( GetScreen() ); BreakSegmentOnJunction( (SCH_SCREEN*)GetScreen() );
block->m_BlockDrawStruct = block->m_BlockDrawStruct =
PickStruct( GetScreen()->BlockLocate, PickStruct( GetScreen()->BlockLocate,
GetScreen()->EEDrawList, SEARCHALL ); GetScreen(), SEARCHALL );
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
ii = 1; ii = 1;
CollectStructsToDrag( GetScreen() ); CollectStructsToDrag( (SCH_SCREEN*)GetScreen() );
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
block->m_State = STATE_BLOCK_MOVE; block->m_State = STATE_BLOCK_MOVE;
...@@ -685,10 +685,10 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ) ...@@ -685,10 +685,10 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
DrawText->m_Pos.x = px.x; DrawText->m_Pos.x = px.x;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
// Text is not really mirrored: Orientation is changed // Text is not really mirrored: Orientation is changed
DrawText = (DrawGlobalLabelStruct*) DrawStruct; DrawText = (DrawLabelStruct*) DrawStruct;
if( DrawText->m_Orient == 0 ) /* horizontal text */ if( DrawText->m_Orient == 0 ) /* horizontal text */
DrawText->m_Orient = 2; DrawText->m_Orient = 2;
else if( DrawText->m_Orient == 2 ) /* invert horizontal text*/ else if( DrawText->m_Orient == 2 ) /* invert horizontal text*/
...@@ -831,14 +831,14 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE ...@@ -831,14 +831,14 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
{ {
//DuplicateStruct calls GenCopy, which should handle
//m_s and m_sRefCount properly.
DrawSheetStruct* sheet = (DrawSheetStruct*) Struct; DrawSheetStruct* sheet = (DrawSheetStruct*) Struct;
sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetTimeStamp();
sheet->m_UndoList = NULL; //sheet->m_s->m_UndoList = NULL;
sheet->m_RedoList = NULL; //sheet->m_s->m_RedoList = NULL;
sheet->EEDrawList = NULL; //keep m_s pointer & associated.
sheet->m_Son = NULL; //sheet->m_Son = NULL; m_son is involved in undo and redo.
sheet->m_SheetName.Printf( wxT( "%8.8lX" ), sheet->m_TimeStamp );
sheet->m_FileName = sheet->m_SheetName + wxT( ".sch" );
break; break;
} }
...@@ -871,6 +871,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE ...@@ -871,6 +871,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
case DRAW_PICK_ITEM_STRUCT_TYPE: case DRAW_PICK_ITEM_STRUCT_TYPE:
case DRAW_MARKER_STRUCT_TYPE: case DRAW_MARKER_STRUCT_TYPE:
...@@ -882,12 +883,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE ...@@ -882,12 +883,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
{ {
DrawSheetStruct* sheet = (DrawSheetStruct*) NewDrawStruct; DrawSheetStruct* sheet = (DrawSheetStruct*) NewDrawStruct;
sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetTimeStamp();
sheet->m_UndoList = NULL;
sheet->m_RedoList = NULL;
sheet->EEDrawList = NULL;
sheet->m_Son = NULL; sheet->m_Son = NULL;
sheet->m_SheetName.Printf( wxT( "%8.8lX" ), sheet->m_TimeStamp );
sheet->m_FileName = sheet->m_SheetName + wxT( ".sch" );
break; break;
} }
...@@ -964,6 +960,11 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ...@@ -964,6 +960,11 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); RedrawOneStruct( panel, DC, DrawStruct, g_XorMode );
/* Unlink the structure */ /* Unlink the structure */
DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link
if(DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE){
SAFE_DELETE(DrawStruct);
//no undo/redo for this (for now), it is on both the EEDrawList and m_SubSheet arrays,
//hence the undo logic would have to be extended for this.
}else
frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); frame->SaveCopyInUndoList( DrawStruct, IS_DELETED );
} }
} }
...@@ -1117,6 +1118,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct ) ...@@ -1117,6 +1118,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct )
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
...@@ -1219,9 +1221,10 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector ) ...@@ -1219,9 +1221,10 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector )
DrawLabel->m_Pos += move_vector; DrawLabel->m_Pos += move_vector;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
#define DrawGlobalLabel ( (DrawGlobalLabelStruct*) DrawStruct ) #define DrawGHLabel ( (DrawLabelStruct*) DrawStruct )
DrawGlobalLabel->m_Pos += move_vector; DrawGHLabel->m_Pos += move_vector;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
...@@ -1310,6 +1313,10 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct ) ...@@ -1310,6 +1313,10 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
NewDrawStruct = ( (DrawLabelStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (DrawLabelStruct*) DrawStruct )->GenCopy();
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
NewDrawStruct = ( (DrawHierLabelStruct*) DrawStruct )->GenCopy();
break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
NewDrawStruct = ( (DrawGlobalLabelStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (DrawGlobalLabelStruct*) DrawStruct )->GenCopy();
break; break;
...@@ -1577,9 +1584,10 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1577,9 +1584,10 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
Struct->m_Flags |= SELECTED; Struct->m_Flags |= SELECTED;
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) Struct ) #define STRUCT ( (DrawLabelStruct*) Struct )
if( Struct->m_Flags & SELECTED ) if( Struct->m_Flags & SELECTED )
break; /* Already in list */ break; /* Already in list */
if( STRUCT->m_Pos != position ) if( STRUCT->m_Pos != position )
......
...@@ -140,8 +140,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -140,8 +140,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
if( !newsegment ) /* first point : Create first wire ou bus */ if( !newsegment ) /* first point : Create first wire ou bus */
{ {
s_ConnexionStartPoint = cursorpos; s_ConnexionStartPoint = cursorpos;
s_OldWiresList = GetScreen()->ExtractWires( TRUE ); s_OldWiresList = ((SCH_SCREEN*)GetScreen())->ExtractWires( TRUE );
GetScreen()->SchematicCleanUp( NULL ); ((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL );
switch( type ) switch( type )
{ {
...@@ -191,8 +191,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -191,8 +191,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
/* Creation du segment suivant ou fin de trac si point sur pin, jonction ...*/ /* Creation du segment suivant ou fin de trac si point sur pin, jonction ...*/
if( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->m_Layer ) ) if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->m_Layer ) )
{ {
EndSegment( DC ); return; EndSegment( DC ); return;
} }
...@@ -299,7 +299,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) ...@@ -299,7 +299,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
alt_end_point = lastsegment->m_Start; alt_end_point = lastsegment->m_Start;
} }
GetScreen()->SchematicCleanUp( NULL ); ((SCH_SCREEN*)GetScreen())->SchematicCleanUp( NULL );
/* clear flags and find last segment entered, for repeat function */ /* clear flags and find last segment entered, for repeat function */
segment = (EDA_DrawLineStruct*) GetScreen()->EEDrawList; segment = (EDA_DrawLineStruct*) GetScreen()->EEDrawList;
...@@ -519,7 +519,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC ) ...@@ -519,7 +519,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
Segment_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */ Segment_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */
} }
EraseStruct( GetScreen()->GetCurItem(), GetScreen() ); EraseStruct( GetScreen()->GetCurItem(), (SCH_SCREEN*)GetScreen() );
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
} }
...@@ -662,6 +662,16 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) ...@@ -662,6 +662,16 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (DrawHierLabelStruct*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
/*** Increment du numero de label ***/
IncrementLabelMember( STRUCT->m_Text );
break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) g_ItemToRepeat ) #define STRUCT ( (DrawGlobalLabelStruct*) g_ItemToRepeat )
...@@ -695,9 +705,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) ...@@ -695,9 +705,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
// Create the duplicate component, position = mouse cursor // Create the duplicate component, position = mouse cursor
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
new_pos.x = m_CurrentScreen->m_Curseur.x - STRUCT->m_Pos.x; new_pos.x = GetScreen()->m_Curseur.x - STRUCT->m_Pos.x;
new_pos.y = m_CurrentScreen->m_Curseur.y - STRUCT->m_Pos.y; new_pos.y = GetScreen()->m_Curseur.y - STRUCT->m_Pos.y;
STRUCT->m_Pos = m_CurrentScreen->m_Curseur; STRUCT->m_Pos = GetScreen()->m_Curseur;
STRUCT->m_Flags = IS_NEW; STRUCT->m_Flags = IS_NEW;
STRUCT->m_TimeStamp = GetTimeStamp(); STRUCT->m_TimeStamp = GetTimeStamp();
for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
...@@ -770,10 +780,10 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -770,10 +780,10 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
* - type WIRE, si il y a * - type WIRE, si il y a
* - une jonction * - une jonction
* - ou une pin * - ou une pin
* - ou une extrmit unique de fil * - ou une extr�mit� unique de fil
* *
* - type BUS, si il y a * - type BUS, si il y a
* - ou une extrmit unique de BUS * - ou une extr�mit� unique de BUS
*/ */
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;
...@@ -785,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -785,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
switch( layer ) switch( layer )
{ {
case LAYER_BUS: case LAYER_BUS:
item = PickStruct( pos, screen->EEDrawList, BUSITEM ); item = PickStruct( pos, screen, BUSITEM );
if( item ) if( item )
return TRUE; return TRUE;
pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList ); pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList );
...@@ -798,13 +808,13 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -798,13 +808,13 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
break; break;
case LAYER_NOTES: case LAYER_NOTES:
item = PickStruct( pos, screen->EEDrawList, DRAWITEM ); item = PickStruct( pos, screen, DRAWITEM );
if( item ) if( item )
return TRUE; return TRUE;
break; break;
case LAYER_WIRE: case LAYER_WIRE:
item = PickStruct( pos, screen->EEDrawList, RACCORDITEM | JUNCTIONITEM ); item = PickStruct( pos, screen, RACCORDITEM | JUNCTIONITEM );
if( item ) if( item )
return TRUE; return TRUE;
...@@ -820,17 +830,17 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -820,17 +830,17 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
return TRUE; return TRUE;
} }
item = PickStruct( pos, screen->EEDrawList, WIREITEM ); item = PickStruct( pos, screen, WIREITEM );
if( item ) if( item )
return TRUE; return TRUE;
item = PickStruct( pos, screen->EEDrawList, LABELITEM ); item = PickStruct( pos, screen, LABELITEM );
if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE) if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE)
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x ) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x )
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) ) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) )
return TRUE; return TRUE;
pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList ); pinsheet = LocateAnyPinSheet( pos, screen );
if( pinsheet && !IsBusLabel( pinsheet->m_Text ) ) if( pinsheet && !IsBusLabel( pinsheet->m_Text ) )
{ {
itempos = pinsheet->m_Pos; itempos = pinsheet->m_Pos;
...@@ -861,14 +871,14 @@ bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos ) ...@@ -861,14 +871,14 @@ bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos )
* - a pin is on location pos * - a pin is on location pos
*/ */
{ {
if( PickStruct( pos, frame->GetScreen()->EEDrawList, JUNCTIONITEM ) ) if( PickStruct( pos, frame->GetScreen(), JUNCTIONITEM ) )
return FALSE; return FALSE;
if( PickStruct( pos, frame->GetScreen()->EEDrawList, WIREITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) ) if( PickStruct( pos, frame->GetScreen(), WIREITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) )
{ {
if( PickStruct( pos, frame->GetScreen()->EEDrawList, WIREITEM | WIRE_BUS_ENDPOINTS_ONLY ) ) if( PickStruct( pos, frame->GetScreen(), WIREITEM | WIRE_BUS_ENDPOINTS_ONLY ) )
return TRUE; return TRUE;
if( frame->LocatePinEnd( frame->GetScreen()->EEDrawList, pos ) ) if( frame->LocatePinEnd( frame->GetScreen(), pos ) )
return TRUE; return TRUE;
} }
......
This diff is collapsed.
...@@ -83,11 +83,16 @@ extern int* TemplateShape[5][4]; ...@@ -83,11 +83,16 @@ extern int* TemplateShape[5][4];
/* Forward declarations */ /* Forward declarations */
class DrawSheetStruct; class DrawSheetStruct;
extern DrawSheetStruct* g_RootSheet;
class SCH_SCREEN : public BASE_SCREEN class SCH_SCREEN : public BASE_SCREEN
{ {
public: public:
int m_RefCount; //how many sheets reference this screen?
//delete when it goes to zero.
int m_ScreenNumber;
int m_NumberOfScreen;
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE ); SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
~SCH_SCREEN(); ~SCH_SCREEN();
...@@ -100,6 +105,8 @@ public: ...@@ -100,6 +105,8 @@ public:
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */ void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */
bool CheckIfOnDrawList( EDA_BaseStruct* st );
void AddToDrawList( EDA_BaseStruct* DrawStruct );
void ClearUndoORRedoList( EDA_BaseStruct* List ); void ClearUndoORRedoList( EDA_BaseStruct* List );
bool SchematicCleanUp( wxDC* DC = NULL ); bool SchematicCleanUp( wxDC* DC = NULL );
...@@ -117,7 +124,7 @@ class DrawSheetLabelStruct : public EDA_BaseStruct, public EDA_TextStruct ...@@ -117,7 +124,7 @@ class DrawSheetLabelStruct : public EDA_BaseStruct, public EDA_TextStruct
public: public:
int m_Layer; int m_Layer;
int m_Edge, m_Shape; int m_Edge, m_Shape;
bool m_IsDangling; // TRUE si non connect bool m_IsDangling; // TRUE si non connect
public: public:
DrawSheetLabelStruct( DrawSheetStruct* parent, DrawSheetLabelStruct( DrawSheetStruct* parent,
...@@ -140,20 +147,25 @@ public: ...@@ -140,20 +147,25 @@ public:
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
WX_DEFINE_ARRAY( DrawSheetStruct*, SheetGrowArray );
class DrawSheetStruct : public SCH_SCREEN /* Gestion de la hierarchie */ class DrawSheetStruct : public EDA_BaseStruct /*public SCH_SCREEN*/ /* Gestion de la hierarchie */
{ {
public: public:
wxString m_SheetName; wxString m_SheetName; //this is equivalent to C101 for components:
// it is stored in F0 ... of the file.
wxString m_FileName; //also in SCH_SCREEN (redundant),
//but need it here for loading after
//reading the sheet description from file.
int m_SheetNameSize; int m_SheetNameSize;
// wxString m_FileName; in SCH_SCREEN
int m_FileNameSize; int m_FileNameSize;
wxPoint m_Pos; wxPoint m_Pos;
wxSize m_Size; /* Position and Size of sheet symbol */ wxSize m_Size; /* Position and Size of sheet symbol */
int m_Layer; int m_Layer;
DrawSheetLabelStruct* m_Label; /* Points de connection */ DrawSheetLabelStruct* m_Label; /* Points de connection, linked list.*/
int m_NbLabel; /* Nombre de points de connexion */ int m_NbLabel; /* Nombre de points de connexion */
SCH_SCREEN* m_s;
public: public:
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
...@@ -170,29 +182,94 @@ public: ...@@ -170,29 +182,94 @@ public:
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
void SwapData( DrawSheetStruct* copyitem ); void SwapData( DrawSheetStruct* copyitem );
void DeleteAnnotation( bool recurse );
int ComponentCount();
bool Load(WinEDA_SchematicFrame* frame);
bool SearchHierarchy(wxString filename, SCH_SCREEN **screen);
bool LocatePathOfScreen(SCH_SCREEN *screen, DrawSheetList* list);
int CountSheets();
//void RemoveSheet(DrawSheetStruct* sheet);
//to remove a sheet, just delete it
//-- the destructor should take care of everything else.
}; };
#define DSLSZ 32
class DrawSheetList
{
public:
int m_numSheets;
DrawSheetStruct* m_sheets[DSLSZ];
DrawSheetList();
~DrawSheetList(){};
void Clear(){m_numSheets = 0; }
int Cmp(DrawSheetList& d);
DrawSheetStruct* Last();
SCH_SCREEN* LastScreen();
EDA_BaseStruct* LastDrawList();
void Push(DrawSheetStruct* sheet);
DrawSheetStruct* Pop();
wxString Path();
wxString PathHumanReadable();
void UpdateAllScreenReferences();
bool operator= (const DrawSheetList& d1);
bool operator==(const DrawSheetList &d1);
bool operator!=(const DrawSheetList &d1);
};
/* Class to handle the list of *Sheets* in a hierarchy */
// sheets are not unique - can have many sheets with the same
// filename and the same SCH_SHEET reference.
class EDA_SheetList
{
private:
DrawSheetList* m_List;
int m_count;
int m_index;
DrawSheetList m_currList;
public:
EDA_SheetList( DrawSheetStruct* sheet ){
m_index = 0;
m_count = 0;
m_List = NULL;
if(sheet == NULL)
sheet = g_RootSheet;
BuildSheetList( sheet );
}
~EDA_SheetList() {if(m_List){free(m_List);} m_List = NULL;}
int GetCount() { return m_count; }
DrawSheetList* GetFirst();
DrawSheetList* GetNext();
DrawSheetList* GetSheet(int index );
private:
void BuildSheetList( DrawSheetStruct* sheet );
};
/* Class to handle the list of screens in a hierarchy */ /* Class to handle the list of *screens* in a hierarchy */
// screens are unique, and correspond to .sch files.
WX_DEFINE_ARRAY( SCH_SCREEN*, ScreenGrowArray );
class EDA_ScreenList class EDA_ScreenList
{ {
private: private:
int m_Count; ScreenGrowArray m_List;
SCH_SCREEN** m_List; unsigned int m_Index;
int m_Index;
public: public:
EDA_ScreenList( EDA_BaseStruct* DrawStruct ); EDA_ScreenList(){
~EDA_ScreenList(); m_Index = 0;
int GetCount() { return m_Count; } BuildScreenList(g_RootSheet);
}
~EDA_ScreenList() {}
int GetCount() { return m_List.GetCount(); }
SCH_SCREEN* GetFirst(); SCH_SCREEN* GetFirst();
SCH_SCREEN* GetNext(); SCH_SCREEN* GetNext();
SCH_SCREEN* GetScreen( int index ); SCH_SCREEN* GetScreen( unsigned int index );
void UpdateSheetNumberAndDate(); void UpdateScreenNumberAndDate();
private: private:
SCH_SCREEN** BuildScreenList( SCH_SCREEN** ScreenList, void AddScreenToList( SCH_SCREEN* testscreen );
EDA_BaseStruct* DrawStruct, int* Count ); void BuildScreenList( EDA_BaseStruct* sheet );
}; };
#endif /* CLASS_SCREEN_H */ #endif /* CLASS_SCREEN_H */
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
/* class DrawTextStruct */ /* class DrawTextStruct */
/* class DrawLabelStruct */ /* class DrawLabelStruct */
/* class DrawGlobalLabelStruct */ /* class DrawGlobalLabelStruct */
/* class DrawHierLabelStruct */
/************************/ /************************/
/**************************************************************************/ /**************************************************************************/
...@@ -47,7 +48,11 @@ DrawTextStruct* DrawTextStruct::GenCopy() ...@@ -47,7 +48,11 @@ DrawTextStruct* DrawTextStruct::GenCopy()
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
newitem = new DrawGlobalLabelStruct( m_Pos, m_Text ); newitem = new DrawGlobalLabelStruct(m_Pos, m_Text );
break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
newitem = new DrawHierLabelStruct(m_Pos, m_Text );
break; break;
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
...@@ -102,8 +107,7 @@ void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -102,8 +107,7 @@ void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/* restore new values */ /* restore new values */
SwapData( (DrawTextStruct*) g_ItemToUndoCopy ); SwapData( (DrawTextStruct*) g_ItemToUndoCopy );
delete g_ItemToUndoCopy; SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = NULL;
} }
EDA_BaseStruct::Place( frame, DC ); EDA_BaseStruct::Place( frame, DC );
...@@ -121,15 +125,24 @@ DrawLabelStruct::DrawLabelStruct( const wxPoint& pos, const wxString& text ) : ...@@ -121,15 +125,24 @@ DrawLabelStruct::DrawLabelStruct( const wxPoint& pos, const wxString& text ) :
/***********************************************************************************/ /***********************************************************************************/
DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString& text ) : DrawGlobalLabelStruct::DrawGlobalLabelStruct(const wxPoint& pos, const wxString& text) :
DrawTextStruct( pos, text, DRAW_GLOBAL_LABEL_STRUCT_TYPE ) DrawTextStruct( pos, text, DRAW_GLOBAL_LABEL_STRUCT_TYPE )
/***********************************************************************************/ /***********************************************************************************/
{ {
m_Layer = LAYER_GLOBLABEL; m_Layer = LAYER_GLOBLABEL;
m_Shape = NET_INPUT; m_Shape = NET_BIDI;
m_IsDangling = TRUE; m_IsDangling = TRUE;
} }
/***********************************************************************************/
DrawHierLabelStruct::DrawHierLabelStruct(const wxPoint& pos, const wxString& text) :
DrawTextStruct( pos, text, DRAW_HIER_LABEL_STRUCT_TYPE )
/***********************************************************************************/
{
m_Layer = LAYER_HIERLABEL;
m_Shape = NET_INPUT;
m_IsDangling = TRUE;
}
/*******************************************************************************************/ /*******************************************************************************************/
void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
...@@ -201,10 +214,9 @@ void DrawLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of ...@@ -201,10 +214,9 @@ void DrawLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of
/*******************************************************************************************/ /*******************************************************************************************/
void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawHierLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/******************************************************************************************/ /******************************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon /* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/ */
{ {
...@@ -254,6 +266,76 @@ void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoi ...@@ -254,6 +266,76 @@ void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoi
break; break;
} }
Template = TemplateShape[m_Shape][m_Orient];
imax = *Template; Template++;
for( ii = 0, jj = 0; ii < imax; ii++ )
{
Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.x + offset.x;
jj++; Template++;
Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.y + offset.y;
jj++; Template++;
}
GRPoly( &panel->m_ClipBox, DC, imax, Poly, 0, width, color, color );
if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
}
/*******************************************************************************************/
void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
/******************************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/
//should reimplement this with a custom global shape??
//it is the same as Hierarchal sheet.
{
int* Template;
int Poly[20];
int ii, jj, imax, color, HalfSize;
wxSize Size = m_Size;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 )
color = Color;
else
color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
HalfSize = Size.x / 2; ii = Size.x + TXTMARGE;
switch( m_Orient )
{
case 0: /* Orientation horiz normale */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x - ii + offset.x, m_Pos.y + offset.y ), color,
m_Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width );
break;
case 1: /* Orientation vert UP */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + offset.x, m_Pos.y + ii + offset.y ), color,
m_Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width );
break;
case 2: /* Orientation horiz inverse */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + ii + offset.x, m_Pos.y + offset.y ), color,
m_Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width );
break;
case 3: /* Orientation vert BOTTOM */
DrawGraphicText( panel, DC,
wxPoint( m_Pos.x + offset.x, m_Pos.y - ii + offset.y ), color,
m_Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width );
break;
}
Template = TemplateShape[m_Shape][m_Orient]; Template = TemplateShape[m_Shape][m_Orient];
......
...@@ -106,6 +106,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen ) ...@@ -106,6 +106,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
case DRAW_PICK_ITEM_STRUCT_TYPE: case DRAW_PICK_ITEM_STRUCT_TYPE:
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
#include "macros.h" #include "macros.h"
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(ArrayOfSheetLists);
/***************************/ /***************************/
/* class DrawPartStruct */ /* class DrawPartStruct */
/* class EDA_SchComponentStruct */ /* class EDA_SchComponentStruct */
...@@ -88,6 +89,71 @@ const wxString& EDA_SchComponentStruct::ReturnFieldName( int aFieldNdx ) const ...@@ -88,6 +89,71 @@ const wxString& EDA_SchComponentStruct::ReturnFieldName( int aFieldNdx ) const
return m_Field[aFieldNdx].m_Name; return m_Field[aFieldNdx].m_Name;
} }
/************************************/
wxString EDA_SchComponentStruct::GetPath(DrawSheetList* sheet)
/************************************/
{
wxString str;
str.Printf(_("%8.8lX"), m_TimeStamp );
return sheet->Path() + str;
}
/************************************/
const wxString EDA_SchComponentStruct::GetRef( DrawSheetList* sheet )
/************************************/
{
wxString path = GetPath( sheet );
unsigned int i;
for(i=0; i<m_Paths.GetCount(); i++){
if( m_Paths[i].Cmp(path) == 0 ){
/*printf("GetRef path: %s ref: %s\n",
CONV_TO_UTF8(m_Paths[i]),
CONV_TO_UTF8(m_References[i])); */
return m_References[i];
}
}
return m_PrefixString;
}
/************************************/
void EDA_SchComponentStruct::SetRef( DrawSheetList* sheet, wxString ref )
/************************************/
{
//check to see if it is already there before inserting it
wxString path = GetPath( sheet );
printf("SetRef path: %s ref: %s\n",
CONV_TO_UTF8(path),
CONV_TO_UTF8(ref));
unsigned int i;
bool notInArray = true;
for(i=0; i<m_Paths.GetCount(); i++){
if(m_Paths[i].Cmp(path) == 0){
//just update the reference text, not the timestamp.
m_References.RemoveAt(i);
m_References.Insert(ref, i);
notInArray = false;
}
}
if(notInArray){
m_References.Add(ref);
m_Paths.Add(path);
}
if(m_Field[REFERENCE].m_Text.IsEmpty() ||
( abs(m_Field[REFERENCE].m_Pos.x - m_Pos.x) +
abs(m_Field[REFERENCE].m_Pos.y - m_Pos.y) > 1000)) {
//move it to a reasonable position..
m_Field[REFERENCE].m_Pos = m_Pos;
}
m_Field[REFERENCE].m_Text = ref; //for drawing.
}
/************************************/
void EDA_SchComponentStruct::ClearRefs()
/************************************/
{
m_Paths.Empty();
m_References.Empty();
}
const wxString& EDA_SchComponentStruct::GetFieldValue( int aFieldNdx ) const const wxString& EDA_SchComponentStruct::GetFieldValue( int aFieldNdx ) const
{ {
...@@ -109,8 +175,8 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) : ...@@ -109,8 +175,8 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) :
int ii; int ii;
m_Multi = 0; /* In multi unit chip - which unit to draw. */ m_Multi = 0; /* In multi unit chip - which unit to draw. */
m_RefIdNumber = 0; //m_FlagControlMulti = 0;
m_FlagControlMulti = 0; m_UsedOnSheets.Clear();
m_Convert = 0; /* Gestion des mutiples representations (conversion De Morgan) */ m_Convert = 0; /* Gestion des mutiples representations (conversion De Morgan) */
/* The rotation/mirror transformation matrix. pos normal*/ /* The rotation/mirror transformation matrix. pos normal*/
...@@ -132,6 +198,8 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) : ...@@ -132,6 +198,8 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) :
m_Field[REFERENCE].m_Layer = LAYER_REFERENCEPART; m_Field[REFERENCE].m_Layer = LAYER_REFERENCEPART;
m_PinIsDangling = NULL; m_PinIsDangling = NULL;
m_PrefixString = wxString(_("U"));
} }
...@@ -183,8 +251,6 @@ EDA_Rect EDA_SchComponentStruct::GetBoundaryBox() ...@@ -183,8 +251,6 @@ EDA_Rect EDA_SchComponentStruct::GetBoundaryBox()
BoundaryBox.Offset( m_Pos ); BoundaryBox.Offset( m_Pos );
return BoundaryBox; return BoundaryBox;
} }
/**************************************************************************/ /**************************************************************************/
void PartTextStruct::SwapData( PartTextStruct* copyitem ) void PartTextStruct::SwapData( PartTextStruct* copyitem )
/**************************************************************************/ /**************************************************************************/
...@@ -250,8 +316,7 @@ void EDA_SchComponentStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -250,8 +316,7 @@ void EDA_SchComponentStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/* restore new values */ /* restore new values */
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy ); SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy );
delete g_ItemToUndoCopy; SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = NULL;
} }
EDA_BaseStruct::Place( frame, DC ); EDA_BaseStruct::Place( frame, DC );
...@@ -265,13 +330,13 @@ void EDA_SchComponentStruct::ClearAnnotation() ...@@ -265,13 +330,13 @@ void EDA_SchComponentStruct::ClearAnnotation()
/* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1) /* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
*/ */
{ {
m_RefIdNumber = 0; wxString defRef = m_PrefixString;
defRef.Append( _("?") );
while( isdigit( m_Field[REFERENCE].m_Text.Last() ) ) m_References.Empty();
m_Field[REFERENCE].m_Text.RemoveLast(); unsigned int i;
for(i=0; i< m_Paths.GetCount(); i++){
if( m_Field[REFERENCE].m_Text.Last() != '?' ) m_References.Add(defRef);
m_Field[REFERENCE].m_Text.Append( '?' ); }
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
...@@ -291,7 +356,8 @@ EDA_SchComponentStruct* EDA_SchComponentStruct::GenCopy() ...@@ -291,7 +356,8 @@ EDA_SchComponentStruct* EDA_SchComponentStruct::GenCopy()
new_item->m_Multi = m_Multi; new_item->m_Multi = m_Multi;
new_item->m_ChipName = m_ChipName; new_item->m_ChipName = m_ChipName;
new_item->m_FlagControlMulti = m_FlagControlMulti; //new_item->m_FlagControlMulti = m_FlagControlMulti;
new_item->m_UsedOnSheets = m_UsedOnSheets;
new_item->m_Convert = m_Convert; new_item->m_Convert = m_Convert;
new_item->m_Transform[0][0] = m_Transform[0][0]; new_item->m_Transform[0][0] = m_Transform[0][0];
new_item->m_Transform[0][1] = m_Transform[0][1]; new_item->m_Transform[0][1] = m_Transform[0][1];
...@@ -522,9 +588,9 @@ int EDA_SchComponentStruct::GetRotationMiroir() ...@@ -522,9 +588,9 @@ int EDA_SchComponentStruct::GetRotationMiroir()
wxPoint EDA_SchComponentStruct::GetScreenCoord( const wxPoint& coord ) wxPoint EDA_SchComponentStruct::GetScreenCoord( const wxPoint& coord )
/***********************************************************************/ /***********************************************************************/
/* Renvoie la coordonne du point coord, en fonction de l'orientation /* Renvoie la coordonne du point coord, en fonction de l'orientation
* du composant (rotation, miroir). * du composant (rotation, miroir).
* Les coord sont toujours relatives l'ancre (coord 0,0) du composant * Les coord sont toujours relatives l'ancre (coord 0,0) du composant
*/ */
{ {
wxPoint screenpos; wxPoint screenpos;
...@@ -548,7 +614,7 @@ void EDA_SchComponentStruct::Show( int nestLevel, std::ostream& os ) ...@@ -548,7 +614,7 @@ void EDA_SchComponentStruct::Show( int nestLevel, std::ostream& os )
{ {
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" ref=\"" << GetReference().mb_str() << '"' << " ref=\"" << ReturnFieldName(0) << '"' <<
" chipName=\"" << m_ChipName.mb_str() << '"' << " chipName=\"" << m_ChipName.mb_str() << '"' <<
m_Pos << m_Pos <<
" layer=\"" << m_Layer << '"' << " layer=\"" << m_Layer << '"' <<
......
...@@ -11,10 +11,11 @@ ...@@ -11,10 +11,11 @@
#include "macros.h" #include "macros.h"
#include "base_struct.h" #include "base_struct.h"
#include <wx/arrstr.h>
#include "class_screen.h"
#include <wx/dynarray.h>
/* Definition de la representation du composant */ /* Definition de la representation du composant */
#define NUMBER_OF_FIELDS 12 /* Nombre de champs de texte affectes au composant */
enum NumFieldType { enum NumFieldType {
REFERENCE = 0, /* Champ Reference of part, i.e. "IC21" */ REFERENCE = 0, /* Champ Reference of part, i.e. "IC21" */
VALUE, /* Champ Value of part, i.e. "3.3K" */ VALUE, /* Champ Value of part, i.e. "3.3K" */
...@@ -27,7 +28,8 @@ enum NumFieldType { ...@@ -27,7 +28,8 @@ enum NumFieldType {
FIELD5, FIELD5,
FIELD6, FIELD6,
FIELD7, FIELD7,
FIELD8 FIELD8,
NUMBER_OF_FIELDS /* Nombre de champs de texte affectes au composant */
}; };
...@@ -64,7 +66,7 @@ public: ...@@ -64,7 +66,7 @@ public:
/* the class DrawPartStruct describes a basic virtual component /* the class DrawPartStruct describes a basic virtual component
* Not used directly: * Not used directly:
* used classes are EDA_SchComponentStruct (the "classic" schematic component * used classes are EDA_SchComponentStruct (the "classic" schematic component, below)
* and the Pseudo component DrawSheetStruct * and the Pseudo component DrawSheetStruct
*/ */
class DrawPartStruct : public EDA_BaseStruct class DrawPartStruct : public EDA_BaseStruct
...@@ -83,27 +85,26 @@ public: ...@@ -83,27 +85,26 @@ public:
{ {
return wxT( "DrawPart" ); return wxT( "DrawPart" );
} }
/**
* Function GetReference
* returns a reference to the Reference
*/
const wxString& GetReference() { return m_Field[REFERENCE].m_Text; }
}; };
WX_DECLARE_OBJARRAY(DrawSheetList, ArrayOfSheetLists);
/* the class EDA_SchComponentStruct describes a real component */ /* the class EDA_SchComponentStruct describes a real component */
class EDA_SchComponentStruct : public DrawPartStruct class EDA_SchComponentStruct : public DrawPartStruct
{ {
public: public:
int m_RefIdNumber; /* reference count: for U1, R2 .. it is the 1 or 2 value */
int m_Multi; /* In multi unit chip - which unit to draw. */ int m_Multi; /* In multi unit chip - which unit to draw. */
int m_FlagControlMulti; //int m_FlagControlMulti;
int m_Convert; /* Gestion des mutiples representations (ex: conversion De Morgan) */ ArrayOfSheetLists m_UsedOnSheets;
int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */ int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
bool* m_PinIsDangling; // liste des indicateurs de pin non connectee bool* m_PinIsDangling; // liste des indicateurs de pin non connectee
wxArrayString m_Paths; // /sheet1/C102, /sh2/sh1/U32 etc.
wxArrayString m_References; // C102, U32 etc.
wxString m_PrefixString; //C, R, U, Q etc - the first character which typically indicates what the component is.
//determined, upon placement, from the library component.
//determined, upon file load, by the first non-digits in the reference fields.
public: public:
EDA_SchComponentStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); EDA_SchComponentStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
~EDA_SchComponentStruct( void ) { } ~EDA_SchComponentStruct( void ) { }
...@@ -143,6 +144,12 @@ public: ...@@ -143,6 +144,12 @@ public:
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
//returns a unique ID, in the form of a path.
wxString GetPath( DrawSheetList* sheet);
const wxString GetRef( DrawSheetList* sheet );
void SetRef( DrawSheetList* sheet, wxString ref );
void ClearRefs();
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
......
...@@ -60,7 +60,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin ) ...@@ -60,7 +60,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, GetScreen()->m_Curseur, &LibItem ); Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, &LibItem );
if( Pin ) if( Pin )
break; // Priority is probing a pin first break; // Priority is probing a pin first
LibItem = (EDA_SchComponentStruct*) DrawStruct; LibItem = (EDA_SchComponentStruct*) DrawStruct;
...@@ -68,7 +68,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin ) ...@@ -68,7 +68,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
break; break;
default: default:
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, GetScreen()->m_Curseur, &LibItem ); Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, &LibItem );
break; break;
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
...@@ -82,7 +82,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin ) ...@@ -82,7 +82,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
Pin->Display_Infos( this ); Pin->Display_Infos( this );
if( LibItem ) if( LibItem )
Affiche_1_Parametre( this, 1, Affiche_1_Parametre( this, 1,
LibItem->m_Field[REFERENCE].m_Text, LibItem->GetRef(GetSheet()),
LibItem->m_Field[VALUE].m_Text, LibItem->m_Field[VALUE].m_Text,
CYAN ); CYAN );
...@@ -121,7 +121,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -121,7 +121,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
wxString msg; wxString msg;
int ii; int ii;
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, MARKERITEM ); DrawStruct = PickStruct( refpoint, GetScreen(), MARKERITEM );
if( DrawStruct ) if( DrawStruct )
{ {
DrawMarkerStruct* Marker = (DrawMarkerStruct*) DrawStruct; DrawMarkerStruct* Marker = (DrawMarkerStruct*) DrawStruct;
...@@ -134,7 +134,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -134,7 +134,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, DrawStruct = PickStruct( refpoint, GetScreen(),
NOCONNECTITEM ); NOCONNECTITEM );
if( DrawStruct ) if( DrawStruct )
{ {
...@@ -142,7 +142,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -142,7 +142,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, DrawStruct = PickStruct( refpoint, GetScreen(),
JUNCTIONITEM ); JUNCTIONITEM );
if( DrawStruct ) if( DrawStruct )
{ {
...@@ -150,17 +150,17 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -150,17 +150,17 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, DrawStruct = PickStruct( refpoint, GetScreen(),
WIREITEM | BUSITEM | RACCORDITEM ); WIREITEM | BUSITEM | RACCORDITEM );
if( DrawStruct ) // Search for a pin if( DrawStruct ) // Search for a pin
{ {
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, refpoint, &LibItem ); Pin = LocateAnyPin( m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
if( Pin ) if( Pin )
{ {
Pin->Display_Infos( this ); Pin->Display_Infos( this );
if( LibItem ) if( LibItem )
Affiche_1_Parametre( this, 1, Affiche_1_Parametre( this, 1,
LibItem->m_Field[REFERENCE].m_Text, LibItem->GetRef(GetSheet()),
LibItem->m_Field[VALUE].m_Text, LibItem->m_Field[VALUE].m_Text,
CYAN ); CYAN );
} }
...@@ -169,7 +169,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -169,7 +169,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, FIELDCMPITEM ); DrawStruct = PickStruct( refpoint, GetScreen(), FIELDCMPITEM );
if( DrawStruct ) if( DrawStruct )
{ {
PartTextStruct* Field = (PartTextStruct*) DrawStruct; PartTextStruct* Field = (PartTextStruct*) DrawStruct;
...@@ -180,29 +180,29 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -180,29 +180,29 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
} }
/* search for a pin */ /* search for a pin */
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, refpoint, &LibItem ); Pin = LocateAnyPin( m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
if( Pin ) if( Pin )
{ {
Pin->Display_Infos( this ); Pin->Display_Infos( this );
if( LibItem ) if( LibItem )
Affiche_1_Parametre( this, 1, Affiche_1_Parametre( this, 1,
LibItem->m_Field[REFERENCE].m_Text, LibItem->GetRef(GetSheet()),
LibItem->m_Field[VALUE].m_Text, LibItem->m_Field[VALUE].m_Text,
CYAN ); CYAN );
if( IncludePin == TRUE ) if( IncludePin == TRUE )
return LibItem; return LibItem;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, LIBITEM ); DrawStruct = PickStruct( refpoint, GetScreen(), LIBITEM );
if( DrawStruct ) if( DrawStruct )
{ {
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
LibItem = (EDA_SchComponentStruct*) DrawStruct; LibItem = (EDA_SchComponentStruct*) DrawStruct;
LibItem->Display_Infos( this ); LibItem->Display_Infos( this );
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, DrawStruct = PickStruct( refpoint, GetScreen(),
SHEETITEM ); SHEETITEM );
if( DrawStruct ) if( DrawStruct )
{ {
...@@ -211,7 +211,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -211,7 +211,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
} }
// Recherche des autres elements // Recherche des autres elements
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, DrawStruct = PickStruct( refpoint, GetScreen(),
SEARCHALL ); SEARCHALL );
if( DrawStruct ) if( DrawStruct )
{ {
...@@ -228,17 +228,16 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -228,17 +228,16 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
/***********************************************************************/ /***********************************************************************/
{ {
wxSize delta; wxSize delta;
int zoom = m_CurrentScreen->GetZoom(); SCH_SCREEN* screen = (SCH_SCREEN*)GetScreen();
int zoom = screen->GetZoom();
wxPoint curpos, oldpos; wxPoint curpos, oldpos;
int hotkey = 0; int hotkey = 0;
ActiveScreen = (SCH_SCREEN*) m_CurrentScreen; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur;
curpos = m_CurrentScreen->m_MousePosition; delta.x = screen->GetGrid().x / zoom;
oldpos = m_CurrentScreen->m_Curseur; delta.y = screen->GetGrid().y / zoom;
delta.x = m_CurrentScreen->GetGrid().x / zoom;
delta.y = m_CurrentScreen->GetGrid().y / zoom;
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -252,37 +251,37 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -252,37 +251,37 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
case EDA_PANNING_UP_KEY: case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP ); OnZoom( ID_ZOOM_PANNING_UP );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_PANNING_DOWN_KEY: case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN ); OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_PANNING_LEFT_KEY: case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT ); OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_PANNING_RIGHT_KEY: case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT ); OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_ZOOM_IN_FROM_MOUSE: case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_PLUS_KEY ); OnZoom( ID_ZOOM_PLUS_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_ZOOM_OUT_FROM_MOUSE: case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_MOINS_KEY ); OnZoom( ID_ZOOM_MOINS_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case EDA_ZOOM_CENTER_FROM_MOUSE: case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY ); OnZoom( ID_ZOOM_CENTER_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
break; break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
...@@ -315,22 +314,22 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -315,22 +314,22 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
} }
/* Recalcul de la position du curseur schema */ /* Recalcul de la position du curseur schema */
m_CurrentScreen->m_Curseur = curpos; screen->m_Curseur = curpos;
/* Placement sur la grille generale */ /* Placement sur la grille generale */
PutOnGrid( &m_CurrentScreen->m_Curseur ); PutOnGrid( &(screen->m_Curseur) );
if( m_CurrentScreen->IsRefreshReq() ) if( screen->IsRefreshReq() )
{ {
RedrawActiveWindow( DC, TRUE ); RedrawActiveWindow( DC, TRUE );
} }
if( oldpos != m_CurrentScreen->m_Curseur ) if( oldpos != screen->m_Curseur )
{ {
curpos = m_CurrentScreen->m_Curseur; curpos = screen->m_Curseur;
m_CurrentScreen->m_Curseur = oldpos; screen->m_Curseur = oldpos;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = curpos; GetScreen()->m_Curseur = curpos;
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
...@@ -341,9 +340,9 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -341,9 +340,9 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
if( hotkey ) if( hotkey )
{ {
if( m_CurrentScreen->GetCurItem() if( screen->GetCurItem()
&& m_CurrentScreen->GetCurItem()->m_Flags ) && screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, m_CurrentScreen->GetCurItem() ); OnHotKey( DC, hotkey, screen->GetCurItem() );
else else
OnHotKey( DC, hotkey, NULL ); OnHotKey( DC, hotkey, NULL );
} }
......
...@@ -98,7 +98,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC ...@@ -98,7 +98,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
for( DanglingItem = ItemList; DanglingItem != NULL; DanglingItem = nextitem ) for( DanglingItem = ItemList; DanglingItem != NULL; DanglingItem = nextitem )
{ {
nextitem = DanglingItem->m_Pnext; nextitem = DanglingItem->m_Pnext;
delete DanglingItem; SAFE_DELETE( DanglingItem );
} }
ItemList = RebuildEndList( DrawList ); ItemList = RebuildEndList( DrawList );
...@@ -109,6 +109,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC ...@@ -109,6 +109,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
switch( DrawItem->Type() ) switch( DrawItem->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawLabelStruct*) DrawItem ) #define STRUCT ( (DrawLabelStruct*) DrawItem )
...@@ -146,7 +147,7 @@ LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( EDA_BaseStruct* DrawList, ...@@ -146,7 +147,7 @@ LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( EDA_BaseStruct* DrawList,
const wxPoint& pos ) const wxPoint& pos )
/********************************************************************/ /********************************************************************/
/* Teste si le point de coordonnes pos est sur l'extrmit d'une PIN /* Teste si le point de coordonn�es pos est sur l'extr�mit� d'une PIN
* retourne un pointeur sur la pin * retourne un pointeur sur la pin
* NULL sinon * NULL sinon
*/ */
...@@ -280,7 +281,7 @@ wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin, ...@@ -280,7 +281,7 @@ wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin,
EDA_SchComponentStruct* DrawLibItem ) EDA_SchComponentStruct* DrawLibItem )
/****************************************************/ /****************************************************/
/* Retourne la position physique de la pin, qui dpend de l'orientation /* Retourne la position physique de la pin, qui dpend de l'orientation
* du composant */ * du composant */
{ {
wxPoint PinPos = Pin->m_Pos; wxPoint PinPos = Pin->m_Pos;
...@@ -316,8 +317,9 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -316,8 +317,9 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) DrawItem ) #define STRUCT ( (DrawLabelStruct*) DrawItem )
item = new DanglingEndHandle( LABEL_END ); item = new DanglingEndHandle( LABEL_END );
item->m_Item = DrawItem; item->m_Item = DrawItem;
......
...@@ -116,24 +116,28 @@ DrawPickedStruct * PickedItem, *PickedList = NULL; ...@@ -116,24 +116,28 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
for(DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct=DelStruct->Pnext) for(DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct=DelStruct->Pnext)
DelStruct->m_Flags = 0; DelStruct->m_Flags = 0;
BreakSegmentOnJunction( GetScreen() ); BreakSegmentOnJunction( (SCH_SCREEN*)GetScreen() );
DelStruct = GetScreen()->EEDrawList; DelStruct = GetScreen()->EEDrawList;
/* Locate all the wires, bus or junction under the mouse cursor, and put them in a list /* Locate all the wires, bus or junction under the mouse cursor, and put them in a list
of items to delete of items to delete
*/ */
SCH_SCREEN* screen = (SCH_SCREEN*)GetScreen();
EDA_BaseStruct* savedEEDrawList = screen->EEDrawList;
while ( DelStruct && while ( DelStruct &&
(DelStruct = PickStruct(GetScreen()->m_Curseur, (DelStruct = PickStruct(screen->m_Curseur,
DelStruct, JUNCTIONITEM|WIREITEM|BUSITEM)) != NULL ) screen, JUNCTIONITEM|WIREITEM|BUSITEM)) != NULL )
{ {
DelStruct->m_Flags = SELECTEDNODE|STRUCT_DELETED; DelStruct->m_Flags = SELECTEDNODE|STRUCT_DELETED;
/* Put this structure in the picked list: */ /* Put this structure in the picked list: */
PickedItem = new DrawPickedStruct(DelStruct); PickedItem = new DrawPickedStruct(DelStruct);
PickedItem->Pnext = PickedList; PickedItem->Pnext = PickedList;
PickedList = PickedItem; PickedList = PickedItem;
DelStruct=DelStruct->Pnext; DelStruct=DelStruct->Pnext;
screen->EEDrawList = DelStruct;
} }
GetScreen()->EEDrawList = savedEEDrawList;
/* Mark all wires, junctions, .. connected to one of the item to delete /* Mark all wires, junctions, .. connected to one of the item to delete
*/ */
if ( DeleteFullConnection ) if ( DeleteFullConnection )
...@@ -224,7 +228,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL; ...@@ -224,7 +228,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
if ( DelStruct->Type() != DRAW_LABEL_STRUCT_TYPE ) continue; if ( DelStruct->Type() != DRAW_LABEL_STRUCT_TYPE ) continue;
GetScreen()->m_Curseur = ((DrawTextStruct*)DelStruct)->m_Pos; GetScreen()->m_Curseur = ((DrawTextStruct*)DelStruct)->m_Pos;
EDA_BaseStruct * TstStruct = EDA_BaseStruct * TstStruct =
PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList,WIREITEM|BUSITEM); PickStruct(GetScreen()->m_Curseur, GetScreen(),WIREITEM|BUSITEM);
if ( TstStruct && TstStruct->m_Flags & STRUCT_DELETED ) if ( TstStruct && TstStruct->m_Flags & STRUCT_DELETED )
{ {
DelStruct->m_Flags |= STRUCT_DELETED; DelStruct->m_Flags |= STRUCT_DELETED;
...@@ -267,33 +271,33 @@ bool LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC) ...@@ -267,33 +271,33 @@ bool LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC)
*/ */
{ {
EDA_BaseStruct * DelStruct; EDA_BaseStruct * DelStruct;
SCH_SCREEN * screen = frame->GetScreen(); SCH_SCREEN * screen = (SCH_SCREEN*)(frame->GetScreen());
bool item_deleted = FALSE; bool item_deleted = FALSE;
DelStruct = PickStruct(screen->m_Curseur, DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, MARKERITEM); screen, MARKERITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, JUNCTIONITEM); screen, JUNCTIONITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, NOCONNECTITEM); screen, NOCONNECTITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, RACCORDITEM); screen, RACCORDITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, WIREITEM|BUSITEM); screen, WIREITEM|BUSITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, DRAWITEM); screen, DRAWITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, TEXTITEM|LABELITEM); screen, TEXTITEM|LABELITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, LIBITEM); screen, LIBITEM);
if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur, if( DelStruct == NULL ) DelStruct = PickStruct(screen->m_Curseur,
screen->EEDrawList, SHEETITEM); screen, SHEETITEM);
if (DelStruct) if (DelStruct)
{ {
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
DeleteStruct(frame->DrawPanel, DC, DelStruct); DeleteStruct(frame->DrawPanel, DC, DelStruct);
frame->TestDanglingEnds(frame->m_CurrentScreen->EEDrawList, DC); frame->TestDanglingEnds(frame->GetScreen()->EEDrawList, DC);
frame->GetScreen()->SetModify(); frame->GetScreen()->SetModify();
item_deleted = TRUE; item_deleted = TRUE;
} }
...@@ -331,6 +335,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel; ...@@ -331,6 +335,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE) if (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE)
{ /* Cette stucture est rattachee a une feuille, et n'est pas { /* Cette stucture est rattachee a une feuille, et n'est pas
accessible par la liste globale directement */ accessible par la liste globale directement */
//this structure has a sheet attached, which we must find.
DrawList = Screen->EEDrawList; DrawList = Screen->EEDrawList;
for ( ; DrawList != NULL; DrawList = DrawList->Pnext ) for ( ; DrawList != NULL; DrawList = DrawList->Pnext )
{ {
...@@ -342,7 +347,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel; ...@@ -342,7 +347,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
{ {
((DrawSheetStruct *) DrawList)->m_Label = ((DrawSheetStruct *) DrawList)->m_Label =
(DrawSheetLabelStruct *)SheetLabel->Pnext; (DrawSheetLabelStruct *)SheetLabel->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
return; return;
} }
else while( SheetLabel->Pnext )/* Examen de la liste dependante */ else while( SheetLabel->Pnext )/* Examen de la liste dependante */
...@@ -351,7 +356,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel; ...@@ -351,7 +356,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if( NextLabel == (DrawSheetLabelStruct*) DrawStruct ) if( NextLabel == (DrawSheetLabelStruct*) DrawStruct )
{ {
SheetLabel->Pnext = (EDA_BaseStruct *)NextLabel->Pnext; SheetLabel->Pnext = (EDA_BaseStruct *)NextLabel->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
return; return;
} }
SheetLabel = NextLabel; SheetLabel = NextLabel;
...@@ -360,7 +365,6 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel; ...@@ -360,7 +365,6 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
return; return;
} }
if (DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE) if (DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE)
{ {
PickedList = (DrawPickedStruct *) DrawStruct; PickedList = (DrawPickedStruct *) DrawStruct;
...@@ -369,7 +373,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel; ...@@ -369,7 +373,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if (PickedList->m_PickedStruct == Screen->EEDrawList) if (PickedList->m_PickedStruct == Screen->EEDrawList)
{ {
Screen->EEDrawList = Screen->EEDrawList->Pnext; Screen->EEDrawList = Screen->EEDrawList->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
} }
else else
{ {
...@@ -379,7 +383,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel; ...@@ -379,7 +383,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if (DrawList->Pnext == PickedList->m_PickedStruct) if (DrawList->Pnext == PickedList->m_PickedStruct)
{ {
DrawList->Pnext = DrawList->Pnext->Pnext; DrawList->Pnext = DrawList->Pnext->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
return; return;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
...@@ -393,7 +397,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel; ...@@ -393,7 +397,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if (DrawStruct == Screen->EEDrawList) if (DrawStruct == Screen->EEDrawList)
{ {
Screen->EEDrawList = DrawStruct->Pnext; Screen->EEDrawList = DrawStruct->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
} }
else else
{ {
...@@ -403,7 +407,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel; ...@@ -403,7 +407,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
if (DrawList->Pnext == DrawStruct) if (DrawList->Pnext == DrawStruct)
{ {
DrawList->Pnext = DrawStruct->Pnext; DrawList->Pnext = DrawStruct->Pnext;
delete DrawStruct; SAFE_DELETE( DrawStruct );
return; return;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
...@@ -423,7 +427,7 @@ SCH_SCREEN * screen; ...@@ -423,7 +427,7 @@ SCH_SCREEN * screen;
EDA_BaseStruct * DrawStruct, * NextStruct; EDA_BaseStruct * DrawStruct, * NextStruct;
DrawMarkerStruct * Marker; DrawMarkerStruct * Marker;
EDA_ScreenList ScreenList(NULL); EDA_ScreenList ScreenList;
for ( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for ( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{ {
for ( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct) for ( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct)
...@@ -471,7 +475,7 @@ LibEDA_BaseStruct *PreviousDrawItem; ...@@ -471,7 +475,7 @@ LibEDA_BaseStruct *PreviousDrawItem;
if( LibEntry->m_Drawings == DrawItem ) if( LibEntry->m_Drawings == DrawItem )
{ {
LibEntry->m_Drawings = DrawItem->Next(); LibEntry->m_Drawings = DrawItem->Next();
delete DrawItem; SAFE_DELETE( DrawItem );
} }
else /* Cas des autres items */ else /* Cas des autres items */
...@@ -480,7 +484,7 @@ LibEDA_BaseStruct *PreviousDrawItem; ...@@ -480,7 +484,7 @@ LibEDA_BaseStruct *PreviousDrawItem;
if(PreviousDrawItem->Pnext == DrawItem) if(PreviousDrawItem->Pnext == DrawItem)
{ {
PreviousDrawItem->Pnext = DrawItem->Pnext; PreviousDrawItem->Pnext = DrawItem->Pnext;
delete DrawItem; break; SAFE_DELETE( DrawItem ); break;
} }
PreviousDrawItem = PreviousDrawItem->Next(); PreviousDrawItem = PreviousDrawItem->Next();
} }
...@@ -488,7 +492,7 @@ LibEDA_BaseStruct *PreviousDrawItem; ...@@ -488,7 +492,7 @@ LibEDA_BaseStruct *PreviousDrawItem;
else /* Structure non reliee a un composant */ else /* Structure non reliee a un composant */
{ {
delete DrawItem; SAFE_DELETE( DrawItem );
} }
} }
......
...@@ -37,19 +37,20 @@ wxString msg; ...@@ -37,19 +37,20 @@ wxString msg;
} }
/* effacement du sous schema correspondant */ /* effacement du sous schema correspondant */
if( FirstSheet->IsModify() && confirm_deletion ) if( FirstSheet->m_s->IsModify() && confirm_deletion )
{ {
msg.Printf( _("Sheet %s (file %s) modified. Save it?"), msg.Printf( _("Sheet %s (file %s) modified. Save it?"),
FirstSheet->m_SheetName.GetData(), FirstSheet->m_SheetName.GetData(),
FirstSheet->m_FileName.GetData()); FirstSheet->m_FileName.GetData());
if( IsOK(NULL, msg) ) if( IsOK(NULL, msg) )
{ {
frame->SaveEEFile(FirstSheet, FILE_SAVE_AS); frame->SaveEEFile(FirstSheet->m_s, FILE_SAVE_AS);
} }
} }
/* free the sub hierarchy */ /* free the sub hierarchy */
EEDrawList = FirstSheet->EEDrawList; if(FirstSheet->m_s){
EEDrawList = FirstSheet->m_s->EEDrawList;
while (EEDrawList != NULL) while (EEDrawList != NULL)
{ {
DrawStruct = EEDrawList; DrawStruct = EEDrawList;
...@@ -59,15 +60,17 @@ wxString msg; ...@@ -59,15 +60,17 @@ wxString msg;
DeleteSubHierarchy((DrawSheetStruct *) DrawStruct, confirm_deletion); DeleteSubHierarchy((DrawSheetStruct *) DrawStruct, confirm_deletion);
} }
} }
/* Effacement des elements de la feuille courante */ /* Effacement des elements de la feuille courante */
FirstSheet->FreeDrawList(); FirstSheet->m_s->FreeDrawList();
}
} }
/*********************************************************************/ /*********************************************************************/
void ClearDrawList(EDA_BaseStruct *DrawList, bool confirm_deletion) //void ClearDrawList(EDA_BaseStruct *DrawList, bool confirm_deletion)
/********************************************************************/ /********************************************************************/
/* free the draw list DrawList and the subhierarchies */ /* free the draw list DrawList and the subhierarchies */
//this is redundant -- use FreeDrawList, a member of SCH_SCREEN
/*
{ {
EDA_BaseStruct *DrawStruct; EDA_BaseStruct *DrawStruct;
...@@ -84,7 +87,7 @@ EDA_BaseStruct *DrawStruct; ...@@ -84,7 +87,7 @@ EDA_BaseStruct *DrawStruct;
delete DrawStruct; delete DrawStruct;
} }
} }
*/
/********************************************************************/ /********************************************************************/
bool ClearProjectDrawList(SCH_SCREEN * screen, bool confirm_deletion) bool ClearProjectDrawList(SCH_SCREEN * screen, bool confirm_deletion)
/********************************************************************/ /********************************************************************/
...@@ -94,11 +97,10 @@ bool ClearProjectDrawList(SCH_SCREEN * screen, bool confirm_deletion) ...@@ -94,11 +97,10 @@ bool ClearProjectDrawList(SCH_SCREEN * screen, bool confirm_deletion)
{ {
if ( screen == NULL ) return(TRUE); if ( screen == NULL ) return(TRUE);
ClearDrawList(screen->EEDrawList, confirm_deletion); screen->FreeDrawList();
screen->EEDrawList = NULL;
/* Clear the screen datas */ /* Clear the screen datas */
screen->m_SheetNumber = screen->m_NumberOfSheet = 1; screen->m_ScreenNumber = screen->m_NumberOfScreen = 1;
screen->m_Title.Empty(); screen->m_Title.Empty();
screen->m_Revision.Empty(); screen->m_Revision.Empty();
screen->m_Company.Empty(); screen->m_Company.Empty();
......
This diff is collapsed.
...@@ -131,8 +131,8 @@ public: ...@@ -131,8 +131,8 @@ public:
////@end WinEDA_Build_BOM_Frame member function declarations ////@end WinEDA_Build_BOM_Frame member function declarations
void GenereListeOfItems(const wxString & FullFileName); void GenereListeOfItems(const wxString & FullFileName);
void CreateExportList(const wxString & FullFileName); void CreateExportList(const wxString & FullFileName);
int PrintListeCmpByRef( FILE * f, EDA_BaseStruct ** List, int NbItems, bool CompactForm = FALSE ); int PrintListeCmpByRef( FILE * f, ListComponent * List, int NbItems, bool CompactForm = FALSE );
int PrintListeCmpByVal( FILE *f, EDA_BaseStruct **List, int NbItems); int PrintListeCmpByVal( FILE *f, ListComponent * List, int NbItems);
void PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem, bool CompactForm = FALSE); void PrintFieldData(FILE * f, EDA_SchComponentStruct * DrawLibItem, bool CompactForm = FALSE);
void SavePreferences(); void SavePreferences();
......
...@@ -68,6 +68,10 @@ wxString msg; ...@@ -68,6 +68,10 @@ wxString msg;
SetTitle(_("Global Label properties")); SetTitle(_("Global Label properties"));
break; break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
SetTitle(_("Hierarchal Label properties"));
break;
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
SetTitle(_("Label properties")); SetTitle(_("Label properties"));
break; break;
...@@ -155,7 +159,7 @@ void WinEDA_LabelPropertiesFrame::CreateControls() ...@@ -155,7 +159,7 @@ void WinEDA_LabelPropertiesFrame::CreateControls()
m_TextShapeStrings.Add(_("Bidi")); m_TextShapeStrings.Add(_("Bidi"));
m_TextShapeStrings.Add(_("TriState")); m_TextShapeStrings.Add(_("TriState"));
m_TextShapeStrings.Add(_("Passive")); m_TextShapeStrings.Add(_("Passive"));
m_TextShape = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Glabel Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeStrings, 1, wxRA_SPECIFY_COLS ); m_TextShape = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("label Shape:"), wxDefaultPosition, wxDefaultSize, m_TextShapeStrings, 1, wxRA_SPECIFY_COLS );
m_TextShape->SetSelection(0); m_TextShape->SetSelection(0);
m_TextShape->Show(false); m_TextShape->Show(false);
itemBoxSizer6->Add(m_TextShape, 0, wxALIGN_TOP|wxALL, 5); itemBoxSizer6->Add(m_TextShape, 0, wxALIGN_TOP|wxALL, 5);
...@@ -185,7 +189,8 @@ void WinEDA_LabelPropertiesFrame::CreateControls() ...@@ -185,7 +189,8 @@ void WinEDA_LabelPropertiesFrame::CreateControls()
m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) ); m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) );
////@end WinEDA_LabelPropertiesFrame content construction ////@end WinEDA_LabelPropertiesFrame content construction
if (m_CurrentText->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if (m_CurrentText->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE ||
m_CurrentText->Type() == DRAW_HIER_LABEL_STRUCT_TYPE)
m_TextShape->Show(true); m_TextShape->Show(true);
} }
......
...@@ -433,10 +433,10 @@ wxString msg; ...@@ -433,10 +433,10 @@ wxString msg;
break; break;
} }
if ( m_Parent->m_CurrentScreen ) if ( m_Parent->GetScreen() )
{ {
if ( setgrid ) m_Parent->m_CurrentScreen->SetGrid(grid); if ( setgrid ) m_Parent->GetScreen()->SetGrid(grid);
m_Parent->m_CurrentScreen->SetRefreshReq(); m_Parent->GetScreen()->SetRefreshReq();
} }
} }
...@@ -14,28 +14,6 @@ ...@@ -14,28 +14,6 @@
#include "protos.h" #include "protos.h"
/**********************************************************/
SCH_SCREEN * CreateNewScreen(WinEDA_DrawFrame * frame_source,
SCH_SCREEN * OldScreen, int TimeStamp)
/**********************************************************/
/* Routine de creation ( par allocation memoire ) d'un nouvel ecran
cet ecran est en chainage arriere avec OldScreen
la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
*/
{
SCH_SCREEN * NewScreen;
NewScreen = new SCH_SCREEN(NULL, frame_source, SCHEMATIC_FRAME);
NewScreen->SetRefreshReq();
if(OldScreen) NewScreen->m_Company = OldScreen->m_Company;
NewScreen->m_TimeStamp = TimeStamp;
NewScreen->Pback = OldScreen;
return(NewScreen);
}
/**************************************/ /**************************************/
void SetFlagModify(BASE_SCREEN * Window) void SetFlagModify(BASE_SCREEN * Window)
/**************************************/ /**************************************/
......
...@@ -29,15 +29,15 @@ enum id_libedit { ...@@ -29,15 +29,15 @@ enum id_libedit {
/* Variables locales */ /* Variables locales */
extern int CurrentUnit; extern int CurrentUnit;
/* Classe de la frame des proprits d'un composant en librairie */ /* Classe de la frame des propri�t�s d'un composant en librairie */
/* Cette classe genere une fenetre type NoteBook, pour l'edition des proprits /* Cette classe genere une fenetre type NoteBook, pour l'edition des propri�t�s
* d'un composant le librairie. * d'un composant le librairie.
* On peut diter: * On peut �diter:
* Texte dimensions et justification de tous les champs (Ref, Val, et autres champs) * Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
* Documentation et mots clefs * Documentation et mots clefs
* Nombre de part par boitier * Nombre de part par boitier
* et autres proprirs gnrales * et autres propri�r�s g�n�rales
*/ */
#include "dialog_edit_component_in_lib.cpp" #include "dialog_edit_component_in_lib.cpp"
...@@ -653,7 +653,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event ) ...@@ -653,7 +653,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
Close(); return; Close(); return;
} }
m_Parent->m_CurrentScreen->SetModify(); m_Parent->GetScreen()->SetModify();
m_Parent->SaveCopyInUndoList( CurrentLibEntry ); m_Parent->SaveCopyInUndoList( CurrentLibEntry );
CopyPanelFieldToData(); CopyPanelFieldToData();
...@@ -761,7 +761,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event ) ...@@ -761,7 +761,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
{ {
if( ii < FIELD1 || Field->m_Name.IsEmpty() ) if( ii < FIELD1 || Field->m_Name.IsEmpty() )
{ {
delete Field; SAFE_DELETE( Field );
if( previousField ) if( previousField )
previousField->Pnext = NextField; previousField->Pnext = NextField;
else else
...@@ -1056,8 +1056,8 @@ bool WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackage( int MaxUnit ) ...@@ -1056,8 +1056,8 @@ bool WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackage( int MaxUnit )
bool WinEDA_PartPropertiesFrame::SetUnsetConvert() bool WinEDA_PartPropertiesFrame::SetUnsetConvert()
/*****************************************************/ /*****************************************************/
/* cre ou efface (selon option AsConvert) les lments /* cr�e ou efface (selon option AsConvert) les �l�ments
* de la reprsentation convertie d'un composant * de la repr�sentation convertie d'un composant
*/ */
{ {
int FlagDel = 0; int FlagDel = 0;
...@@ -1096,7 +1096,7 @@ bool WinEDA_PartPropertiesFrame::SetUnsetConvert() ...@@ -1096,7 +1096,7 @@ bool WinEDA_PartPropertiesFrame::SetUnsetConvert()
} }
else /* Representation convertie a supprimer */ else /* Representation convertie a supprimer */
{ {
/* Traitement des elements supprimer */ /* Traitement des elements � supprimer */
if( CurrentLibEntry ) if( CurrentLibEntry )
DrawItem = CurrentLibEntry->m_Drawings; DrawItem = CurrentLibEntry->m_Drawings;
for( ; DrawItem != NULL; DrawItem = NextDrawItem ) for( ; DrawItem != NULL; DrawItem = NextDrawItem )
......
...@@ -88,6 +88,9 @@ void WinEDA_ComponentPropertiesFrame::InitBuffers() ...@@ -88,6 +88,9 @@ void WinEDA_ComponentPropertiesFrame::InitBuffers()
for( ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ ) for( ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ )
{ {
m_FieldName[ii] = m_Cmp->ReturnFieldName( ii ); m_FieldName[ii] = m_Cmp->ReturnFieldName( ii );
if(ii == REFERENCE)
m_FieldText[ii] = m_Cmp->GetRef(m_Parent->GetSheet());
else
m_FieldText[ii] = m_Cmp->m_Field[ii].m_Text; m_FieldText[ii] = m_Cmp->m_Field[ii].m_Text;
m_FieldSize[ii] = m_Cmp->m_Field[ii].m_Size.x; m_FieldSize[ii] = m_Cmp->m_Field[ii].m_Size.x;
m_FieldFlags[ii] = m_FieldFlags[ii] =
...@@ -115,8 +118,9 @@ void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField() ...@@ -115,8 +118,9 @@ void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField()
{ {
int fieldId = m_CurrentFieldId; int fieldId = m_CurrentFieldId;
for( int ii = FIELD1; ii < NUMBER_OF_FIELDS; ii++ ) for( int ii = FIELD1; ii < NUMBER_OF_FIELDS; ii++ ){
m_FieldSelection->SetString( ii, m_FieldName[ii] ); m_FieldSelection->SetString( ii, m_FieldName[ii] );
}
if( fieldId == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER ) if( fieldId == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER )
m_FieldTextCtrl->Enable( FALSE ); m_FieldTextCtrl->Enable( FALSE );
...@@ -343,7 +347,7 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent& ...@@ -343,7 +347,7 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
(m_ConvertButt->GetValue() == TRUE) ? (m_ConvertButt->GetValue() == TRUE) ?
m_Cmp->m_Convert = 2 : m_Cmp->m_Convert = 1; m_Cmp->m_Convert = 2 : m_Cmp->m_Convert = 1;
//Mise a jour de la selection de l'lment dans le boitier //Mise a jour de la selection de l'�l�ment dans le boitier
if( m_Cmp->m_Multi ) if( m_Cmp->m_Multi )
m_Cmp->m_Multi = m_SelectUnit->GetSelection() + 1; m_Cmp->m_Multi = m_SelectUnit->GetSelection() + 1;
...@@ -382,13 +386,13 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent& ...@@ -382,13 +386,13 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
} }
// Mise a jour des textes // Mise a jour des textes (update the texts)
for( int ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ ) for( int ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ )
{ {
if( ii == REFERENCE ) // la reference ne peut etre vide if( ii == REFERENCE ) // la reference ne peut etre vide
{ {
if( !m_FieldText[ii].IsEmpty() ) if( !m_FieldText[ii].IsEmpty() )
m_Cmp->m_Field[ii].m_Text = m_FieldText[ii]; m_Cmp->SetRef(m_Parent->GetSheet(), m_FieldText[ii]);
} }
else if( ii == VALUE ) // la valeur ne peut etre vide et ne peut etre change sur un POWER else if( ii == VALUE ) // la valeur ne peut etre vide et ne peut etre change sur un POWER
{ {
...@@ -421,10 +425,10 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent& ...@@ -421,10 +425,10 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
m_Cmp->m_Field[ii].m_Pos.y += cmp_pos.y; m_Cmp->m_Field[ii].m_Pos.y += cmp_pos.y;
} }
m_Parent->m_CurrentScreen->SetModify(); m_Parent->GetScreen()->SetModify();
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE );
m_Parent->TestDanglingEnds( m_Parent->m_CurrentScreen->EEDrawList, &dc ); m_Parent->TestDanglingEnds( m_Parent->GetScreen()->EEDrawList, &dc );
EndModal( 0 ); EndModal( 0 );
} }
...@@ -454,7 +458,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC ) ...@@ -454,7 +458,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC )
int x1, y1; int x1, y1;
EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) CurrentField->m_Parent; EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) CurrentField->m_Parent;
delete g_ItemToUndoCopy; SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = Cmp->GenCopy(); g_ItemToUndoCopy = Cmp->GenCopy();
pos = Cmp->m_Pos; pos = Cmp->m_Pos;
...@@ -476,7 +480,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC ) ...@@ -476,7 +480,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC )
newpos.y = pos.y + Cmp->m_Transform[0][1] * x1 + Cmp->m_Transform[1][1] * y1; newpos.y = pos.y + Cmp->m_Transform[0][1] * x1 + Cmp->m_Transform[1][1] * y1;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = newpos; GetScreen()->m_Curseur = newpos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
OldPos = Field->m_Pos; OldPos = Field->m_Pos;
...@@ -561,6 +565,9 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC ) ...@@ -561,6 +565,9 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
Field->m_Size.x = Field->m_Size.y = TextFieldSize; Field->m_Size.x = Field->m_Size.y = TextFieldSize;
} }
Field->m_Text = newtext; Field->m_Text = newtext;
if( FieldNumber == REFERENCE ){
Cmp->SetRef(GetSheet(), newtext);
}
} }
else /* Nouveau texte NULL */ else /* Nouveau texte NULL */
{ {
...@@ -580,7 +587,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC ) ...@@ -580,7 +587,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); DrawTextField( DrawPanel, DC, Field, flag, g_XorMode );
Cmp->Display_Infos( this ); Cmp->Display_Infos( this );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
} }
...@@ -633,7 +640,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -633,7 +640,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC )
DrawTextField( Panel, DC, CurrentField, Multiflag, GR_DEFAULT_DRAWMODE ); DrawTextField( Panel, DC, CurrentField, Multiflag, GR_DEFAULT_DRAWMODE );
} }
CurrentField = NULL; CurrentField = NULL;
delete g_ItemToUndoCopy; g_ItemToUndoCopy = NULL; SAFE_DELETE( g_ItemToUndoCopy );
} }
...@@ -725,7 +732,6 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp, ...@@ -725,7 +732,6 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
/**************************************************************************************************/ /**************************************************************************************************/
/* Edit the component text reference*/ /* Edit the component text reference*/
{ {
wxString msg;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
int flag = 0; int flag = 0;
...@@ -739,19 +745,18 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp, ...@@ -739,19 +745,18 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
if( Entry->m_UnitCount > 1 ) if( Entry->m_UnitCount > 1 )
flag = 1; flag = 1;
PartTextStruct* TextField = &Cmp->m_Field[REFERENCE]; wxString ref = Cmp->GetRef(GetSheet());
Get_Message( _( "Reference" ), ref, this );
msg = TextField->m_Text; if( !ref.IsEmpty() ) // New text entered
Get_Message( _( "Reference" ), msg, this );
if( !msg.IsEmpty() ) // New text entered
{ {
/* save old cmp in undo list if not already in edit, or moving ... */ /* save old cmp in undo list if not already in edit, or moving ... */
if( Cmp->m_Flags == 0 ) if( Cmp->m_Flags == 0 )
SaveCopyInUndoList( Cmp, IS_CHANGED ); SaveCopyInUndoList( Cmp, IS_CHANGED );
Cmp->SetRef(GetSheet(), ref);
DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, g_XorMode ); DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, g_XorMode );
TextField->m_Text = msg; Cmp->SetRef(GetSheet(), ref );
DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag,
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
GetScreen()->SetModify(); GetScreen()->SetModify();
...@@ -794,7 +799,7 @@ void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxD ...@@ -794,7 +799,7 @@ void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxD
TextField->m_Text = msg; TextField->m_Text = msg;
DrawTextField( DrawPanel, DC, &Cmp->m_Field[VALUE], flag, DrawTextField( DrawPanel, DC, &Cmp->m_Field[VALUE], flag,
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
} }
Cmp->Display_Infos( this ); Cmp->Display_Infos( this );
...@@ -848,7 +853,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( EDA_SchComponentStruct* Cmp, ...@@ -848,7 +853,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( EDA_SchComponentStruct* Cmp,
DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag, DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag,
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
Cmp->Display_Infos( this ); Cmp->Display_Infos( this );
} }
...@@ -896,7 +901,7 @@ void WinEDA_ComponentPropertiesFrame::SetInitCmp( wxCommandEvent& event ) ...@@ -896,7 +901,7 @@ void WinEDA_ComponentPropertiesFrame::SetInitCmp( wxCommandEvent& event )
m_Cmp->SetRotationMiroir( CMP_NORMAL ); m_Cmp->SetRotationMiroir( CMP_NORMAL );
m_Parent->m_CurrentScreen->SetModify(); m_Parent->GetScreen()->SetModify();
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE );
EndModal( 1 ); EndModal( 1 );
......
...@@ -87,6 +87,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC ...@@ -87,6 +87,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
ItemInitialPosition = TextStruct->m_Pos; ItemInitialPosition = TextStruct->m_Pos;
OldSize = TextStruct->m_Size; OldSize = TextStruct->m_Size;
...@@ -98,7 +99,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC ...@@ -98,7 +99,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
} }
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = ItemInitialPosition; GetScreen()->m_Curseur = ItemInitialPosition;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->SetModify(); GetScreen()->SetModify();
...@@ -142,7 +143,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC* ...@@ -142,7 +143,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
{ {
if( TextStruct == NULL ) if( TextStruct == NULL )
TextStruct = (DrawTextStruct*) PickStruct( GetScreen()->m_Curseur, TextStruct = (DrawTextStruct*) PickStruct( GetScreen()->m_Curseur,
GetScreen()->EEDrawList, TEXTITEM | LABELITEM ); GetScreen(), TEXTITEM | LABELITEM );
if( TextStruct == NULL ) if( TextStruct == NULL )
return; return;
...@@ -159,6 +160,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC* ...@@ -159,6 +160,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
TextStruct->m_Orient++; TextStruct->m_Orient++;
TextStruct->m_Orient &= 3; TextStruct->m_Orient &= 3;
...@@ -190,15 +192,21 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -190,15 +192,21 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
switch( type ) switch( type )
{ {
case LAYER_NOTES: case LAYER_NOTES:
NewText = new DrawTextStruct( m_CurrentScreen->m_Curseur ); NewText = new DrawTextStruct( GetScreen()->m_Curseur );
break; break;
case LAYER_LOCLABEL: case LAYER_LOCLABEL:
NewText = new DrawLabelStruct( m_CurrentScreen->m_Curseur ); NewText = new DrawLabelStruct( GetScreen()->m_Curseur );
break;
case LAYER_HIERLABEL:
NewText = new DrawHierLabelStruct(GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel;
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
NewText = new DrawGlobalLabelStruct( m_CurrentScreen->m_Curseur ); NewText = new DrawGlobalLabelStruct(GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel; NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel; NewText->m_Orient = s_DefaultOrientGLabel;
break; break;
...@@ -216,11 +224,11 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -216,11 +224,11 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
if( NewText->m_Text.IsEmpty() ) if( NewText->m_Text.IsEmpty() )
{ {
delete NewText; SAFE_DELETE( NewText );
return NULL; return NULL;
} }
if( type == LAYER_GLOBLABEL ) if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL)
{ {
s_DefaultShapeGLabel = NewText->m_Shape; s_DefaultShapeGLabel = NewText->m_Shape;
s_DefaultOrientGLabel = NewText->m_Orient; s_DefaultOrientGLabel = NewText->m_Orient;
...@@ -230,7 +238,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -230,7 +238,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte; DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
m_CurrentScreen->SetCurItem( NewText ); GetScreen()->SetCurItem( NewText );
return NewText; return NewText;
} }
...@@ -252,6 +260,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -252,6 +260,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
( (DrawTextStruct*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur; ( (DrawTextStruct*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur;
break; break;
...@@ -269,7 +278,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -269,7 +278,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************************/ /*************************************************************/
/* Abort function for the command move text */ /* Abort function for the command move text */
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->m_CurrentScreen; SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->GetScreen();
EDA_BaseStruct* Struct = screen->GetCurItem(); EDA_BaseStruct* Struct = screen->GetCurItem();
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
...@@ -286,7 +295,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -286,7 +295,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
if( Struct->m_Flags & IS_NEW ) if( Struct->m_Flags & IS_NEW )
{ {
delete Struct; SAFE_DELETE( Struct );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
} }
else /* this was a move command on an "old" text: restore its old settings. */ else /* this was a move command on an "old" text: restore its old settings. */
...@@ -295,6 +304,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -295,6 +304,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
{ {
DrawTextStruct* Text = (DrawTextStruct*) Struct; DrawTextStruct* Text = (DrawTextStruct*) Struct;
...@@ -336,9 +346,11 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text, ...@@ -336,9 +346,11 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
newtext = new DrawGlobalLabelStruct( Text->m_Pos, Text->m_Text ); newtext = new DrawGlobalLabelStruct(Text->m_Pos, Text->m_Text );
break;
case DRAW_HIER_LABEL_STRUCT_TYPE:
newtext = new DrawHierLabelStruct(Text->m_Pos, Text->m_Text );
break; break;
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
newtext = new DrawTextStruct( Text->m_Pos, Text->m_Text ); newtext = new DrawTextStruct( Text->m_Pos, Text->m_Text );
break; break;
...@@ -381,13 +393,12 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text, ...@@ -381,13 +393,12 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
{ {
Text->m_Flags = 0; Text->m_Flags = 0;
DeleteStruct( DrawPanel, DC, Text ); DeleteStruct( DrawPanel, DC, Text );
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
} }
GetScreen()->SetCurItem( newtext ); GetScreen()->SetCurItem( newtext );
delete g_ItemToUndoCopy; SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = NULL;
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CursorOff( DC ); // Erase schematic cursor
......
...@@ -52,7 +52,7 @@ wxString FullFileName; ...@@ -52,7 +52,7 @@ wxString FullFileName;
case ID_CONFIG_READ: case ID_CONFIG_READ:
{ {
wxString mask( wxT("*") ); mask += g_Prj_Config_Filename_ext; wxString mask( wxT("*") ); mask += g_Prj_Config_Filename_ext;
FullFileName = ScreenSch->m_FileName; FullFileName = g_RootSheet->m_s->m_FileName;
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext ); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Read config file"), FullFileName = EDA_FileSelector(_("Read config file"),
...@@ -142,7 +142,7 @@ wxString FullFileName; ...@@ -142,7 +142,7 @@ wxString FullFileName;
bool IsRead = TRUE; bool IsRead = TRUE;
wxArrayString liblist_tmp = g_LibName_List; wxArrayString liblist_tmp = g_LibName_List;
if ( CfgFileName.IsEmpty() ) FullFileName = ScreenSch->m_FileName; if ( CfgFileName.IsEmpty() ) FullFileName = g_RootSheet->m_s->m_FileName;
else FullFileName = CfgFileName; else FullFileName = CfgFileName;
g_LibName_List.Clear(); g_LibName_List.Clear();
...@@ -185,7 +185,7 @@ wxString FullFileName; ...@@ -185,7 +185,7 @@ wxString FullFileName;
wxString mask( wxT("*") ); wxString mask( wxT("*") );
mask += g_Prj_Config_Filename_ext; mask += g_Prj_Config_Filename_ext;
FullFileName = ScreenSch->m_FileName.AfterLast('/') /*ConfigFileName*/; FullFileName = g_RootSheet->m_s->m_FileName.AfterLast('/') /*ConfigFileName*/;
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext ); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
path = wxGetCwd(); path = wxGetCwd();
......
...@@ -27,6 +27,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -27,6 +27,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
/* Routine de Trace de segments ( WIRES, BUS ) pour lesquels chaque segment /* Routine de Trace de segments ( WIRES, BUS ) pour lesquels chaque segment
* est une structure. * est une structure.
*/ */
// NOT USED!!!@!@!
{ {
DrawSegmentStruct* oldsegment, * newsegment; DrawSegmentStruct* oldsegment, * newsegment;
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
...@@ -84,7 +85,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -84,7 +85,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
GetScreen()->ManageCurseur( DrawPanel, DC, FALSE ); GetScreen()->ManageCurseur( DrawPanel, DC, FALSE );
oldsegment->m_EndIsDangling = FALSE; oldsegment->m_EndIsDangling = FALSE;
/* Creation du segment suivant ou fin de trac si point sur pin, jonction ...*/ /* Creation du segment suivant ou fin de trac si point sur pin, jonction ...*/
if( IsTerminalPoint( GetScreen(), oldsegment->m_End, oldsegment->m_Layer ) ) if( IsTerminalPoint( GetScreen(), oldsegment->m_End, oldsegment->m_Layer ) )
{ {
EndSegment( DC ); return; EndSegment( DC ); return;
...@@ -385,21 +386,10 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) ...@@ -385,21 +386,10 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (DrawLabelStruct*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos.x += g_RepeatStep.x; ox = STRUCT->m_Pos.x;
STRUCT->m_Pos.y += g_RepeatStep.y; oy = STRUCT->m_Pos.y;
/*** Increment du numero de label ***/
strcpy( Line, STRUCT->GetText() );
IncrementLabelMember( Line );
STRUCT->m_Text = Line;
break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawGlobalLabelStruct*) g_ItemToRepeat ) #define STRUCT ( (DrawLabelStruct*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy(); g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos.x += g_RepeatStep.x; ox = STRUCT->m_Pos.x; STRUCT->m_Pos.x += g_RepeatStep.x; ox = STRUCT->m_Pos.x;
STRUCT->m_Pos.y += g_RepeatStep.y; oy = STRUCT->m_Pos.y; STRUCT->m_Pos.y += g_RepeatStep.y; oy = STRUCT->m_Pos.y;
...@@ -479,10 +469,10 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -479,10 +469,10 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
* - type WIRE, si il y a * - type WIRE, si il y a
* - une jonction * - une jonction
* - ou une pin * - ou une pin
* - ou une extrmit unique de fil * - ou une extr�mit� unique de fil
* *
* - type BUS, si il y a * - type BUS, si il y a
* - ou une extrmit unique de BUS * - ou une extr�mit� unique de BUS
*/ */
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;
......
...@@ -193,7 +193,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -193,7 +193,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
Field->m_HJustify, Field->m_VJustify, LineWidth ); Field->m_HJustify, Field->m_VJustify, LineWidth );
} }
// Trac de l'ancre // Trac de l'ancre
int len = 3 * panel->GetZoom(); int len = 3 * panel->GetZoom();
GRLine( &panel->m_ClipBox, DC, posX, posY - len, posX, posY + len, 0, color ); GRLine( &panel->m_ClipBox, DC, posX, posY - len, posX, posY + len, 0, color );
GRLine( &panel->m_ClipBox, DC, posX - len, posY, posX + len, posY, 0, color ); GRLine( &panel->m_ClipBox, DC, posX - len, posY, posX + len, posY, 0, color );
...@@ -212,7 +212,7 @@ void EDA_SchComponentStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -212,7 +212,7 @@ void EDA_SchComponentStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
bool dummy = FALSE; bool dummy = FALSE;
if( ( Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ) ) == NULL ) if( ( Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ) ) == NULL )
{ /* composant non trouv, on affiche un composant "dummy" */ { /* composant non trouv, on affiche un composant "dummy" */
dummy = TRUE; dummy = TRUE;
if( DummyCmp == NULL ) if( DummyCmp == NULL )
CreateDummyCmp(); CreateDummyCmp();
...@@ -587,8 +587,8 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -587,8 +587,8 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
LibDrawPin* Pin = (LibDrawPin*) DEntry; LibDrawPin* Pin = (LibDrawPin*) DEntry;
if( Pin->m_Attributs & PINNOTDRAW ) if( Pin->m_Attributs & PINNOTDRAW )
{ {
if( (ActiveScreen->m_Type == SCHEMATIC_FRAME) if( /*(GetScreen()->m_Type == SCHEMATIC_FRAME )
&& !g_ShowAllPins ) &&*/ !g_ShowAllPins )
break; break;
} }
......
...@@ -91,9 +91,9 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame, ...@@ -91,9 +91,9 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
ChangeFileNameExt( FullFileName, DOC_EXT ); ChangeFileNameExt( FullFileName, DOC_EXT );
LoadDocLib( frame, FullFileName, NewLib->m_Name ); LoadDocLib( frame, FullFileName, NewLib->m_Name );
} }
else else{
delete NewLib; SAFE_DELETE( NewLib );
}
fclose( f ); fclose( f );
return NewLib; return NewLib;
} }
...@@ -237,7 +237,7 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName ) ...@@ -237,7 +237,7 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
TempLib->m_Pnext = TempLib->m_Pnext->m_Pnext; TempLib->m_Pnext = TempLib->m_Pnext->m_Pnext;
} }
delete Lib; SAFE_DELETE( Lib );
/* The removed librairy can be the current library in libedit. /* The removed librairy can be the current library in libedit.
* If so, clear the current library in libedit */ * If so, clear the current library in libedit */
...@@ -483,7 +483,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char ...@@ -483,7 +483,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char
Msg.Printf( wxT( " Error at line %d of library \n\"%s\",\nlibrary not loaded" ), Msg.Printf( wxT( " Error at line %d of library \n\"%s\",\nlibrary not loaded" ),
*LineNum, currentLibraryName.GetData() ); *LineNum, currentLibraryName.GetData() );
DisplayError( frame, Msg ); DisplayError( frame, Msg );
delete LibEntry; SAFE_DELETE( LibEntry );
return NULL; return NULL;
} }
} }
...@@ -604,7 +604,7 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char* ...@@ -604,7 +604,7 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
if( !Error ) if( !Error )
{ /* Convert '~' to spaces. */ { /* Convert '~' to spaces. */
Text->m_Text = CONV_FROM_UTF8( Buffer ); Text->m_Text = CONV_FROM_UTF8( Buffer );
Text->m_Text.Replace( wxT( "~" ), wxT( " " ) ); // Les espaces sont restitus Text->m_Text.Replace( wxT( "~" ), wxT( " " ) ); // Les espaces sont restitus
} }
} }
break; break;
...@@ -780,7 +780,7 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char* ...@@ -780,7 +780,7 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
MsgLine.Printf( wxT( "Error in %c DRAW command in line %d, aborted." ), MsgLine.Printf( wxT( "Error in %c DRAW command in line %d, aborted." ),
Line[0], *LineNum ); Line[0], *LineNum );
DisplayError( frame, MsgLine ); DisplayError( frame, MsgLine );
delete New; SAFE_DELETE( New );
/* FLush till end of draw: */ /* FLush till end of draw: */
do { do {
...@@ -1119,8 +1119,8 @@ static int SortItemsFct( const void* ref, const void* item ); ...@@ -1119,8 +1119,8 @@ static int SortItemsFct( const void* ref, const void* item );
void EDA_LibComponentStruct::SortDrawItems() void EDA_LibComponentStruct::SortDrawItems()
/*******************************************/ /*******************************************/
/* Trie les lments graphiques d'un composant lib pour amliorer /* Trie les �l�ments graphiques d'un composant lib pour am�liorer
* le trac: * le trac:
* items remplis en premier, pins en dernier * items remplis en premier, pins en dernier
* En cas de superposition d'items, c'est plus lisible * En cas de superposition d'items, c'est plus lisible
*/ */
......
/****************************************/
/* Module to load/save EESchema files. */
/****************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "protos.h"
#include "id.h"
static void LoadSubHierarchy( WinEDA_SchematicFrame* frame, EDA_BaseStruct* DrawList );
/* Variables locales */
/************************************************************************************/
int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNew )
/************************************************************************************/
/*
* Load an entire project ( shcematic root file and its subhierarchies, the configuration and the libs
* which are not already loaded)
*/
{
SCH_SCREEN* screen;
wxString FullFileName, msg;
bool LibCacheExist = FALSE;
EDA_ScreenList ScreenList( NULL );
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{
if( screen->IsModify() )
break;
}
if( screen )
{
if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) )
return FALSE;
if( ScreenSch->m_FileName != g_DefaultSchematicFileName )
SetLastProject( ScreenSch->m_FileName );
}
screen = ScreenSch;
FullFileName = FileName;
if( ( FullFileName.IsEmpty() ) && !IsNew )
{
wxString mask = wxT( "*" ) + g_SchExtBuffer;
FullFileName = EDA_FileSelector( _( "Schematic files:" ),
wxEmptyString, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */
g_SchExtBuffer, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE
);
if( FullFileName.IsEmpty() )
return FALSE;
}
if( ClearProjectDrawList( screen, TRUE ) == FALSE )
return 1;
ActiveScreen = m_CurrentScreen = screen = ScreenSch;
ScreenSch->ClearUndoRedoList();
screen->SetCurItem( NULL );
wxSetWorkingDirectory( wxPathOnly( FullFileName ) );
m_CurrentScreen->m_FileName = FullFileName;
Affiche_Message( wxEmptyString );
MsgPanel->EraseMsgBox();
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );
m_CurrentScreen->ClrModify();
m_CurrentScreen->Pnext = NULL;
if( IsNew )
{
screen->m_CurrentSheet = &g_Sheet_A4;
screen->SetZoom( 32 );
screen->m_SheetNumber = screen->m_NumberOfSheet = 1;
screen->m_Title = wxT( "noname.sch" );
m_CurrentScreen->m_FileName = screen->m_Title;
screen->m_Company.Empty();
screen->m_Commentaire1.Empty();
screen->m_Commentaire2.Empty();
screen->m_Commentaire3.Empty();
screen->m_Commentaire4.Empty();
Read_Config( wxEmptyString, TRUE );
Zoom_Automatique( TRUE );
ReDrawPanel();
return 1;
}
// Rechargement de la configuration:
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
PrintMsg( msg );
Read_Config( wxEmptyString, FALSE );
// Delete old caches.
LibraryStruct* nextlib, * lib = g_LibraryList;
for( ; lib != NULL; lib = nextlib )
{
nextlib = lib->m_Pnext;
if( lib->m_IsLibCache )
FreeCmpLibrary( this, lib->m_Name );
}
if( IsNew )
{
ReDrawPanel();
return 1;
}
// Loading the project library cache
wxString FullLibName;
wxString shortfilename;
wxSplitPath( ScreenSch->m_FileName, NULL, &shortfilename, NULL );
FullLibName << wxT( "." ) << STRING_DIR_SEP << shortfilename << wxT( ".cache" ) <<
g_LibExtBuffer;
if( wxFileExists( FullLibName ) )
{
wxString libname;
libname = FullLibName;
ChangeFileNameExt( libname, wxEmptyString );
msg = wxT( "Load " ) + FullLibName;
LibraryStruct* LibCache = LoadLibraryName( this, FullLibName, libname );
if( LibCache )
{
LibCache->m_IsLibCache = TRUE;
msg += wxT( " OK" );
}
else
msg += wxT( " ->Error" );
PrintMsg( msg );
LibCacheExist = TRUE;
}
if( !wxFileExists( ScreenSch->m_FileName ) && !LibCacheExist ) // Nouveau projet prpbablement
{
msg.Printf( _( "File %s not found (new project ?)" ),
ScreenSch->m_FileName.GetData() );
DisplayInfo( this, msg, 20 );
return -1;
}
if( LoadOneEEFile( ScreenSch, ScreenSch->m_FileName ) == FALSE )
return 0;
/* load all subhierarchies fond in current list and new loaded list */
LoadSubHierarchy( this, ScreenSch->EEDrawList );
/* Reaffichage ecran de base (ROOT) si necessaire */
ActiveScreen = ScreenSch;
Zoom_Automatique( FALSE );
return 1;
}
/*******************************************************************************/
void LoadSubHierarchy( WinEDA_SchematicFrame* frame, EDA_BaseStruct* DrawList )
/*******************************************************************************/
/* load subhierarcy when sheets are found in DrawList
* recursive function.
*/
{
EDA_BaseStruct* EEDrawList = DrawList;
while( EEDrawList )
{
if( EEDrawList->Type() == DRAW_SHEET_STRUCT_TYPE )
{
#undef STRUCT
#define STRUCT ( (DrawSheetStruct*) EEDrawList )
int timestamp = STRUCT->m_TimeStamp;
if( timestamp == 0 )
{
timestamp = GetTimeStamp();
STRUCT->m_TimeStamp = timestamp;
}
if( !STRUCT->m_FileName.IsEmpty() )
{
//problem -- must check for closed loops here, or we may never exit!
//search back up the linked list tree...
EDA_BaseStruct* strct = EEDrawList;
bool noRecurse = true;
while( strct->m_Parent ){
strct = strct->m_Parent;
if( ((DrawSheetStruct*)strct)->m_FileName ==
STRUCT->m_FileName ){
wxString msg;
msg += wxString::Format(_( "The sheet hierarchy has an infinite loop, halting recursive loads. file: "));
msg += STRUCT->m_FileName;
DisplayError( frame, msg );
noRecurse = false;
}
}
if( frame->LoadOneEEFile( STRUCT, STRUCT->m_FileName ) == TRUE && noRecurse)
{
LoadSubHierarchy( frame, STRUCT->EEDrawList );
}
}
else
DisplayError( frame, _( "No FileName in SubSheet" ) );
}
EEDrawList = EEDrawList->Pnext;
}
}
...@@ -35,7 +35,7 @@ char marq_bitmap[]= ...@@ -35,7 +35,7 @@ char marq_bitmap[]=
char marqERC_bitmap[]= char marqERC_bitmap[]=
{ {
8, 8, 0, 0, /* Dimensions x et y , offsets x et y du bitmap de marqueurs*/ 8, 8, 0, 0, /* Dimensions x et y , offsets x et y du bitmap de marqueurs*/
-1, /* Color: -1 = couleur non prcise */ -1, /* Color: -1 = couleur non pr�cis�e */
1,1,1,1,1,0,0,0, 1,1,1,1,1,0,0,0,
1,1,1,0,1,0,0,0, 1,1,1,0,1,0,0,0,
1,1,1,1,0,0,0,0, 1,1,1,1,0,0,0,0,
...@@ -129,18 +129,18 @@ wxString title; ...@@ -129,18 +129,18 @@ wxString title;
void WinEDA_DrawPanel::PrintPage(wxDC * DC, bool Print_Sheet_Ref, int PrintMask) void WinEDA_DrawPanel::PrintPage(wxDC * DC, bool Print_Sheet_Ref, int PrintMask)
/*******************************************************************************/ /*******************************************************************************/
{ {
BASE_SCREEN * screen, * oldscreen = m_Parent->GetScreen(); BASE_SCREEN * screen; // * oldscreen = m_Parent->GetScreen();
wxBeginBusyCursor(); wxBeginBusyCursor();
screen = m_Parent->m_CurrentScreen = ActiveScreen; ActiveScreen = screen = m_Parent->GetScreen();
RedrawStructList(this,DC, screen->EEDrawList, GR_COPY); RedrawStructList(this,DC, screen->EEDrawList, GR_COPY);
if ( Print_Sheet_Ref ) if ( Print_Sheet_Ref )
m_Parent->TraceWorkSheet(DC, screen, g_DrawMinimunLineWidth ); m_Parent->TraceWorkSheet(DC, screen, g_DrawMinimunLineWidth );
m_Parent->m_CurrentScreen = oldscreen; //m_Parent->m_CurrentSheet->m_s = oldscreen;
wxEndBusyCursor(); wxEndBusyCursor();
} }
...@@ -223,7 +223,7 @@ void DrawMarkerStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & ...@@ -223,7 +223,7 @@ void DrawMarkerStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint &
int DrawMode, int Color) int DrawMode, int Color)
/****************************************************************************************/ /****************************************************************************************/
{ {
#define WAR 1 // utilis aussi dans erc.cpp #define WAR 1 // utilis aussi dans erc.cpp
if( m_Type == MARQ_ERC ) if( m_Type == MARQ_ERC )
{ {
...@@ -420,6 +420,8 @@ int width = g_DrawMinimunLineWidth; ...@@ -420,6 +420,8 @@ int width = g_DrawMinimunLineWidth;
} }
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
{ {
DrawLabelStruct * Struct; DrawLabelStruct * Struct;
Struct = (DrawLabelStruct * ) DrawStruct; Struct = (DrawLabelStruct * ) DrawStruct;
...@@ -429,16 +431,6 @@ int width = g_DrawMinimunLineWidth; ...@@ -429,16 +431,6 @@ int width = g_DrawMinimunLineWidth;
break; break;
} }
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
{
DrawGlobalLabelStruct * Struct;
Struct = (DrawGlobalLabelStruct * ) DrawStruct;
Struct->m_Pos.x += dx; Struct->m_Pos.y += dy;
Struct->Draw(panel, DC, wxPoint(0,0),DrawMode,g_GhostColor);
Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy;
break;
}
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
{ {
DrawNoConnectStruct * Struct; DrawNoConnectStruct * Struct;
......
...@@ -24,10 +24,6 @@ ...@@ -24,10 +24,6 @@
#include "bitmaps.h" #include "bitmaps.h"
#include "eda_dde.h" #include "eda_dde.h"
/* Routines locales */
static void CreateScreens();
// Global variables // Global variables
wxString g_Main_Title( wxT( "EESchema" ) ); wxString g_Main_Title( wxT( "EESchema" ) );
...@@ -61,8 +57,6 @@ bool WinEDA_App::OnInit() ...@@ -61,8 +57,6 @@ bool WinEDA_App::OnInit()
if( argc > 1 ) if( argc > 1 )
FFileName = argv[1]; FFileName = argv[1];
CreateScreens();
/* init EESCHEMA */ /* init EESCHEMA */
GetSettings(); // read current setup GetSettings(); // read current setup
SeedLayers(); SeedLayers();
...@@ -106,25 +100,3 @@ bool WinEDA_App::OnInit() ...@@ -106,25 +100,3 @@ bool WinEDA_App::OnInit()
return TRUE; return TRUE;
} }
/******************************/
static void CreateScreens()
/******************************/
/*
* Fonction d'init des crans utiliss dans EESchema:
*/
{
/* creation des ecrans Sch , Lib */
if( ScreenSch == NULL )
ScreenSch = new SCH_SCREEN( SCHEMATIC_FRAME );
ScreenSch->m_FileName = g_DefaultSchematicFileName;
ScreenSch->m_Date = GenDate();
ActiveScreen = ScreenSch;
if( ScreenLib == NULL )
ScreenLib = new SCH_SCREEN( LIBEDITOR_FRAME );
ScreenLib->SetZoom( 4 );
ScreenLib->m_UndoRedoCountMax = 10;
}
...@@ -51,7 +51,7 @@ int WriteFichierERC = FALSE; ...@@ -51,7 +51,7 @@ int WriteFichierERC = FALSE;
* PIN_OPENEMITTER, PIN_NC * PIN_OPENEMITTER, PIN_NC
*/ */
#define OK 0 #define OK 0
#define WAR 1 // utilis aussi dans eeredraw #define WAR 1 // utilis aussi dans eeredraw
#define ERR 2 #define ERR 2
#define UNC 3 #define UNC 3
...@@ -185,7 +185,7 @@ void WinEDA_ErcFrame::ReBuildMatrixPanel() ...@@ -185,7 +185,7 @@ void WinEDA_ErcFrame::ReBuildMatrixPanel()
text_height = text->GetRect().GetHeight(); text_height = text->GetRect().GetHeight();
bitmap_size = MAX( bitmap_size, text_height ); bitmap_size = MAX( bitmap_size, text_height );
delete text; SAFE_DELETE( text );
// compute the Y pos interval: // compute the Y pos interval:
BoxMatrixMinSize.y = ( bitmap_size * (PIN_NMAX + 1) ) + 5; BoxMatrixMinSize.y = ( bitmap_size * (PIN_NMAX + 1) ) + 5;
...@@ -313,7 +313,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event ) ...@@ -313,7 +313,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
g_EESchemaVar.NbWarningErc = 0; g_EESchemaVar.NbWarningErc = 0;
/* Cleanup the entire hierarchy */ /* Cleanup the entire hierarchy */
EDA_ScreenList ScreenList( NULL ); EDA_ScreenList ScreenList;
for( SCH_SCREEN* Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() ) for( SCH_SCREEN* Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() )
{ {
...@@ -358,10 +358,12 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event ) ...@@ -358,10 +358,12 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
case NET_LABEL: case NET_LABEL:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_PINLABEL: case NET_PINLABEL:
case NET_GLOBLABEL: //not sure how to handle global labels -- they should be treated like other nets (just global!0
case NET_GLOBBUSLABELMEMBER:
break; break;
case NET_GLOBLABEL: case NET_HIERLABEL:
case NET_GLOBBUSLABELMEMBER: case NET_HIERBUSLABELMEMBER:
case NET_SHEETLABEL: case NET_SHEETLABEL:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
TestLabel( m_Parent->DrawPanel, &dc, NetItemRef, StartNet ); TestLabel( m_Parent->DrawPanel, &dc, NetItemRef, StartNet );
...@@ -398,7 +400,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event ) ...@@ -398,7 +400,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
if( WriteFichierERC == TRUE ) if( WriteFichierERC == TRUE )
{ {
wxString ErcFullFileName; wxString ErcFullFileName;
ErcFullFileName = ScreenSch->m_FileName; ErcFullFileName = g_RootSheet->m_s->m_FileName;
ChangeFileNameExt( ErcFullFileName, wxT( ".erc" ) ); ChangeFileNameExt( ErcFullFileName, wxT( ".erc" ) );
ErcFullFileName = EDA_FileSelector( _( "ERC file:" ), ErcFullFileName = EDA_FileSelector( _( "ERC file:" ),
wxEmptyString, /* Chemin par defaut */ wxEmptyString, /* Chemin par defaut */
...@@ -542,7 +544,7 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -542,7 +544,7 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
Marker->m_Type = MARQ_ERC; Marker->m_Type = MARQ_ERC;
Marker->m_MarkFlags = WAR; Marker->m_MarkFlags = WAR;
screen = NetItemRef->m_Screen; screen = NetItemRef->m_SheetList.LastScreen();
Marker->Pnext = screen->EEDrawList; Marker->Pnext = screen->EEDrawList;
screen->EEDrawList = Marker; screen->EEDrawList = Marker;
g_EESchemaVar.NbErrorErc++; g_EESchemaVar.NbErrorErc++;
...@@ -550,14 +552,14 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -550,14 +552,14 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
if( MinConn < 0 ) // Traitement des erreurs sur labels if( MinConn < 0 ) // Traitement des erreurs sur labels
{ {
if( (NetItemRef->m_Type == NET_GLOBLABEL) if( (NetItemRef->m_Type == NET_HIERLABEL)
|| (NetItemRef->m_Type == NET_GLOBBUSLABELMEMBER) ) || (NetItemRef->m_Type == NET_HIERBUSLABELMEMBER) )
{ {
Marker->m_Comment.Printf( _( "Warning GLabel %s not connected to SheetLabel" ), Marker->m_Comment.Printf( _( "Warning HLabel %s not connected to SheetLabel" ),
NetItemRef->m_Label->GetData() ); NetItemRef->m_Label->GetData() );
} }
else else
Marker->m_Comment.Printf( _( "Warning SheetLabel %s not connected to GLabel" ), Marker->m_Comment.Printf( _( "Warning SheetLabel %s not connected to HLabel" ),
NetItemRef->m_Label->GetData() ); NetItemRef->m_Label->GetData() );
if( screen == panel->GetScreen() ) if( screen == panel->GetScreen() )
...@@ -656,7 +658,7 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -656,7 +658,7 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
|| (NetItemRef->GetNet() != NetItemTst->GetNet()) ) // fin de net || (NetItemRef->GetNet() != NetItemTst->GetNet()) ) // fin de net
{ /* Fin de netcode trouve: Tst connexion minimum */ { /* Fin de netcode trouve: Tst connexion minimum */
if( (*MinConnexion < NET_NC ) if( (*MinConnexion < NET_NC )
&& (local_minconn < NET_NC ) ) /* pin non connecte ou non pilotee */ && (local_minconn < NET_NC ) ) /* pin non connecte ou non pilotee */
{ {
Diagnose( panel, DC, NetItemRef, NULL, local_minconn, WAR ); Diagnose( panel, DC, NetItemRef, NULL, local_minconn, WAR );
*MinConnexion = DRV; // inhibition autres messages de ce type pour ce net *MinConnexion = DRV; // inhibition autres messages de ce type pour ce net
...@@ -670,11 +672,13 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -670,11 +672,13 @@ static void TestOthersItems( WinEDA_DrawPanel* panel, wxDC* DC,
case NET_BUS: case NET_BUS:
case NET_JONCTION: case NET_JONCTION:
case NET_LABEL: case NET_LABEL:
case NET_GLOBLABEL: case NET_HIERLABEL:
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER: case NET_HIERBUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
case NET_SHEETLABEL: case NET_SHEETLABEL:
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
case NET_PINLABEL: case NET_PINLABEL:
break; break;
...@@ -719,7 +723,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName ) ...@@ -719,7 +723,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
DrawMarkerStruct* Marker; DrawMarkerStruct* Marker;
char Line[256]; char Line[256];
static FILE* OutErc; static FILE* OutErc;
DrawSheetStruct* Sheet; DrawSheetList* Sheet;
wxString msg; wxString msg;
if( ( OutErc = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL ) if( ( OutErc = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
...@@ -730,19 +734,20 @@ static bool WriteDiagnosticERC( const wxString& FullFileName ) ...@@ -730,19 +734,20 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
fprintf( OutErc, "%s (%s)\n", CONV_TO_UTF8( msg ), Line ); fprintf( OutErc, "%s (%s)\n", CONV_TO_UTF8( msg ), Line );
EDA_ScreenList ScreenList( NULL ); EDA_SheetList SheetList( NULL );
for( SCH_SCREEN* Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() ) for( Sheet = SheetList.GetFirst(); Sheet != NULL; Sheet = SheetList.GetNext() )
{ {
Sheet = (DrawSheetStruct*) Screen; if(Sheet->Last() == g_RootSheet){
msg.Printf( _( "\n***** Sheet Root\n" ) );
msg.Printf( _( "\n***** Sheet %d (%s)\n" ), }else{
Sheet->m_SheetNumber, wxString str = Sheet->Path();
Screen == ScreenSch ? _( "Root" ) : Sheet->m_SheetName.GetData() ); msg.Printf( _("\n***** Sheet %s\n"), str.GetData() );
}
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) ); fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) );
DrawStruct = Screen->EEDrawList; DrawStruct = Sheet->LastDrawList();
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE )
...@@ -770,7 +775,18 @@ static bool WriteDiagnosticERC( const wxString& FullFileName ) ...@@ -770,7 +775,18 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
return TRUE; return TRUE;
} }
bool TestLabel_( ObjetNetListStruct* a, ObjetNetListStruct* b )
{
int at = a->m_Type;
int bt = b->m_Type;
if( (at == NET_HIERLABEL || at == NET_HIERBUSLABELMEMBER)
&&(bt == NET_SHEETLABEL || bt == NET_SHEETBUSLABELMEMBER) ){
if( a->m_SheetList == b->m_SheetListInclude ){
return true; //connected!
}
}
return false; //these two are unconnected
}
/***********************************************************************/ /***********************************************************************/
void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC, void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC,
ObjetNetListStruct* NetItemRef, ObjetNetListStruct* StartNet ) ObjetNetListStruct* NetItemRef, ObjetNetListStruct* StartNet )
...@@ -799,66 +815,16 @@ void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -799,66 +815,16 @@ void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC,
|| ( NetItemRef->GetNet() != NetItemTst->GetNet() ) ) || ( NetItemRef->GetNet() != NetItemTst->GetNet() ) )
{ {
/* Fin de netcode trouve */ /* Fin de netcode trouve */
if( erc ) if( erc ){
{
/* GLabel ou SheetLabel orphelin */ /* GLabel ou SheetLabel orphelin */
Diagnose( panel, DC, NetItemRef, NULL, -1, WAR ); Diagnose( panel, DC, NetItemRef, NULL, -1, WAR );
} }
return; return;
} }
if(TestLabel_(NetItemRef, NetItemTst))
if( (NetItemRef->m_Type == NET_GLOBLABEL)
|| (NetItemRef->m_Type == NET_GLOBBUSLABELMEMBER) )
{
switch( NetItemTst->m_Type )
{
case NET_SEGMENT:
case NET_BUS:
case NET_JONCTION:
case NET_LABEL:
case NET_GLOBLABEL:
case NET_BUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER:
case NET_PINLABEL:
case NET_NOCONNECT:
case NET_PIN:
break;
case NET_SHEETBUSLABELMEMBER:
case NET_SHEETLABEL:
/* Tst si le GLabel est bien dans la bonne sousfeuille */
if( NetItemRef->m_SheetNumber == NetItemTst->m_NumInclude )
{
erc = 0; erc = 0;
} //same thing, different order.
break; if(TestLabel_(NetItemTst, NetItemRef))
}
}
else
{
switch( NetItemTst->m_Type )
{
case NET_SEGMENT:
case NET_BUS:
case NET_JONCTION:
case NET_LABEL:
case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER:
case NET_SHEETLABEL:
case NET_PINLABEL:
case NET_NOCONNECT:
case NET_PIN:
break;
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
/* Tst si le GLabel est bien dans la bonne sous-feuille */
if( NetItemTst->m_SheetNumber == NetItemRef->m_NumInclude )
{
erc = 0; erc = 0;
} }
break;
}
}
}
} }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
/****************************************************************/ /****************************************************************/
/* Commands to save shepatic project or the current page. /* Commands to save project or the current page.
*/ */
{ {
int id = event.GetId(); int id = event.GetId();
...@@ -28,7 +28,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) ...@@ -28,7 +28,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_SAVE_PROJECT: /* Update Schematic File */ case ID_SAVE_PROJECT: /* Update Schematic File */
SaveProject( this ); SaveProject( );
break; break;
case ID_SAVE_ONE_SHEET: /* Update Schematic File */ case ID_SAVE_ONE_SHEET: /* Update Schematic File */
...@@ -47,26 +47,25 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) ...@@ -47,26 +47,25 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
/******************************************************************************************/ /******************************************************************************************/
bool WinEDA_SchematicFrame::LoadOneSheet( SCH_SCREEN* screen, const wxString& filename ) //bool WinEDA_SchematicFrame::LoadOneSheet(DrawSheetStruct* sheet, const wxString& filename )
/******************************************************************************************/ /******************************************************************************************/
{ //{
// return FALSE;
//when is this used? and why?
/*
//this must be called with a non-null pointer screen pointer, clearly.
//also note that this is for reading in a *root* file
wxString FullFileName = filename; wxString FullFileName = filename;
if( screen->EEDrawList != NULL )
{
if( !IsOK( this, _( "Clear SubHierarchy ?" ) ) )
return FALSE;
}
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
{ {
wxString mask; wxString mask;
mask = wxT( "*" ) + g_SchExtBuffer; mask = wxT( "*" ) + g_SchExtBuffer;
FullFileName = EDA_FileSelector( _( "Schematic files:" ), FullFileName = EDA_FileSelector( _( "Schematic files:" ),
wxEmptyString, /* default path */ wxEmptyString, //default path
screen->m_FileName, /* default filename */ sheet->m_s->m_FileName,// default filename
g_SchExtBuffer, /* extension par defaut */ g_SchExtBuffer, // extension par defaut
mask, /* Masque d'affichage */ mask, // Masque d'affichage
this, this,
wxFD_OPEN, wxFD_OPEN,
FALSE FALSE
...@@ -76,52 +75,212 @@ bool WinEDA_SchematicFrame::LoadOneSheet( SCH_SCREEN* screen, const wxString& fi ...@@ -76,52 +75,212 @@ bool WinEDA_SchematicFrame::LoadOneSheet( SCH_SCREEN* screen, const wxString& fi
} }
ClearProjectDrawList( screen, TRUE ); ClearProjectDrawList( screen, TRUE );
printf("in LoadOneScreen setting screen filename: %s \n", (const char*) FullFileName.mb_str() );
screen->m_FileName = FullFileName; screen->m_FileName = FullFileName;
LoadOneEEFile( screen, FullFileName ); LoadDrawSheet( DrawSheetStruct * sheet, filename);
screen->SetModify(); screen->SetModify();
if( GetScreen() == screen ) if( GetScreen() == screen )
Refresh( TRUE ); Refresh( TRUE );
return TRUE; return TRUE;
*/
//}
/************************************************************************************/
int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNew )
/************************************************************************************/
{
/*
* Load an entire project
* ( schematic root file and its subhierarchies, the configuration and the libs
* which are not already loaded)
*/
SCH_SCREEN* screen;
wxString FullFileName, msg;
bool LibCacheExist = FALSE;
EDA_ScreenList ScreenList;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{
if( screen->IsModify() )
break;
}
if( screen )
{
if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) )
return FALSE;
if( g_RootSheet->m_s->m_FileName != g_DefaultSchematicFileName )
SetLastProject( g_RootSheet->m_s->m_FileName );
}
FullFileName = FileName;
if( ( FullFileName.IsEmpty() ) && !IsNew )
{
wxString mask = wxT( "*" ) + g_SchExtBuffer;
FullFileName = EDA_FileSelector( _( "Schematic files:" ),
wxEmptyString, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */
g_SchExtBuffer, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE
);
if( FullFileName.IsEmpty() )
return FALSE;
}
if(g_RootSheet){
SAFE_DELETE(g_RootSheet);
}
CreateScreens();
screen = (SCH_SCREEN*)GetScreen();
wxSetWorkingDirectory( wxPathOnly( FullFileName ) );
GetScreen()->m_FileName = FullFileName;
g_RootSheet->m_FileName = FullFileName;
Affiche_Message( wxEmptyString );
MsgPanel->EraseMsgBox();
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );
GetScreen()->ClrModify();
//m_CurrentSheet->m_s->Pnext = NULL; should be by default
if( IsNew )
{
screen->m_CurrentSheetDesc = &g_Sheet_A4;
screen->SetZoom( 32 );
screen->m_ScreenNumber = screen->m_NumberOfScreen = 1;
screen->m_Title = wxT( "noname.sch" );
GetScreen()->m_FileName = screen->m_Title;
screen->m_Company.Empty();
screen->m_Commentaire1.Empty();
screen->m_Commentaire2.Empty();
screen->m_Commentaire3.Empty();
screen->m_Commentaire4.Empty();
Read_Config( wxEmptyString, TRUE );
Zoom_Automatique( TRUE );
ReDrawPanel();
return 1;
}
// Rechargement de la configuration:
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
PrintMsg( msg );
Read_Config( wxEmptyString, FALSE );
// Delete old caches.
LibraryStruct* nextlib, * lib = g_LibraryList;
for( ; lib != NULL; lib = nextlib )
{
nextlib = lib->m_Pnext;
if( lib->m_IsLibCache )
FreeCmpLibrary( this, lib->m_Name );
}
if( IsNew )
{
ReDrawPanel();
return 1;
}
// Loading the project library cache
wxString FullLibName;
wxString shortfilename;
wxSplitPath( g_RootSheet->m_s->m_FileName, NULL, &shortfilename, NULL );
FullLibName << wxT( "." ) << STRING_DIR_SEP << shortfilename << wxT( ".cache" ) <<
g_LibExtBuffer;
if( wxFileExists( FullLibName ) )
{
wxString libname;
libname = FullLibName;
ChangeFileNameExt( libname, wxEmptyString );
msg = wxT( "Load " ) + FullLibName;
LibraryStruct* LibCache = LoadLibraryName( this, FullLibName, libname );
if( LibCache )
{
LibCache->m_IsLibCache = TRUE;
msg += wxT( " OK" );
}
else
msg += wxT( " ->Error" );
PrintMsg( msg );
LibCacheExist = TRUE;
}
if( !wxFileExists( g_RootSheet->m_s->m_FileName ) && !LibCacheExist ) // Nouveau projet prpbablement
{
msg.Printf( _( "File %s not found (new project ?)" ),
g_RootSheet->m_s->m_FileName.GetData() );
DisplayInfo( this, msg, 20 );
return -1;
}
//load the project.
SAFE_DELETE(g_RootSheet->m_s);
if(!g_RootSheet->Load(this))
return 0;
/* Reaffichage ecran de base (ROOT) si necessaire */
ActiveScreen = GetScreen();
Zoom_Automatique( FALSE );
DrawPanel->Refresh( TRUE );
return 1;
} }
/**********************************************************/
SCH_SCREEN * WinEDA_SchematicFrame::CreateNewScreen(
SCH_SCREEN * OldScreen, int TimeStamp)
/**********************************************************/
/* Routine de creation ( par allocation memoire ) d'un nouvel ecran
cet ecran est en chainage arriere avec OldScreen
la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
*/
{
SCH_SCREEN * NewScreen;
NewScreen = new SCH_SCREEN(SCHEMATIC_FRAME);
NewScreen->SetRefreshReq();
if(OldScreen) NewScreen->m_Company = OldScreen->m_Company;
NewScreen->m_TimeStamp = TimeStamp;
NewScreen->Pback = OldScreen;
return(NewScreen);
}
/****************************************************/ /****************************************************/
void SaveProject( WinEDA_SchematicFrame* frame ) void WinEDA_SchematicFrame::SaveProject( )
/****************************************************/ /****************************************************/
/* Sauvegarde toutes les feuilles du projet /* Sauvegarde toutes les feuilles du projet
* et cre une librairie archive des composants, de nom <root_name>.chche.lib * et cre une librairie archive des composants, de nom <root_name>.chche.lib
*/ */
{ {
SCH_SCREEN* screen_tmp; SCH_SCREEN* screen_tmp, *screen;
wxString LibArchiveFileName; wxString LibArchiveFileName;
if( frame == NULL ) screen_tmp = (SCH_SCREEN*)GetScreen(); //save...
return;
screen_tmp = frame->GetScreen();
EDA_ScreenList ScreenList( NULL ); EDA_ScreenList ScreenList;
for( ActiveScreen = ScreenList.GetFirst(); for( screen = ScreenList.GetFirst(); screen != NULL;
ActiveScreen != NULL; screen = ScreenList.GetNext() )
ActiveScreen = ScreenList.GetNext() )
{ {
frame->m_CurrentScreen = ActiveScreen; printf("SaveEEFile, %s\n", (const char*)screen->m_FileName.mb_str() );
frame->SaveEEFile( NULL, FILE_SAVE_AS ); SaveEEFile( screen, FILE_SAVE_AS );
} }
frame->m_CurrentScreen = ActiveScreen = screen_tmp;
/* Creation du fichier d'archivage composants en repertoire courant */ /* Creation du fichier d'archivage composants en repertoire courant */
LibArchiveFileName = MakeFileName( wxEmptyString, ScreenSch->m_FileName, wxEmptyString ); LibArchiveFileName = MakeFileName( wxEmptyString, GetScreen()->m_FileName, wxEmptyString );
ChangeFileNameExt( LibArchiveFileName, wxEmptyString ); ChangeFileNameExt( LibArchiveFileName, wxEmptyString );
/* mise a jour extension */ /* mise a jour extension */
LibArchiveFileName += wxT( ".cache" ) + g_LibExtBuffer; LibArchiveFileName += wxT( ".cache" ) + g_LibExtBuffer;
LibArchive( frame, LibArchiveFileName ); LibArchive( this, LibArchiveFileName );
} }
...@@ -132,10 +291,14 @@ int CountCmpNumber() ...@@ -132,10 +291,14 @@ int CountCmpNumber()
/* Routine retournant le nombre de composants dans le schema, /* Routine retournant le nombre de composants dans le schema,
* powers non comprises */ * powers non comprises */
{ {
return g_RootSheet->ComponentCount();
/*
BASE_SCREEN* Window; BASE_SCREEN* Window;
EDA_BaseStruct* Phead; EDA_BaseStruct* Phead;
int Nb = 0; int Nb = 0;
Window = ScreenSch; Window = ScreenSch;
while( Window ) while( Window )
{ {
...@@ -153,4 +316,5 @@ int CountCmpNumber() ...@@ -153,4 +316,5 @@ int CountCmpNumber()
} }
return Nb; return Nb;
*/
} }
This diff is collapsed.
...@@ -72,6 +72,7 @@ typedef enum { ...@@ -72,6 +72,7 @@ typedef enum {
LAYER_JUNCTION, LAYER_JUNCTION,
LAYER_LOCLABEL, LAYER_LOCLABEL,
LAYER_GLOBLABEL, LAYER_GLOBLABEL,
LAYER_HIERLABEL,
LAYER_PINFUN, LAYER_PINFUN,
LAYER_PINNUM, LAYER_PINNUM,
LAYER_PINNAM, LAYER_PINNAM,
...@@ -147,7 +148,7 @@ extern int g_HVLines; ...@@ -147,7 +148,7 @@ extern int g_HVLines;
eda_global int g_PlotPSColorOpt; // True = plot postcript color (see plotps.cpp) eda_global int g_PlotPSColorOpt; // True = plot postcript color (see plotps.cpp)
// Gestion de diverses variables, options... devant etre mmorises mais // Gestion de diverses variables, options... devant etre m�moris�es mais
// Remises a 0 lors d'un rechargement de projetc // Remises a 0 lors d'un rechargement de projetc
struct EESchemaVariables struct EESchemaVariables
{ {
...@@ -164,7 +165,7 @@ eda_global int g_PrintFillMask; /* pour les options "FILL", ...@@ -164,7 +165,7 @@ eda_global int g_PrintFillMask; /* pour les options "FILL",
eda_global wxString g_CurrentViewLibraryName; /* nom de la librairie en cours d'examen */ eda_global wxString g_CurrentViewLibraryName; /* nom de la librairie en cours d'examen */
eda_global wxString g_CurrentViewComponentName; /* nom du le composant en cours d'examen */ eda_global wxString g_CurrentViewComponentName; /* nom du le composant en cours d'examen */
eda_global int g_ViewConvert; /* Vue normal / convert */ eda_global int g_ViewConvert; /* Vue normal / convert */
eda_global int g_ViewUnit; /* unit a afficher (A, B ..) */ eda_global int g_ViewUnit; /* unit� a afficher (A, B ..) */
/* Variables globales pour Schematic Edit */ /* Variables globales pour Schematic Edit */
eda_global int g_DefaultTextLabelSize eda_global int g_DefaultTextLabelSize
...@@ -218,7 +219,8 @@ struct HPGL_Pen_Descr_Struct ...@@ -218,7 +219,8 @@ struct HPGL_Pen_Descr_Struct
eda_global HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr; eda_global HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
/* Ecrans usuels */ /* Ecrans usuels */
eda_global SCH_SCREEN * ScreenSch; //eda_global SCH_SCREEN * ScreenSch;
eda_global DrawSheetStruct* g_RootSheet;
eda_global SCH_SCREEN * ScreenLib; eda_global SCH_SCREEN * ScreenLib;
/*************************************/ /*************************************/
...@@ -253,7 +255,7 @@ eda_global wxString g_NetListerCommandLine; // ligne de commande pour l'appel au ...@@ -253,7 +255,7 @@ eda_global wxString g_NetListerCommandLine; // ligne de commande pour l'appel au
eda_global LayerStruct g_LayerDescr; /* couleurs des couches */ eda_global LayerStruct g_LayerDescr; /* couleurs des couches */
eda_global bool g_EditPinByPinIsOn /* bool: TRUE si edition des pins pin a pin au lieu */ eda_global bool g_EditPinByPinIsOn /* bool: TRUE si edition des pins pin a pin au lieu */
#ifdef MAIN /* de l'edition simultane des pins de meme coordonnes */ #ifdef MAIN /* de l'edition simultan�e des pins de meme coordonn�es */
= FALSE = FALSE
#endif #endif
; ;
......
...@@ -178,7 +178,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -178,7 +178,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp; DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
DrawLibItem = new EDA_SchComponentStruct( m_CurrentScreen->m_Curseur ); DrawLibItem = new EDA_SchComponentStruct( GetScreen()->m_Curseur );
DrawLibItem->m_Multi = 1;/* Selection de l'unite 1 dans le boitier */ DrawLibItem->m_Multi = 1;/* Selection de l'unite 1 dans le boitier */
DrawLibItem->m_Convert = 1; DrawLibItem->m_Convert = 1;
DrawLibItem->m_ChipName = Name; DrawLibItem->m_ChipName = Name;
...@@ -209,7 +209,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -209,7 +209,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Entry->m_Prefix.m_Pos.y + DrawLibItem->m_Pos.y; Entry->m_Prefix.m_Pos.y + DrawLibItem->m_Pos.y;
DrawLibItem->m_Field[REFERENCE].m_Orient = Entry->m_Prefix.m_Orient; DrawLibItem->m_Field[REFERENCE].m_Orient = Entry->m_Prefix.m_Orient;
DrawLibItem->m_Field[REFERENCE].m_Size = Entry->m_Prefix.m_Size; DrawLibItem->m_Field[REFERENCE].m_Size = Entry->m_Prefix.m_Size;
DrawLibItem->m_Field[REFERENCE].m_Text = msg; DrawLibItem->m_PrefixString = Entry->m_Prefix.m_Text;
DrawLibItem->m_Field[REFERENCE].m_Attributs = Entry->m_Prefix.m_Attributs; DrawLibItem->m_Field[REFERENCE].m_Attributs = Entry->m_Prefix.m_Attributs;
DrawLibItem->m_Field[REFERENCE].m_HJustify = Entry->m_Prefix.m_HJustify; DrawLibItem->m_Field[REFERENCE].m_HJustify = Entry->m_Prefix.m_HJustify;
DrawLibItem->m_Field[REFERENCE].m_VJustify = Entry->m_Prefix.m_VJustify; DrawLibItem->m_Field[REFERENCE].m_VJustify = Entry->m_Prefix.m_VJustify;
...@@ -253,14 +253,14 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -253,14 +253,14 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
wxPoint move_vector; wxPoint move_vector;
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*)
panel->m_Parent->m_CurrentScreen->GetCurItem(); panel->m_Parent->GetScreen()->GetCurItem();
/* Effacement du composant */ /* Effacement du composant */
if( erase ) if( erase )
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
move_vector.x = panel->m_Parent->m_CurrentScreen->m_Curseur.x - DrawLibItem->m_Pos.x; move_vector.x = panel->m_Parent->GetScreen()->m_Curseur.x - DrawLibItem->m_Pos.x;
move_vector.y = panel->m_Parent->m_CurrentScreen->m_Curseur.y - DrawLibItem->m_Pos.y; move_vector.y = panel->m_Parent->GetScreen()->m_Curseur.y - DrawLibItem->m_Pos.y;
MoveOneStruct( DrawLibItem, move_vector ); MoveOneStruct( DrawLibItem, move_vector );
DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( panel, DC, DrawLibItem, 0, 0 );
...@@ -301,7 +301,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( ...@@ -301,7 +301,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
} }
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -314,12 +314,12 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -314,12 +314,12 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
*/ */
{ {
EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*) EDA_SchComponentStruct* DrawLibItem = (EDA_SchComponentStruct*)
Panel->m_Parent->m_CurrentScreen->GetCurItem(); Panel->m_Parent->GetScreen()->GetCurItem();
if( DrawLibItem->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */ if( DrawLibItem->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
{ {
DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 ); DrawStructsInGhost( Panel, DC, DrawLibItem, 0, 0 );
delete DrawLibItem; SAFE_DELETE( DrawLibItem );
} }
else if( DrawLibItem ) /* Deplacement ancien composant en cours */ else if( DrawLibItem ) /* Deplacement ancien composant en cours */
{ {
...@@ -338,7 +338,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -338,7 +338,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
DrawLibItem->m_Flags = 0; DrawLibItem->m_Flags = 0;
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
Panel->m_Parent->m_CurrentScreen->SetCurItem( NULL ); Panel->m_Parent->GetScreen()->SetCurItem( NULL );
} }
...@@ -385,7 +385,7 @@ void WinEDA_SchematicFrame::SelPartUnit( EDA_SchComponentStruct* DrawComponent, ...@@ -385,7 +385,7 @@ void WinEDA_SchematicFrame::SelPartUnit( EDA_SchComponentStruct* DrawComponent,
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -426,7 +426,7 @@ void WinEDA_SchematicFrame::ConvertPart( EDA_SchComponentStruct* DrawComponent, ...@@ -426,7 +426,7 @@ void WinEDA_SchematicFrame::ConvertPart( EDA_SchComponentStruct* DrawComponent,
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -471,18 +471,19 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component, ...@@ -471,18 +471,19 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component,
if( Component->m_Flags == 0 ) if( Component->m_Flags == 0 )
{ {
if( g_ItemToUndoCopy ) if( g_ItemToUndoCopy ){
delete g_ItemToUndoCopy; SAFE_DELETE( g_ItemToUndoCopy );
}
g_ItemToUndoCopy = Component->GenCopy(); g_ItemToUndoCopy = Component->GenCopy();
} }
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
m_CurrentScreen->m_Curseur = Component->m_Pos; GetScreen()->m_Curseur = Component->m_Pos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp; DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
m_CurrentScreen->SetCurItem( Component ); GetScreen()->SetCurItem( Component );
OldPos = Component->m_Pos; OldPos = Component->m_Pos;
memcpy( OldTransMat, Component->m_Transform, sizeof(OldTransMat) ); memcpy( OldTransMat, Component->m_Transform, sizeof(OldTransMat) );
......
This diff is collapsed.
...@@ -145,14 +145,14 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -145,14 +145,14 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive * Commands are case insensitive
*/ */
{ {
bool ItemInEdit = m_CurrentScreen->GetCurItem() bool ItemInEdit = GetScreen()->GetCurItem()
&& m_CurrentScreen->GetCurItem()->m_Flags; && GetScreen()->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
if( hotkey == 0 ) if( hotkey == 0 )
return; return;
wxPoint MousePos = m_CurrentScreen->m_MousePosition; wxPoint MousePos = GetScreen()->m_MousePosition;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...) // Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 ) if( (hotkey & GR_KB_CTRL) != 0 )
...@@ -179,7 +179,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -179,7 +179,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */ case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
...@@ -217,9 +217,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -217,9 +217,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
RefreshToolBar = LocateAndDeleteItem( this, DC ); RefreshToolBar = LocateAndDeleteItem( this, DC );
m_CurrentScreen->SetModify(); GetScreen()->SetModify();
m_CurrentScreen->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
break; break;
case HK_REPEAT_LAST: case HK_REPEAT_LAST:
...@@ -276,11 +276,11 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -276,11 +276,11 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( DrawStruct == NULL ) if( DrawStruct == NULL )
{ {
DrawStruct = PickStruct( GetScreen()->m_Curseur, DrawStruct = PickStruct( GetScreen()->m_Curseur,
GetScreen()->EEDrawList, LIBITEM | TEXTITEM | LABELITEM ); GetScreen(), LIBITEM | TEXTITEM | LABELITEM );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
} }
...@@ -301,6 +301,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -301,6 +301,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_HIER_LABEL_STRUCT_TYPE:
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
{ {
SaveCopyInUndoList( DrawStruct, IS_CHANGED ); SaveCopyInUndoList( DrawStruct, IS_CHANGED );
...@@ -317,7 +318,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -317,7 +318,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component) case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
...@@ -332,7 +333,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -332,7 +333,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_MIRROR_X_COMPONENT: // Mirror X (Component) case HK_MIRROR_X_COMPONENT: // Mirror X (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
...@@ -347,7 +348,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -347,7 +348,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component) case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct ) if( DrawStruct )
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
...@@ -357,7 +358,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -357,7 +358,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
} }
CmpRotationMiroir( CmpRotationMiroir(
(EDA_SchComponentStruct*) DrawStruct, DC, CMP_NORMAL ); (EDA_SchComponentStruct*) DrawStruct, DC, CMP_NORMAL );
TestDanglingEnds( m_CurrentScreen->EEDrawList, DC ); TestDanglingEnds( (SCH_SCREEN*)GetScreen()->EEDrawList, DC );
} }
break; break;
...@@ -366,10 +367,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -366,10 +367,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if( DrawStruct && (DrawStruct->m_Flags ==0) ) if( DrawStruct && (DrawStruct->m_Flags ==0) )
{ {
m_CurrentScreen->SetCurItem( DrawStruct ); ((SCH_SCREEN*)GetScreen())->SetCurItem( DrawStruct );
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent ); wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event ); wxPostEvent( this, event );
...@@ -379,7 +380,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -379,7 +380,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if(DrawStruct) if(DrawStruct)
{ {
EditComponentValue( EditComponentValue(
...@@ -391,7 +392,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -391,7 +392,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( ItemInEdit ) if( ItemInEdit )
break; break;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
if(DrawStruct) if(DrawStruct)
{ {
EditComponentFootprint( EditComponentFootprint(
...@@ -414,14 +415,14 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -414,14 +415,14 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive * Commands are case insensitive
*/ */
{ {
bool ItemInEdit = m_CurrentScreen->GetCurItem() bool ItemInEdit = GetScreen()->GetCurItem()
&& m_CurrentScreen->GetCurItem()->m_Flags; && GetScreen()->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
if( hotkey == 0 ) if( hotkey == 0 )
return; return;
wxPoint MousePos = m_CurrentScreen->m_MousePosition; wxPoint MousePos = GetScreen()->m_MousePosition;
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor(); LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
...@@ -448,7 +449,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -448,7 +449,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */ case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
......
This diff is collapsed.
...@@ -41,7 +41,7 @@ void FreeLibraryEntry( LibCmpEntry* Entry ) ...@@ -41,7 +41,7 @@ void FreeLibraryEntry( LibCmpEntry* Entry )
/* Used by PQFreeFunc() to delete all entries /* Used by PQFreeFunc() to delete all entries
*/ */
{ {
delete Entry; SAFE_DELETE( Entry );
} }
...@@ -197,7 +197,7 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct() ...@@ -197,7 +197,7 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
while( field ) while( field )
{ {
TempField = field; field = (LibDrawField*) field->Pnext; TempField = field; field = (LibDrawField*) field->Pnext;
delete TempField; SAFE_DELETE( TempField );
} }
/* suppression des elements dependants */ /* suppression des elements dependants */
...@@ -205,7 +205,7 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct() ...@@ -205,7 +205,7 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
while( DrawItem ) while( DrawItem )
{ {
NextDrawItem = DrawItem->Next(); NextDrawItem = DrawItem->Next();
delete DrawItem; SAFE_DELETE( DrawItem );
DrawItem = NextDrawItem; DrawItem = NextDrawItem;
} }
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -35,7 +35,7 @@ bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu ...@@ -35,7 +35,7 @@ bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu
/********************************************************************************/ /********************************************************************************/
{ {
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor(); LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
if ( CurrentLibEntry == NULL ) return true; if ( CurrentLibEntry == NULL ) return true;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment