Minor EESchema improvements.

* Rename sch_item files to sch_junction.
* Make global variable g_ItemToRepeat a private member of SCH_EDIT_FRAME
  object.
* Encapsulate SCH_SCREEN reference count member.
This commit is contained in:
Wayne Stambaugh 2011-01-12 16:47:54 -05:00
parent 2dd1287141
commit f9af593ee3
31 changed files with 116 additions and 95 deletions

View File

@ -61,7 +61,7 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop!
screen->AddToDrawList( this );
g_ItemToRepeat = this;
frame->SetRepeatItem( this );
frame->SaveCopyInUndoList( this, UR_NEW );
}

View File

@ -119,7 +119,7 @@ set(EESCHEMA_SRCS
sch_bus_entry.cpp
sch_component.cpp
sch_field.cpp
sch_items.cpp
sch_junction.cpp
sch_line.cpp
sch_marker.cpp
sch_no_connect.cpp

View File

@ -17,7 +17,7 @@
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_text.h"

View File

@ -15,7 +15,7 @@
#include "general.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_polyline.h"
@ -183,7 +183,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
GetScreen()->SetCurItem( newsegment );
DrawPanel->ManageCurseur = DrawSegment;
DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine;
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
}
else // A segment is in progress: terminates the current segment and add a new segment.
{
@ -331,8 +331,8 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
{
if( segment->m_Flags )
{
if( !g_ItemToRepeat )
g_ItemToRepeat = segment;
if( !m_itemToRepeat )
m_itemToRepeat = segment;
}
segment->m_Flags = 0;
@ -468,7 +468,7 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras
*/
void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
{
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
if( ( GetScreen()->GetCurItem() == NULL )
|| ( ( GetScreen()->GetCurItem()->m_Flags & IS_NEW ) == 0 ) )
@ -502,7 +502,7 @@ SCH_JUNCTION* SCH_EDIT_FRAME::CreateNewJunctionStruct( wxDC* DC,
NewJunction = new SCH_JUNCTION( pos );
g_ItemToRepeat = NewJunction;
m_itemToRepeat = NewJunction;
DrawPanel->CursorOff( DC ); // Erase schematic cursor
NewJunction->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
@ -525,7 +525,7 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::CreateNewNoConnectStruct( wxDC* DC )
SCH_NO_CONNECT* NewNoConnect;
NewNoConnect = new SCH_NO_CONNECT( GetScreen()->m_Curseur );
g_ItemToRepeat = NewNoConnect;
m_itemToRepeat = NewNoConnect;
DrawPanel->CursorOff( DC ); // Erase schematic cursor
NewNoConnect->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
@ -555,7 +555,11 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->Refresh();
}
else
g_ItemToRepeat = NULL;
{
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
parent->SetRepeatItem( NULL );
}
/* Clear m_Flags which is used in edit functions: */
SCH_ITEM* item = Screen->GetDrawItems();
@ -574,40 +578,40 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
*/
void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
{
if( g_ItemToRepeat == NULL )
if( m_itemToRepeat == NULL )
return;
g_ItemToRepeat = g_ItemToRepeat->Clone();
m_itemToRepeat = m_itemToRepeat->Clone();
if( g_ItemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode
if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode
{
wxPoint pos = GetScreen()->m_Curseur - ( (SCH_COMPONENT*) g_ItemToRepeat )->m_Pos;
g_ItemToRepeat->m_Flags = IS_NEW;
( (SCH_COMPONENT*) g_ItemToRepeat )->m_TimeStamp = GetTimeStamp();
g_ItemToRepeat->Move( pos );
g_ItemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
StartMovePart( (SCH_COMPONENT*) g_ItemToRepeat, DC );
wxPoint pos = GetScreen()->m_Curseur - ( (SCH_COMPONENT*) m_itemToRepeat )->m_Pos;
m_itemToRepeat->m_Flags = IS_NEW;
( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetTimeStamp();
m_itemToRepeat->Move( pos );
m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
StartMovePart( (SCH_COMPONENT*) m_itemToRepeat, DC );
return;
}
g_ItemToRepeat->Move( wxPoint( g_RepeatStep.GetWidth(), g_RepeatStep.GetHeight() ) );
m_itemToRepeat->Move( wxPoint( g_RepeatStep.GetWidth(), g_RepeatStep.GetHeight() ) );
if( g_ItemToRepeat->Type() == SCH_TEXT_T
|| g_ItemToRepeat->Type() == SCH_LABEL_T
|| g_ItemToRepeat->Type() == SCH_HIERARCHICAL_LABEL_T
|| g_ItemToRepeat->Type() == SCH_GLOBAL_LABEL_T )
if( m_itemToRepeat->Type() == SCH_TEXT_T
|| m_itemToRepeat->Type() == SCH_LABEL_T
|| m_itemToRepeat->Type() == SCH_HIERARCHICAL_LABEL_T
|| m_itemToRepeat->Type() == SCH_GLOBAL_LABEL_T )
{
( (SCH_TEXT*) g_ItemToRepeat )->IncrementLabel();
( (SCH_TEXT*) m_itemToRepeat )->IncrementLabel();
}
if( g_ItemToRepeat )
if( m_itemToRepeat )
{
g_ItemToRepeat->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( g_ItemToRepeat );
m_itemToRepeat->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( m_itemToRepeat );
TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
g_ItemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
SaveCopyInUndoList( g_ItemToRepeat, UR_NEW );
g_ItemToRepeat->m_Flags = 0;
m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
SaveCopyInUndoList( m_itemToRepeat, UR_NEW );
m_itemToRepeat->m_Flags = 0;
}
}

View File

@ -42,7 +42,9 @@ static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC )
}
}
g_ItemToRepeat = NULL;
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
parent->SetRepeatItem( NULL );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
}

View File

@ -13,7 +13,7 @@
#include "protos.h"
#include "netlist.h"
#include "sch_bus_entry.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"

View File

@ -11,7 +11,7 @@
#include "general.h"
#include "protos.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"
#include "sch_sheet.h"
#include "sch_text.h"
@ -312,7 +312,7 @@ bool LocateAndDeleteItem( SCH_EDIT_FRAME* frame, wxDC* DC )
if( DelStruct )
{
g_ItemToRepeat = NULL;
frame->SetRepeatItem( NULL );
DeleteStruct( frame->DrawPanel, DC, DelStruct );
frame->TestDanglingEnds( frame->GetScreen()->GetDrawItems(), DC );
frame->OnModify( );

View File

@ -36,7 +36,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
if( TextStruct == NULL )
return;
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
if( (TextStruct->m_Flags & IS_NEW) == 0 )
{
@ -120,7 +120,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
{
SCH_TEXT* NewText = NULL;
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
switch( type )
{
@ -215,8 +215,9 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
{
BASE_SCREEN* screen = Panel->GetScreen();
SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem();
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
g_ItemToRepeat = NULL;
parent->SetRepeatItem( NULL );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
@ -335,7 +336,7 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
DeleteStruct( DrawPanel, DC, Text ); // old text is really saved in
// undo list
GetScreen()->SetCurItem( NULL );
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
}
GetScreen()->SetCurItem( NULL );

View File

@ -16,7 +16,7 @@
#include "class_library.h"
#include "sch_bus_entry.h"
#include "sch_component.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_polyline.h"

View File

@ -25,11 +25,8 @@
// Global variables
bool g_OptNetListUseNames; /* TRUE to use names rather than net
bool g_OptNetListUseNames; /* TRUE to use names rather than net
* The numbers (PSPICE netlist only) */
SCH_ITEM* g_ItemToRepeat; /* Pointer to the last structure
* for duplicatation by the repeat command.
* (NULL if no struct exists) */
wxSize g_RepeatStep;
int g_RepeatDeltaLabel;

View File

@ -132,9 +132,6 @@ public:
int Flags;
};
extern SCH_ITEM* g_ItemToRepeat; /* Pointer to the last structure used
* by the repeat command. NULL if no
* item to repeat */
extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel;

View File

@ -76,7 +76,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
bool AllowWildSeach = TRUE;
static wxString lastCommponentName;
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
DrawPanel->m_IgnoreMouseEvents = TRUE;
if( !libname.IsEmpty() )

View File

@ -256,7 +256,7 @@ void SCH_EDIT_FRAME::InstallPreviousSheet()
if( m_CurrentSheet->Last() == g_RootSheet )
return;
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
ClearMsgPanel();
//make a copy for testing purposes.
@ -287,7 +287,7 @@ void SCH_EDIT_FRAME::InstallNextScreen( SCH_SHEET* Sheet )
DisplayError( this, wxT( "InstallNextScreen() error" ) ); return;
}
m_CurrentSheet->Push( Sheet );
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
ClearMsgPanel();
UpdateScreenFromSheet( this );
}

View File

@ -12,7 +12,7 @@
#include "protos.h"
#include "libeditframe.h"
#include "class_libentry.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"
#include "sch_component.h"
#include "sch_sheet.h"
@ -351,7 +351,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
break;
case HK_REPEAT_LAST:
if( notBusy && g_ItemToRepeat && ( g_ItemToRepeat->m_Flags == 0 ) )
if( notBusy && m_itemToRepeat && ( m_itemToRepeat->m_Flags == 0 ) )
RepeatDrawItem( DC );
break;

View File

@ -13,7 +13,7 @@
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_component.h"

View File

@ -13,7 +13,7 @@
#include "class_library.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_component.h"
#include "sch_line.h"
#include "sch_no_connect.h"

View File

@ -12,7 +12,7 @@
#include "protos.h"
#include "class_library.h"
#include "lib_pin.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_component.h"
#include "sch_line.h"
#include "sch_no_connect.h"

View File

@ -15,7 +15,7 @@
#include "sch_bus_entry.h"
#include "sch_text.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_component.h"
@ -36,7 +36,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( ( m_ID_current_state == 0 ) || ( DrawStruct && DrawStruct->m_Flags ) )
{
DrawPanel->m_AutoPAN_Request = FALSE;
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
if( DrawStruct && DrawStruct->m_Flags )
{
@ -106,8 +106,8 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_NOCONN_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
g_ItemToRepeat = CreateNewNoConnectStruct( DC );
GetScreen()->SetCurItem( g_ItemToRepeat );
m_itemToRepeat = CreateNewNoConnectStruct( DC );
GetScreen()->SetCurItem( m_itemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else
@ -122,8 +122,8 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_JUNCTION_BUTT:
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{
g_ItemToRepeat = CreateNewJunctionStruct( DC, GetScreen()->m_Curseur, TRUE );
GetScreen()->SetCurItem( g_ItemToRepeat );
m_itemToRepeat = CreateNewJunctionStruct( DC, GetScreen()->m_Curseur, TRUE );
GetScreen()->SetCurItem( m_itemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE;
}
else

View File

@ -18,7 +18,7 @@
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_text.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_component.h"
#include "sch_line.h"
#include "sch_no_connect.h"

View File

@ -20,7 +20,7 @@
#include "sch_polyline.h"
#include "sch_sheet.h"
#include "sch_component.h"
#include "sch_items.h"
#include "sch_junction.h"
void RotateListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& rotationPoint )

View File

@ -15,7 +15,7 @@
#include "class_library.h"
#include "lib_pin.h"
#include "sch_bus_entry.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_component.h"

View File

@ -12,7 +12,7 @@
#include "general.h"
#include "protos.h"
#include "sch_items.h"
#include "sch_junction.h"
/**********************/

View File

@ -14,7 +14,7 @@
#include "protos.h"
#include "netlist.h"
#include "class_library.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_bus_entry.h"
#include "sch_line.h"
#include "sch_marker.h"
@ -101,7 +101,7 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
AddGrid( SchematicGridList[i] );
SetGrid( wxRealPoint( 50, 50 ) ); /* Default grid size. */
m_RefCount = 0;
m_refCount = 0;
m_Center = false; /* Suitable for schematic only. For
* libedit and viewlib, must be set
* to true */
@ -116,6 +116,14 @@ SCH_SCREEN::~SCH_SCREEN()
}
void SCH_SCREEN::DecRefCount()
{
wxCHECK_RET( m_refCount != 0,
wxT( "Screen reference count already zero. Bad programmer!" ) );
m_refCount--;
}
void SCH_SCREEN::FreeDrawList()
{
SCH_ITEM* DrawStruct;

View File

@ -59,7 +59,7 @@ SCH_SHEET::SCH_SHEET( const SCH_SHEET& aSheet ) :
m_labels[i].SetParent( this );
if( m_AssociatedScreen )
m_AssociatedScreen->m_RefCount++;
m_AssociatedScreen->IncRefCount();
}
@ -69,9 +69,9 @@ SCH_SHEET::~SCH_SHEET()
// perhaps it should be deleted also.
if( m_AssociatedScreen )
{
m_AssociatedScreen->m_RefCount--;
m_AssociatedScreen->GetRefCount();
if( m_AssociatedScreen->m_RefCount == 0 )
if( m_AssociatedScreen->GetRefCount() == 0 )
delete m_AssociatedScreen;
}
}
@ -692,14 +692,14 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
if( screen )
{
m_AssociatedScreen = screen;
m_AssociatedScreen->m_RefCount++;
m_AssociatedScreen->IncRefCount();
//do not need to load the sub-sheets - this has already been done.
}
else
{
m_AssociatedScreen = new SCH_SCREEN();
m_AssociatedScreen->m_RefCount++;
m_AssociatedScreen->IncRefCount();
success = aFrame->LoadOneEEFile( m_AssociatedScreen, m_FileName );
if( success )
@ -790,9 +790,9 @@ current sheet data if possible)?" ),
// Can be NULL if loading a file when creating a new sheet.
if( m_AssociatedScreen )
{
m_AssociatedScreen->m_RefCount--; // be careful with these
m_AssociatedScreen->DecRefCount(); // be careful with these
if( m_AssociatedScreen->m_RefCount == 0 )
if( m_AssociatedScreen->GetRefCount() == 0 )
SAFE_DELETE( m_AssociatedScreen );
m_AssociatedScreen = NULL; // will be created later
@ -802,7 +802,7 @@ current sheet data if possible)?" ),
// if an associated screen exists, shared between this sheet and others
// sheets, what we do ?
if( m_AssociatedScreen && ( m_AssociatedScreen->m_RefCount > 1 ) )
if( m_AssociatedScreen && ( m_AssociatedScreen->GetRefCount() > 1 ) )
{
msg = _( "This sheet uses shared data in a complex hierarchy" );
msg << wxT( "\n" );
@ -817,8 +817,8 @@ otherwise delete current sheet data)" );
aFrame->SaveEEFile( m_AssociatedScreen, FILE_SAVE_AS );
m_AssociatedScreen->m_FileName = oldfilename;
}
m_AssociatedScreen->m_RefCount--; //be careful with these
m_AssociatedScreen = NULL; //will be created later
m_AssociatedScreen->DecRefCount(); //be careful with these
m_AssociatedScreen = NULL; //will be created later
}
SetFileName( aFileName );
@ -827,9 +827,9 @@ otherwise delete current sheet data)" );
// current sheet data
if( m_AssociatedScreen && (LoadFromFile || Screen_to_use) )
{
m_AssociatedScreen->m_RefCount--;
m_AssociatedScreen->DecRefCount();
if( m_AssociatedScreen->m_RefCount == 0 )
if( m_AssociatedScreen->GetRefCount() == 0 )
SAFE_DELETE( m_AssociatedScreen );
m_AssociatedScreen = NULL; // so that we reload..
@ -840,14 +840,14 @@ otherwise delete current sheet data)" );
else if( Screen_to_use )
{
m_AssociatedScreen = Screen_to_use;
m_AssociatedScreen->m_RefCount++;
m_AssociatedScreen->IncRefCount();
}
//just make a new screen if needed.
if( !m_AssociatedScreen )
{
m_AssociatedScreen = new SCH_SCREEN();
m_AssociatedScreen->m_RefCount++; // be careful with these
m_AssociatedScreen->IncRefCount(); // be careful with these
}
m_AssociatedScreen->m_FileName = aFileName;

View File

@ -20,7 +20,7 @@
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_component.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"
#include "sch_sheet.h"
@ -161,14 +161,14 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
case ID_HIERARCHY:
InstallHierarchyFrame( &dc, pos );
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
break;
case wxID_CUT:
if( screen->m_BlockLocate.m_Command != BLOCK_MOVE )
break;
HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
SetSheetNumberAndCount();
break;
@ -316,7 +316,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE );
screen->SetCurItem( NULL );
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
TestDanglingEnds( screen->GetDrawItems(), &dc );
DrawPanel->Refresh();
break;
@ -352,7 +352,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DeleteStruct( DrawPanel, &dc, item );
screen->SetCurItem( NULL );
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
TestDanglingEnds( screen->GetDrawItems(), &dc );
SetSheetNumberAndCount();
OnModify();
@ -757,7 +757,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// End switch ( id ) (Command execution)
if( m_ID_current_state == 0 )
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
SetToolbars();
}

View File

@ -12,7 +12,7 @@
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_junction.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_component.h"

View File

@ -181,7 +181,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
SetIcon( wxICON( icon_eeschema ) );
#endif
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
/* Get config */
LoadSettings();
@ -329,7 +329,7 @@ void SCH_EDIT_FRAME::CreateScreens()
if( g_RootSheet->m_AssociatedScreen == NULL )
{
g_RootSheet->m_AssociatedScreen = new SCH_SCREEN();
g_RootSheet->m_AssociatedScreen->m_RefCount++;
g_RootSheet->m_AssociatedScreen->IncRefCount();
}
g_RootSheet->m_AssociatedScreen->m_FileName = m_DefaultSchematicFileName;

View File

@ -213,7 +213,7 @@ static void ExitSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC )
/* Create hierarchy sheet. */
SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
{
g_ItemToRepeat = NULL;
m_itemToRepeat = NULL;
SAFE_DELETE( g_ItemToUndoCopy );
SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->m_Curseur );

View File

@ -22,6 +22,9 @@ class SCH_SHEET_PIN;
class SCH_SCREEN : public BASE_SCREEN
{
int m_refCount; ///< Number of sheets referencing this screen.
///< Delete when it goes to zero.
/**
* Function addConnectedItemsToBlock
* add items connected at \a aPosition to the block pick list.
@ -35,9 +38,6 @@ class SCH_SCREEN : public BASE_SCREEN
void addConnectedItemsToBlock( const wxPoint& aPosition );
public:
int m_RefCount; ///< Number of sheets referencing this screen.
///< Delete when it goes to zero.
SCH_SCREEN( KICAD_T aType = SCH_SCREEN_T );
~SCH_SCREEN();
@ -46,6 +46,12 @@ public:
return wxT( "SCH_SCREEN" );
}
void DecRefCount();
void IncRefCount() { m_refCount++; }
int GetRefCount() const { return m_refCount; }
/**
* Function GetDrawItems().
*

View File

@ -93,6 +93,8 @@ private:
wxArrayString m_findStringHistoryList;
wxArrayString m_replaceStringHistoryList;
BLOCK_SELECTOR m_blockItems; ///< List of selected items.
SCH_ITEM* m_itemToRepeat; ///< Last item to insert by the repeat command.
int m_repeatLabelDelta; ///< Repeat label number increment step.
public:
SCH_EDIT_FRAME( wxWindow* father,
@ -500,6 +502,8 @@ public:
void DeleteSheetLabel( bool aRedraw,
SCH_SHEET_PIN* aSheetLabelToDel );
int GetLabelIncrement() const { return m_repeatLabelDelta; }
private:
// Component
@ -653,6 +657,8 @@ public:
void RepeatDrawItem( wxDC* DC );
void SetRepeatItem( SCH_ITEM* aItem ) { m_itemToRepeat = aItem; }
void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC );
// ERC: