EESchema improvements and other minor fixes.
* Remove base screen methods from draw frame object and correct current screen methods in derived objects. * Move restore old wires function code into schematic screen object. * Make add junction method use current screen position instead of store position. * Move poly line ghosting function into the delete current segment method as that was the only place is was being used. * Add method to base schematic object of testing if object has a label that can be incremented. * Simplified the schematic hierarchy traversing code. * PCBNew Doxygen warning fixes.
This commit is contained in:
parent
2cda6f4b4f
commit
0d8cb9b53c
|
@ -166,17 +166,16 @@ void BLOCK_SELECTOR::PushItem( ITEM_PICKER& aItem )
|
|||
*/
|
||||
bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpos )
|
||||
{
|
||||
BLOCK_SELECTOR* Block = &GetBaseScreen()->m_BlockLocate;
|
||||
BLOCK_SELECTOR* Block = &GetScreen()->m_BlockLocate;
|
||||
|
||||
if( ( Block->m_Command != BLOCK_IDLE )
|
||||
|| ( Block->m_State != STATE_NO_BLOCK ) )
|
||||
return FALSE;
|
||||
if( ( Block->m_Command != BLOCK_IDLE ) || ( Block->m_State != STATE_NO_BLOCK ) )
|
||||
return false;
|
||||
|
||||
Block->m_Flags = 0;
|
||||
Block->m_Command = (CmdBlockType) ReturnBlockCommand( key );
|
||||
|
||||
if( Block->m_Command == 0 )
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
switch( Block->m_Command )
|
||||
{
|
||||
|
@ -205,19 +204,19 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
|
|||
if( Block->m_ItemsSelection.GetCount() == 0 ) /* No data to paste */
|
||||
{
|
||||
DisplayError( this, wxT( "No Block to paste" ), 20 );
|
||||
GetBaseScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
if( DrawPanel->ManageCurseur == NULL )
|
||||
{
|
||||
Block->m_ItemsSelection.ClearItemsList();
|
||||
DisplayError( this,
|
||||
wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: ManageCurseur NULL" ) );
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
Block->m_State = STATE_BLOCK_MOVE;
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, startpos, FALSE );
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, startpos, false );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -231,7 +230,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
|
|||
}
|
||||
|
||||
Block->SetMessageBlock( this );
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event )
|
|||
|
||||
if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
|
||||
{
|
||||
if( GetBaseScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
|
||||
DrawPanel->m_PanelDefaultCursor ) );
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ):
|
|||
DIALOG_PAGES_SETTINGS_BASE( parent )
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_Screen = m_Parent->GetBaseScreen();
|
||||
m_Screen = m_Parent->GetScreen();
|
||||
m_Modified = 0;
|
||||
m_SelectedSheet = NULL;
|
||||
m_CurrentSelection = 0;
|
||||
|
@ -276,10 +276,12 @@ void DIALOG_PAGES_SETTINGS::SearchPageSizeSelection()
|
|||
int ii;
|
||||
|
||||
m_CurrentSelection = NB_ITEMS - 1;
|
||||
|
||||
for( ii = 0; ii < NB_ITEMS; ii++ )
|
||||
{
|
||||
sheet = SheetList[ii];
|
||||
if( m_Parent->GetBaseScreen()->m_CurrentSheetDesc == sheet )
|
||||
|
||||
if( m_Parent->GetScreen()->m_CurrentSheetDesc == sheet )
|
||||
m_CurrentSelection = ii;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype,
|
|||
|
||||
DrawPanel = NULL;
|
||||
MsgPanel = NULL;
|
||||
m_CurrentScreen = NULL;
|
||||
m_currentScreen = NULL;
|
||||
m_ID_current_state = 0;
|
||||
m_ID_last_state = 0;
|
||||
m_HTOOL_current_state = 0;
|
||||
|
@ -121,8 +121,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype,
|
|||
|
||||
EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
|
||||
{
|
||||
if( m_CurrentScreen != NULL )
|
||||
delete m_CurrentScreen;
|
||||
SAFE_DELETE( m_currentScreen );
|
||||
|
||||
m_auimgr.UnInit();
|
||||
}
|
||||
|
@ -246,7 +245,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
BASE_SCREEN* screen = GetBaseScreen();
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
|
||||
if( screen->GetGridId() == id )
|
||||
return;
|
||||
|
@ -288,13 +287,13 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
|
|||
else
|
||||
{
|
||||
id--;
|
||||
int selectedZoom = GetBaseScreen()->m_ZoomList[id];
|
||||
int selectedZoom = GetScreen()->m_ZoomList[id];
|
||||
|
||||
if( GetBaseScreen()->GetZoom() == selectedZoom )
|
||||
if( GetScreen()->GetZoom() == selectedZoom )
|
||||
return;
|
||||
|
||||
GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterLogicalPosition();
|
||||
GetBaseScreen()->SetZoom( selectedZoom );
|
||||
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterLogicalPosition();
|
||||
GetScreen()->SetZoom( selectedZoom );
|
||||
RedrawScreen( false );
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +302,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
|
|||
/* Return the current zoom level */
|
||||
int EDA_DRAW_FRAME::GetZoom(void)
|
||||
{
|
||||
return GetBaseScreen()->GetZoom();
|
||||
return GetScreen()->GetZoom();
|
||||
}
|
||||
|
||||
|
||||
|
@ -455,8 +454,8 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition )
|
|||
{
|
||||
wxPoint pos = aPosition;
|
||||
|
||||
if( m_CurrentScreen != NULL && m_snapToGrid )
|
||||
pos = m_CurrentScreen->GetNearestGridPosition( aPosition );
|
||||
if( m_currentScreen != NULL && m_snapToGrid )
|
||||
pos = m_currentScreen->GetNearestGridPosition( aPosition );
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
@ -470,7 +469,7 @@ int EDA_DRAW_FRAME::ReturnBlockCommand( int key )
|
|||
|
||||
void EDA_DRAW_FRAME::InitBlockPasteInfos()
|
||||
{
|
||||
GetBaseScreen()->m_BlockLocate.ClearItemsList();
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
}
|
||||
|
||||
|
@ -490,7 +489,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars()
|
|||
{
|
||||
int unitsX, unitsY, posX, posY;
|
||||
wxSize drawingSize, clientSize;
|
||||
BASE_SCREEN* screen = GetBaseScreen();
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
bool noRefresh = true;
|
||||
|
||||
if( screen == NULL || DrawPanel == NULL )
|
||||
|
@ -627,7 +626,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
|
|||
{
|
||||
wxString Line;
|
||||
int dx, dy;
|
||||
BASE_SCREEN* screen = GetBaseScreen();
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
|
||||
if( !screen )
|
||||
return;
|
||||
|
|
|
@ -110,7 +110,7 @@ BASE_SCREEN* EDA_DRAW_PANEL::GetScreen()
|
|||
{
|
||||
EDA_DRAW_FRAME* parentFrame = m_Parent;
|
||||
|
||||
return parentFrame->GetBaseScreen();
|
||||
return parentFrame->GetScreen();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1576,7 +1576,7 @@ wxString EDA_DRAW_FRAME::GetScreenDesc()
|
|||
{
|
||||
wxString msg;
|
||||
|
||||
msg << GetBaseScreen()->m_ScreenNumber << wxT( "/" )
|
||||
<< GetBaseScreen()->m_NumberOfScreen;
|
||||
msg << GetScreen()->m_ScreenNumber << wxT( "/" )
|
||||
<< GetScreen()->m_NumberOfScreen;
|
||||
return msg;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer )
|
||||
{
|
||||
|
||||
PutOnGrid( &(GetBaseScreen()->m_Curseur) );
|
||||
PutOnGrid( &(GetScreen()->m_Curseur) );
|
||||
AdjustScrollBars();
|
||||
|
||||
#if !defined(__WXMAC__)
|
||||
|
@ -53,7 +53,7 @@ void EDA_DRAW_FRAME::PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize )
|
|||
{
|
||||
wxCHECK_RET( aCoord != NULL, wxT( "Cannot pull NULL coordinate pointer on grid." ) );
|
||||
|
||||
*aCoord = GetBaseScreen()->GetNearestGridPosition( *aCoord, aGridSize );
|
||||
*aCoord = GetScreen()->GetNearestGridPosition( *aCoord, aGridSize );
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ void EDA_DRAW_FRAME::PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize )
|
|||
*/
|
||||
void EDA_DRAW_FRAME::Zoom_Automatique( bool move_mouse_cursor )
|
||||
{
|
||||
GetBaseScreen()->SetZoom( BestZoom() ); // Set the best zoom
|
||||
GetScreen()->SetZoom( BestZoom() ); // Set the best zoom
|
||||
RedrawScreen( move_mouse_cursor ); // Set the best centering and refresh the screen
|
||||
}
|
||||
|
||||
|
@ -85,8 +85,8 @@ void EDA_DRAW_FRAME::Window_Zoom( EDA_Rect& Rect )
|
|||
bestscale = (double) Rect.GetSize().y / size.y;
|
||||
bestscale = MAX( bestscale, scalex );
|
||||
|
||||
GetBaseScreen()->SetScalingFactor( bestscale );
|
||||
GetBaseScreen()->m_Curseur = Rect.Centre();
|
||||
GetScreen()->SetScalingFactor( bestscale );
|
||||
GetScreen()->m_Curseur = Rect.Centre();
|
||||
RedrawScreen( TRUE );
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
|
|||
int i;
|
||||
int id = event.GetId();
|
||||
bool zoom_at_cursor = false;
|
||||
BASE_SCREEN* screen = GetBaseScreen();
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
|
||||
switch( id )
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father,
|
|||
SetTitle( title );
|
||||
|
||||
SetBoard( new BOARD( NULL, this ) );
|
||||
SetBaseScreen( new PCB_SCREEN() );
|
||||
SetScreen( new PCB_SCREEN() );
|
||||
|
||||
LoadSettings();
|
||||
// Initialize grid id to a default value if not found in config or bad:
|
||||
|
@ -126,9 +126,8 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father,
|
|||
DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
|
||||
{
|
||||
delete GetBoard();
|
||||
|
||||
delete GetBaseScreen();
|
||||
SetBaseScreen( 0 );
|
||||
delete GetScreen();
|
||||
SetScreen( NULL );
|
||||
|
||||
( (WinEDA_CvpcbFrame*) wxGetApp().GetTopWindow() )->DrawFrame = NULL;
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#include "sch_sheet.h"
|
||||
|
||||
|
||||
/* Routines Locales */
|
||||
static void Show_Polyline_in_Ghost( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase );
|
||||
static void AbortCreateNewLine( EDA_DRAW_PANEL* Panel, wxDC* DC );
|
||||
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer );
|
||||
static bool IsJunctionNeeded( SCH_EDIT_FRAME* frame, wxPoint& pos );
|
||||
|
@ -35,41 +33,6 @@ SCH_ITEM* s_OldWiresList;
|
|||
wxPoint s_ConnexionStartPoint;
|
||||
|
||||
|
||||
/* Replace the wires in screen->GetDrawItems() by s_OldWiresList wires.
|
||||
*/
|
||||
static void RestoreOldWires( SCH_SCREEN* screen )
|
||||
{
|
||||
SCH_ITEM* item;
|
||||
SCH_ITEM* next_item;
|
||||
|
||||
for( item = screen->GetDrawItems(); item != NULL; item = next_item )
|
||||
{
|
||||
next_item = item->Next();
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_JUNCTION_T:
|
||||
case SCH_LINE_T:
|
||||
screen->RemoveFromDrawList( item );
|
||||
delete item;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while( s_OldWiresList )
|
||||
{
|
||||
next_item = s_OldWiresList->Next();
|
||||
|
||||
s_OldWiresList->SetNext( screen->GetDrawItems() );
|
||||
screen->SetDrawItems( s_OldWiresList );
|
||||
s_OldWiresList = next_item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mouse capture callback for drawing line segments.
|
||||
*/
|
||||
|
@ -249,7 +212,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
|
|||
if( oldsegment->m_Start == s_ConnexionStartPoint )
|
||||
{
|
||||
if( IsJunctionNeeded( this, s_ConnexionStartPoint ) )
|
||||
CreateNewJunctionStruct( DC, s_ConnexionStartPoint );
|
||||
AddJunction( DC, s_ConnexionStartPoint );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -344,15 +307,15 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
|
|||
if( lastsegment )
|
||||
{
|
||||
if( IsJunctionNeeded( this, end_point ) )
|
||||
CreateNewJunctionStruct( DC, end_point );
|
||||
AddJunction( DC, end_point );
|
||||
else if( IsJunctionNeeded( this, alt_end_point ) )
|
||||
CreateNewJunctionStruct( DC, alt_end_point );
|
||||
AddJunction( DC, alt_end_point );
|
||||
}
|
||||
|
||||
/* Automatic place of a junction on the start point if necessary because
|
||||
* the cleanup can suppress intermediate points by merging wire segments */
|
||||
if( IsJunctionNeeded( this, s_ConnexionStartPoint ) )
|
||||
CreateNewJunctionStruct( DC, s_ConnexionStartPoint );
|
||||
AddJunction( DC, s_ConnexionStartPoint );
|
||||
|
||||
GetScreen()->TestDanglingEnds( DrawPanel, DC );
|
||||
|
||||
|
@ -431,92 +394,73 @@ static void ComputeBreakPoint( SCH_LINE* segment, const wxPoint& new_pos )
|
|||
}
|
||||
|
||||
|
||||
/* Drawing Polyline phantom at the displacement of the cursor
|
||||
*/
|
||||
static void Show_Polyline_in_Ghost( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
|
||||
{
|
||||
SCH_POLYLINE* NewPoly = (SCH_POLYLINE*) panel->GetScreen()->GetCurItem();
|
||||
int color;
|
||||
wxPoint endpos;
|
||||
|
||||
endpos = panel->GetScreen()->m_Curseur;
|
||||
color = ReturnLayerColor( NewPoly->GetLayer() );
|
||||
|
||||
GRSetDrawMode( DC, g_XorMode );
|
||||
|
||||
int idx = NewPoly->GetCornerCount() - 1;
|
||||
|
||||
if( g_HVLines )
|
||||
{
|
||||
/* Coerce the line to vertical or horizontal one: */
|
||||
if( ABS( endpos.x - NewPoly->m_PolyPoints[idx].x ) <
|
||||
ABS( endpos.y - NewPoly->m_PolyPoints[idx].y ) )
|
||||
endpos.x = NewPoly->m_PolyPoints[idx].x;
|
||||
else
|
||||
endpos.y = NewPoly->m_PolyPoints[idx].y;
|
||||
}
|
||||
|
||||
if( erase )
|
||||
NewPoly->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, color );
|
||||
|
||||
NewPoly->m_PolyPoints[idx] = endpos;
|
||||
NewPoly->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, color );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Erase the last trace or the element at the current mouse position.
|
||||
*/
|
||||
void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
|
||||
{
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
|
||||
m_itemToRepeat = NULL;
|
||||
|
||||
if( ( GetScreen()->GetCurItem() == NULL )
|
||||
|| ( ( GetScreen()->GetCurItem()->m_Flags & IS_NEW ) == 0 ) )
|
||||
{
|
||||
if( ( screen->GetCurItem() == NULL ) || !screen->GetCurItem()->IsNew() )
|
||||
return;
|
||||
}
|
||||
|
||||
/* Cancel trace in progress */
|
||||
if( GetScreen()->GetCurItem()->Type() == SCH_POLYLINE_T )
|
||||
if( screen->GetCurItem()->Type() == SCH_POLYLINE_T )
|
||||
{
|
||||
Show_Polyline_in_Ghost( DrawPanel, DC, false );
|
||||
SCH_POLYLINE* polyLine = (SCH_POLYLINE*) screen->GetCurItem();
|
||||
wxPoint endpos;
|
||||
|
||||
endpos = screen->m_Curseur;
|
||||
|
||||
int idx = polyLine->GetCornerCount() - 1;
|
||||
|
||||
if( g_HVLines )
|
||||
{
|
||||
/* Coerce the line to vertical or horizontal one: */
|
||||
if( ABS( endpos.x - polyLine->m_PolyPoints[idx].x ) <
|
||||
ABS( endpos.y - polyLine->m_PolyPoints[idx].y ) )
|
||||
endpos.x = polyLine->m_PolyPoints[idx].x;
|
||||
else
|
||||
endpos.y = polyLine->m_PolyPoints[idx].y;
|
||||
}
|
||||
|
||||
polyLine->m_PolyPoints[idx] = endpos;
|
||||
polyLine->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawSegment( DrawPanel, DC, wxDefaultPosition, false );
|
||||
}
|
||||
|
||||
EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), GetScreen() );
|
||||
screen->RemoveFromDrawList( screen->GetCurItem() );
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
screen->SetCurItem( NULL );
|
||||
}
|
||||
|
||||
|
||||
/* Routine to create new connection struct.
|
||||
*/
|
||||
SCH_JUNCTION* SCH_EDIT_FRAME::CreateNewJunctionStruct( wxDC* DC,
|
||||
const wxPoint& pos,
|
||||
bool PutInUndoList )
|
||||
SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition,
|
||||
bool aPutInUndoList )
|
||||
{
|
||||
SCH_JUNCTION* NewJunction;
|
||||
SCH_JUNCTION* junction = new SCH_JUNCTION( aPosition );
|
||||
|
||||
NewJunction = new SCH_JUNCTION( pos );
|
||||
m_itemToRepeat = junction;
|
||||
|
||||
m_itemToRepeat = NewJunction;
|
||||
DrawPanel->CursorOff( aDC ); // Erase schematic cursor
|
||||
junction->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
||||
DrawPanel->CursorOn( aDC ); // Display schematic cursor
|
||||
|
||||
DrawPanel->CursorOff( DC ); // Erase schematic cursor
|
||||
NewJunction->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
||||
DrawPanel->CursorOn( DC ); // Display schematic cursor
|
||||
|
||||
NewJunction->SetNext( GetScreen()->GetDrawItems() );
|
||||
GetScreen()->SetDrawItems( NewJunction );
|
||||
junction->SetNext( GetScreen()->GetDrawItems() );
|
||||
GetScreen()->SetDrawItems( junction );
|
||||
OnModify();
|
||||
|
||||
if( PutInUndoList )
|
||||
SaveCopyInUndoList( NewJunction, UR_NEW );
|
||||
if( aPutInUndoList )
|
||||
SaveCopyInUndoList( junction, UR_NEW );
|
||||
|
||||
return NewJunction;
|
||||
return junction;
|
||||
}
|
||||
|
||||
|
||||
|
@ -543,15 +487,15 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPositio
|
|||
*/
|
||||
static void AbortCreateNewLine( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||
{
|
||||
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->GetScreen();
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->GetScreen();
|
||||
|
||||
if( Screen->GetCurItem() )
|
||||
if( screen->GetCurItem() )
|
||||
{
|
||||
Panel->ManageCurseur = NULL;
|
||||
Panel->ForceCloseManageCurseur = NULL;
|
||||
EraseStruct( (SCH_ITEM*) Screen->GetCurItem(), (SCH_SCREEN*) Screen );
|
||||
Screen->SetCurItem( NULL );
|
||||
RestoreOldWires( Screen );
|
||||
screen->RemoveFromDrawList( (SCH_ITEM*) screen->GetCurItem() );
|
||||
screen->SetCurItem( NULL );
|
||||
screen->ReplaceWires( s_OldWiresList );
|
||||
Panel->Refresh();
|
||||
}
|
||||
else
|
||||
|
@ -562,7 +506,7 @@ static void AbortCreateNewLine( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
}
|
||||
|
||||
/* Clear m_Flags which is used in edit functions: */
|
||||
SCH_ITEM* item = Screen->GetDrawItems();
|
||||
SCH_ITEM* item = screen->GetDrawItems();
|
||||
|
||||
while( item )
|
||||
{
|
||||
|
@ -596,13 +540,8 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
|
|||
|
||||
m_itemToRepeat->Move( wxPoint( g_RepeatStep.GetWidth(), g_RepeatStep.GetHeight() ) );
|
||||
|
||||
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 )
|
||||
{
|
||||
if( m_itemToRepeat->CanIncrementLabel() )
|
||||
( (SCH_TEXT*) m_itemToRepeat )->IncrementLabel();
|
||||
}
|
||||
|
||||
if( m_itemToRepeat )
|
||||
{
|
||||
|
|
|
@ -99,8 +99,8 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
|
|||
g_DrawDefaultLineThickness =
|
||||
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
|
||||
|
||||
BASE_SCREEN* screen = m_Parent->GetBaseScreen();
|
||||
BASE_SCREEN* oldscreen = screen;
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen();
|
||||
SCH_SCREEN* oldscreen = screen;
|
||||
|
||||
if( aPrintAll && m_Parent->m_Ident == SCHEMATIC_FRAME )
|
||||
{
|
||||
|
|
|
@ -102,8 +102,7 @@ private:
|
|||
void Plot_1_Page_HPGL( const wxString& FileName,
|
||||
SCH_SCREEN* screen, Ki_PageDescr* sheet,
|
||||
wxPoint& offset, double plot_scale );
|
||||
void ReturnSheetDims( BASE_SCREEN* screen, wxSize& SheetSize,
|
||||
wxPoint& SheetOffset );
|
||||
void ReturnSheetDims( SCH_SCREEN* screen, wxSize& SheetSize, wxPoint& SheetOffset );
|
||||
};
|
||||
/* static members (static to remember last state): */
|
||||
PageFormatReq DIALOG_PLOT_SCHEMATIC_HPGL:: m_pageSizeSelect = PAGE_DEFAULT;
|
||||
|
@ -262,14 +261,14 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
|
|||
/* Function calculates the offsets and dimensions of any trace of the
|
||||
* selected sheet
|
||||
*/
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( BASE_SCREEN* screen,
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( SCH_SCREEN* screen,
|
||||
wxSize& SheetSize,
|
||||
wxPoint& SheetOffset )
|
||||
{
|
||||
Ki_PageDescr* PlotSheet;
|
||||
|
||||
if( screen == NULL )
|
||||
screen = m_Parent->GetBaseScreen();
|
||||
screen = m_Parent->GetScreen();
|
||||
|
||||
PlotSheet = screen->m_CurrentSheetDesc;
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
|
|||
wxArrayString units;
|
||||
GRIDS grid_list;
|
||||
|
||||
GetBaseScreen()->GetGrids( grid_list );
|
||||
GetScreen()->GetGrids( grid_list );
|
||||
|
||||
DIALOG_EESCHEMA_OPTIONS dlg( this );
|
||||
|
||||
|
@ -184,7 +184,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
|
|||
units.Add( GetUnitsLabel( MILLIMETRES ) );
|
||||
|
||||
dlg.SetUnits( units, g_UserUnit );
|
||||
dlg.SetGridSizes( grid_list, GetBaseScreen()->GetGridId() );
|
||||
dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() );
|
||||
dlg.SetLineWidth( g_DrawDefaultLineThickness );
|
||||
dlg.SetTextSize( g_DefaultTextLabelSize );
|
||||
dlg.SetRepeatHorizontal( g_RepeatStep.x );
|
||||
|
@ -213,7 +213,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
|
|||
|
||||
g_UserUnit = (UserUnitType)dlg.GetUnitsSelection();
|
||||
|
||||
GetBaseScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
|
||||
GetScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
|
||||
|
||||
g_DrawDefaultLineThickness = dlg.GetLineWidth();
|
||||
g_DefaultTextLabelSize = dlg.GetTextSize();
|
||||
|
@ -384,7 +384,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& CfgFileName, bool ForceRer
|
|||
m_ComponentLibFiles.Add( wxT( "power" ) );
|
||||
|
||||
LoadLibraries();
|
||||
GetBaseScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
|
||||
return IsRead;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#include "wx/treectrl.h"
|
||||
|
||||
|
||||
static bool UpdateScreenFromSheet( SCH_EDIT_FRAME* frame );
|
||||
|
||||
enum
|
||||
{
|
||||
ID_TREECTRL_HIERARCHY = 1600
|
||||
|
@ -60,8 +58,7 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_Tree, wxTreeCtrl )
|
|||
|
||||
|
||||
WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) :
|
||||
wxTreeCtrl( (wxWindow*)parent, ID_TREECTRL_HIERARCHY,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTreeCtrl( (wxWindow*)parent, ID_TREECTRL_HIERARCHY, wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS, wxDefaultValidator, wxT( "HierachyTreeCtrl" ) )
|
||||
{
|
||||
m_Parent = parent;
|
||||
|
@ -103,8 +100,7 @@ private:
|
|||
};
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_HierFrame, wxDialog )
|
||||
EVT_TREE_ITEM_ACTIVATED( ID_TREECTRL_HIERARCHY,
|
||||
WinEDA_HierFrame::OnSelect )
|
||||
EVT_TREE_ITEM_ACTIVATED( ID_TREECTRL_HIERARCHY, WinEDA_HierFrame::OnSelect )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
@ -179,8 +175,7 @@ void WinEDA_HierFrame::OnQuit( wxCommandEvent& event )
|
|||
* Schematic
|
||||
* This routine is re-entrant!
|
||||
*/
|
||||
void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list,
|
||||
wxTreeItemId* previousmenu )
|
||||
void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId* previousmenu )
|
||||
|
||||
{
|
||||
wxTreeItemId menu;
|
||||
|
@ -194,11 +189,13 @@ void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list,
|
|||
DisplayError( this, msg );
|
||||
m_nbsheets++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
maxposx += m_Tree->GetIndent();
|
||||
SCH_ITEM* schitem = list->LastDrawList();
|
||||
|
||||
while( schitem && m_nbsheets < NB_MAX_SHEET )
|
||||
{
|
||||
if( schitem->Type() == SCH_SHEET_T )
|
||||
|
@ -209,6 +206,7 @@ void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list,
|
|||
list->Push( sheet );
|
||||
m_Tree->SetItemData( menu, new TreeItemData( *list ) );
|
||||
int ll = m_Tree->GetItemText( menu ).Len();
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
ll *= 9; // * char width
|
||||
#else
|
||||
|
@ -217,15 +215,18 @@ void WinEDA_HierFrame::BuildSheetsTree( SCH_SHEET_PATH* list,
|
|||
ll += maxposx + 20;
|
||||
m_TreeSize.x = MAX( m_TreeSize.x, ll );
|
||||
m_TreeSize.y += 1;
|
||||
|
||||
if( *list == *( m_Parent->GetSheet() ) )
|
||||
{
|
||||
m_Tree->EnsureVisible( menu );
|
||||
m_Tree->SelectItem( menu );
|
||||
}
|
||||
|
||||
BuildSheetsTree( list, &menu );
|
||||
m_Tree->Expand( menu );
|
||||
list->Pop();
|
||||
}
|
||||
|
||||
schitem = schitem->Next();
|
||||
}
|
||||
|
||||
|
@ -241,89 +242,35 @@ void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
|
|||
{
|
||||
wxTreeItemId ItemSel = m_Tree->GetSelection();
|
||||
|
||||
*(m_Parent->m_CurrentSheet) =
|
||||
( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetPath;
|
||||
UpdateScreenFromSheet( m_Parent );
|
||||
Close( TRUE );
|
||||
SCH_SHEET* sheet = ( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetPath.Last();
|
||||
m_Parent->m_CurrentSheet->Push( sheet );
|
||||
m_Parent->DisplayCurrentSheet();
|
||||
Close( true );
|
||||
}
|
||||
|
||||
|
||||
/* Set the current screen to display the parent sheet of the current
|
||||
* displayed sheet
|
||||
*/
|
||||
void SCH_EDIT_FRAME::InstallPreviousSheet()
|
||||
void SCH_EDIT_FRAME::DisplayCurrentSheet()
|
||||
{
|
||||
if( m_CurrentSheet->Last() == g_RootSheet )
|
||||
return;
|
||||
|
||||
m_itemToRepeat = NULL;
|
||||
ClearMsgPanel();
|
||||
|
||||
//make a copy for testing purposes.
|
||||
m_CurrentSheet->Pop();
|
||||
SCH_SCREEN* screen = m_CurrentSheet->LastScreen();
|
||||
|
||||
if( m_CurrentSheet->LastScreen() == NULL )
|
||||
{
|
||||
DisplayError( this, wxT( "InstallPreviousScreen() Error: Sheet not found" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateScreenFromSheet( this );
|
||||
}
|
||||
|
||||
|
||||
/* Routine installation of the screen corresponding to the symbol edge Sheet
|
||||
* Be careful here because the SCH_SHEETs within the GetDrawItems()
|
||||
* don't actually have a valid m_AssociatedScreen (on purpose -- you need the
|
||||
* m_SubSheet hierarchy to maintain path info (well, this is but one way to
|
||||
* maintain path info..)
|
||||
*/
|
||||
void SCH_EDIT_FRAME::InstallNextScreen( SCH_SHEET* Sheet )
|
||||
{
|
||||
if( Sheet == NULL )
|
||||
{
|
||||
DisplayError( this, wxT( "InstallNextScreen() error" ) ); return;
|
||||
}
|
||||
|
||||
m_CurrentSheet->Push( Sheet );
|
||||
m_itemToRepeat = NULL;
|
||||
ClearMsgPanel();
|
||||
UpdateScreenFromSheet( this );
|
||||
}
|
||||
|
||||
|
||||
/* Find and install the screen on the sheet symbol Sheet.
|
||||
* If Sheet == NULL installation of the screen base (Root).
|
||||
*/
|
||||
static bool UpdateScreenFromSheet( SCH_EDIT_FRAME* frame )
|
||||
{
|
||||
if( !frame->m_CurrentSheet->LastScreen() )
|
||||
{
|
||||
DisplayError( frame, wxT( "Screen not found for this sheet" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
SCH_SCREEN* screen = frame->m_CurrentSheet->LastScreen();
|
||||
|
||||
// Reset display settings of the new screen
|
||||
// Assumes m_CurrentSheet has already been updated.
|
||||
frame->ClearMsgPanel();
|
||||
SetScreen( screen );
|
||||
|
||||
// update the References
|
||||
frame->m_CurrentSheet->UpdateAllScreenReferences();
|
||||
frame->SetSheetNumberAndCount();
|
||||
frame->DrawPanel->m_CanStartBlock = -1;
|
||||
m_CurrentSheet->UpdateAllScreenReferences();
|
||||
SetSheetNumberAndCount();
|
||||
DrawPanel->m_CanStartBlock = -1;
|
||||
|
||||
if( screen->m_FirstRedraw )
|
||||
{
|
||||
screen->m_FirstRedraw = false;
|
||||
frame->Zoom_Automatique( true );
|
||||
Zoom_Automatique( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
frame->DrawPanel->MouseToCursorSchema();
|
||||
frame->RedrawScreen( true );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
RedrawScreen( true );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event )
|
|||
|
||||
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
|
||||
|
||||
if( GetBaseScreen()->IsModify()
|
||||
if( GetScreen()->IsModify()
|
||||
&& !IsOK( this, _( "Current part not saved.\n\nDiscard current changes?" ) ) )
|
||||
return;
|
||||
|
||||
|
@ -84,7 +84,7 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event )
|
|||
if( i == 0 )
|
||||
return;
|
||||
|
||||
GetBaseScreen()->ClrModify();
|
||||
GetScreen()->ClrModify();
|
||||
m_lastDrawItem = m_drawItem = NULL;
|
||||
|
||||
// Delete previous library component, if any
|
||||
|
@ -179,7 +179,7 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, CMP_LIBRARY* aLib
|
|||
if( m_component->HasConversion() )
|
||||
m_showDeMorgan = true;
|
||||
|
||||
GetBaseScreen()->ClrModify();
|
||||
GetScreen()->ClrModify();
|
||||
DisplayLibInfos();
|
||||
UpdateAliasSelectList();
|
||||
UpdatePartSelectList();
|
||||
|
@ -586,7 +586,7 @@ void LIB_EDIT_FRAME::SaveOnePartInMemory()
|
|||
return;
|
||||
}
|
||||
|
||||
GetBaseScreen()->ClrModify();
|
||||
GetScreen()->ClrModify();
|
||||
|
||||
oldComponent = m_library->FindComponent( m_component->GetName() );
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
|
|||
|
||||
// Give an icon
|
||||
SetIcon( wxIcon( libedit_xpm ) );
|
||||
SetBaseScreen( new SCH_SCREEN() );
|
||||
SetScreen( new SCH_SCREEN() );
|
||||
GetScreen()->m_Center = true;
|
||||
LoadSettings();
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
int BestZoom(); // Returns the best zoom
|
||||
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
||||
|
||||
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
|
||||
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
|
||||
|
||||
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
|
||||
|
||||
|
|
|
@ -96,9 +96,19 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
item = LocateAndShowItem( aPosition );
|
||||
|
||||
if( item && ( item->Type() == SCH_SHEET_T ) )
|
||||
InstallNextScreen( (SCH_SHEET*) item );
|
||||
{
|
||||
m_CurrentSheet->Push( (SCH_SHEET*) item );
|
||||
DisplayCurrentSheet();
|
||||
}
|
||||
else
|
||||
InstallPreviousSheet();
|
||||
{
|
||||
wxCHECK_RET( m_CurrentSheet->Last() != g_RootSheet,
|
||||
wxT( "Cannot leave root sheet. Bad Programmer!" ) );
|
||||
|
||||
m_CurrentSheet->Pop();
|
||||
DisplayCurrentSheet();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ID_NOCONN_BUTT:
|
||||
|
@ -121,7 +131,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
case ID_JUNCTION_BUTT:
|
||||
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
|
||||
{
|
||||
m_itemToRepeat = CreateNewJunctionStruct( aDC, GetScreen()->m_Curseur, true );
|
||||
m_itemToRepeat = AddJunction( aDC, gridPosition, true );
|
||||
GetScreen()->SetCurItem( m_itemToRepeat );
|
||||
DrawPanel->m_AutoPAN_Request = true;
|
||||
}
|
||||
|
@ -336,7 +346,8 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
switch( item->Type() )
|
||||
{
|
||||
case SCH_SHEET_T:
|
||||
InstallNextScreen( (SCH_SHEET*) item );
|
||||
m_CurrentSheet->Push( (SCH_SHEET*) item );
|
||||
DisplayCurrentSheet();
|
||||
break;
|
||||
|
||||
case SCH_COMPONENT_T:
|
||||
|
|
|
@ -137,6 +137,7 @@ void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct )
|
|||
DrawList->SetNext( DrawList->Next()->Next() );
|
||||
break;
|
||||
}
|
||||
|
||||
DrawList = DrawList->Next();
|
||||
}
|
||||
}
|
||||
|
@ -210,6 +211,39 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SCREEN::ReplaceWires( SCH_ITEM* aWireList )
|
||||
{
|
||||
SCH_ITEM* item;
|
||||
SCH_ITEM* next_item;
|
||||
|
||||
for( item = GetDrawItems(); item != NULL; item = next_item )
|
||||
{
|
||||
next_item = item->Next();
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_JUNCTION_T:
|
||||
case SCH_LINE_T:
|
||||
RemoveFromDrawList( item );
|
||||
delete item;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while( aWireList )
|
||||
{
|
||||
next_item = aWireList->Next();
|
||||
|
||||
aWireList->SetNext( GetDrawItems() );
|
||||
SetDrawItems( aWireList );
|
||||
aWireList = next_item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Routine cleaning:
|
||||
* - Includes segments or buses aligned in only 1 segment
|
||||
* - Detects identical objects superimposed
|
||||
|
|
|
@ -200,6 +200,8 @@ public:
|
|||
|
||||
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
|
||||
|
||||
virtual bool CanIncrementLabel() const { return true; }
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
#endif
|
||||
|
|
|
@ -653,17 +653,19 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_SCH_ENTER_SHEET:
|
||||
{
|
||||
EDA_ITEM* DrawStruct = screen->GetCurItem();
|
||||
EDA_ITEM* item = screen->GetCurItem();
|
||||
|
||||
if( DrawStruct && (DrawStruct->Type() == SCH_SHEET_T) )
|
||||
if( item && (item->Type() == SCH_SHEET_T) )
|
||||
{
|
||||
InstallNextScreen( (SCH_SHEET*) DrawStruct );
|
||||
m_CurrentSheet->Push( (SCH_SHEET*) item );
|
||||
DisplayCurrentSheet();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_LEAVE_SHEET:
|
||||
InstallPreviousSheet();
|
||||
m_CurrentSheet->Pop();
|
||||
DisplayCurrentSheet();
|
||||
break;
|
||||
|
||||
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
||||
|
@ -717,7 +719,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_SCH_ADD_JUNCTION:
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
screen->SetCurItem( CreateNewJunctionStruct( &dc, screen->m_Curseur, true ) );
|
||||
screen->SetCurItem( AddJunction( &dc, screen->m_Curseur, true ) );
|
||||
screen->TestDanglingEnds( DrawPanel, &dc );
|
||||
screen->SetCurItem( NULL );
|
||||
break;
|
||||
|
|
|
@ -243,19 +243,14 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
|
|||
|
||||
SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
|
||||
{
|
||||
SAFE_DELETE( g_RootSheet );
|
||||
SetScreen( NULL );
|
||||
SAFE_DELETE( m_CurrentSheet ); // a SCH_SHEET_PATH, on the heap.
|
||||
SAFE_DELETE( g_RootSheet );
|
||||
SAFE_DELETE( m_findReplaceData );
|
||||
CMP_LIBRARY::RemoveAllLibraries();
|
||||
}
|
||||
|
||||
|
||||
BASE_SCREEN* SCH_EDIT_FRAME::GetBaseScreen() const
|
||||
{
|
||||
return GetScreen();
|
||||
}
|
||||
|
||||
|
||||
SCH_SHEET_PATH* SCH_EDIT_FRAME::GetSheet()
|
||||
{
|
||||
return m_CurrentSheet;
|
||||
|
@ -336,11 +331,11 @@ void SCH_EDIT_FRAME::CreateScreens()
|
|||
m_CurrentSheet->Clear();
|
||||
m_CurrentSheet->Push( g_RootSheet );
|
||||
|
||||
if( GetBaseScreen() == NULL )
|
||||
SetBaseScreen( new SCH_SCREEN() );
|
||||
if( GetScreen() == NULL )
|
||||
SetScreen( new SCH_SCREEN() );
|
||||
|
||||
GetBaseScreen()->SetZoom( 4 * GetBaseScreen()->m_ZoomScalar );
|
||||
GetBaseScreen()->m_UndoRedoCountMax = 10;
|
||||
GetScreen()->SetZoom( 4 * GetScreen()->m_ZoomScalar );
|
||||
GetScreen()->m_UndoRedoCountMax = 10;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
|
|||
if( m_Semaphore )
|
||||
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
|
||||
|
||||
SetBaseScreen( new SCH_SCREEN() );
|
||||
SetScreen( new SCH_SCREEN() );
|
||||
GetScreen()->m_Center = true; // Center coordinate origins on screen.
|
||||
LoadSettings();
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
void ClickOnCmpList( wxCommandEvent& event );
|
||||
void OnSetRelativeOffset( wxCommandEvent& event );
|
||||
|
||||
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
|
||||
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
|
||||
|
||||
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father
|
|||
SetIcon( wxICON( icon_gerbview ) );
|
||||
#endif
|
||||
|
||||
SetBaseScreen( ScreenPcb );
|
||||
SetScreen( ScreenPcb );
|
||||
|
||||
SetBoard( new BOARD( NULL, this ) );
|
||||
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
|
||||
|
@ -233,7 +233,7 @@ END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father
|
|||
|
||||
WinEDA_GerberFrame::~WinEDA_GerberFrame()
|
||||
{
|
||||
SetBaseScreen( ScreenPcb );
|
||||
SetScreen( ScreenPcb );
|
||||
extern PARAM_CFG_BASE* ParamCfgList[];
|
||||
wxGetApp().SaveCurrentSetupValues( ParamCfgList );
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
|
|||
GetBoard()->m_NbNodes = 0;
|
||||
GetBoard()->m_NbNoconnect = 0;
|
||||
|
||||
SetBaseScreen( ScreenPcb );
|
||||
SetScreen( ScreenPcb );
|
||||
GetScreen()->Init();
|
||||
setActiveLayer(LAYER_N_BACK);
|
||||
syncLayerBox();
|
||||
|
|
|
@ -145,6 +145,13 @@ public:
|
|||
*/
|
||||
SCH_ITEM* ExtractWires( bool aCreateCopy );
|
||||
|
||||
/**
|
||||
* Function ReplaceWires
|
||||
* replaces all of the wires and junction in the screen with \a aWireList.
|
||||
* @param aWireList List of wire to replace the existing wires with.
|
||||
*/
|
||||
void ReplaceWires( SCH_ITEM* aWireList );
|
||||
|
||||
/**
|
||||
* Function BreakSegment
|
||||
* checks every wire and bus for a intersection at \a aPoint and break into two segments
|
||||
|
|
|
@ -315,6 +315,8 @@ public:
|
|||
return doHitTest( aRect, aContained, aAccuracy );
|
||||
}
|
||||
|
||||
virtual bool CanIncrementLabel() const { return false; }
|
||||
|
||||
/**
|
||||
* @note - The DoXXX() functions below are used to enforce the interface while retaining
|
||||
* the ability of change the implementation behavior of derived classes. See
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "wxstruct.h"
|
||||
#include "base_struct.h"
|
||||
#include "richio.h"
|
||||
#include "class_pcb_screen.h"
|
||||
|
||||
#ifndef PCB_INTERNAL_UNIT
|
||||
#define PCB_INTERNAL_UNIT 10000
|
||||
|
@ -19,7 +20,6 @@
|
|||
|
||||
|
||||
/* Forward declarations of classes. */
|
||||
class PCB_SCREEN;
|
||||
class WinEDA_Toolbar;
|
||||
class WinEDA_CvpcbFrame;
|
||||
class WinEDA_PcbFrame;
|
||||
|
@ -108,13 +108,11 @@ public:
|
|||
virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
|
||||
virtual void UpdateStatusBar();
|
||||
|
||||
PCB_SCREEN* GetScreen() const
|
||||
virtual PCB_SCREEN* GetScreen() const
|
||||
{
|
||||
return (PCB_SCREEN*) EDA_DRAW_FRAME::GetBaseScreen();
|
||||
return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen();
|
||||
}
|
||||
|
||||
BASE_SCREEN* GetBaseScreen() const;
|
||||
|
||||
int BestZoom();
|
||||
|
||||
virtual void Show3D_Frame( wxCommandEvent& event );
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
#include "class_undoredo_container.h"
|
||||
#include "template_fieldnames.h"
|
||||
#include "block_commande.h"
|
||||
#include "class_sch_screen.h"
|
||||
|
||||
|
||||
class LIB_EDIT_FRAME;
|
||||
class LIB_VIEW_FRAME;
|
||||
class SCH_SCREEN;
|
||||
class DRAWSEGMENT;
|
||||
class DrawPickedStruct;
|
||||
class SCH_ITEM;
|
||||
|
@ -194,8 +194,6 @@ public:
|
|||
|
||||
SCH_SCREEN* GetScreen() const;
|
||||
|
||||
BASE_SCREEN* GetBaseScreen() const;
|
||||
|
||||
virtual wxString GetScreenDesc();
|
||||
|
||||
void InstallConfigFrame( wxCommandEvent& event );
|
||||
|
@ -305,12 +303,15 @@ public:
|
|||
* for each sheet annotation starts from sheet number * 100
|
||||
* ( the first sheet uses 100 to 199, the second 200 to 299 ... )
|
||||
*/
|
||||
void AnnotateComponents(bool aAnnotateSchematic, int aSortOption,
|
||||
int aAlgoOption,
|
||||
void AnnotateComponents( bool aAnnotateSchematic, int aSortOption, int aAlgoOption,
|
||||
bool aResetAnnotation, bool aRepairsTimestamps );
|
||||
|
||||
// Functions used for hierarchy handling
|
||||
void InstallPreviousSheet();
|
||||
void InstallNextScreen( SCH_SHEET* Sheet );
|
||||
/**
|
||||
* Function DisplayCurrentSheet
|
||||
* draws the current sheet on the display.
|
||||
*/
|
||||
void DisplayCurrentSheet();
|
||||
|
||||
/**
|
||||
* Function GetUniqueFilenameForCurrentSheet
|
||||
|
@ -457,9 +458,7 @@ private:
|
|||
SCH_NO_CONNECT* AddNoConnect( wxDC* aDC, const wxPoint& aPosition );
|
||||
|
||||
// Junction
|
||||
SCH_JUNCTION* CreateNewJunctionStruct( wxDC* DC,
|
||||
const wxPoint& pos,
|
||||
bool PutInUndoList = FALSE );
|
||||
SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = FALSE );
|
||||
|
||||
// Text ,label, glabel
|
||||
SCH_TEXT* CreateNewText( wxDC* DC, int type );
|
||||
|
|
|
@ -242,13 +242,13 @@ protected:
|
|||
int m_GridColor; // Grid color
|
||||
|
||||
private:
|
||||
BASE_SCREEN* m_CurrentScreen; ///< current used SCREEN
|
||||
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
|
||||
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
|
||||
|
||||
protected:
|
||||
void SetBaseScreen( BASE_SCREEN* aScreen )
|
||||
void SetScreen( BASE_SCREEN* aScreen )
|
||||
{
|
||||
m_CurrentScreen = aScreen;
|
||||
m_currentScreen = aScreen;
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -266,7 +266,7 @@ public:
|
|||
* is virtual and returns a pointer to a BASE_SCREEN or one of its
|
||||
* derivatives. It may be overloaded by derived classes.
|
||||
*/
|
||||
virtual BASE_SCREEN* GetBaseScreen() const { return m_CurrentScreen; }
|
||||
virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
|
||||
|
||||
void OnMenuOpen( wxMenuEvent& event );
|
||||
void OnMouseEvent( wxMouseEvent& event );
|
||||
|
|
|
@ -76,16 +76,11 @@ WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame()
|
|||
}
|
||||
|
||||
|
||||
BASE_SCREEN* WinEDA_BasePcbFrame::GetBaseScreen() const
|
||||
{
|
||||
return GetScreen();
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_BasePcbFrame::SetBoard( BOARD* aBoard )
|
||||
{
|
||||
if( m_Pcb != g_ModuleEditor_Pcb )
|
||||
delete m_Pcb;
|
||||
|
||||
m_Pcb = aBoard;
|
||||
}
|
||||
|
||||
|
@ -320,7 +315,8 @@ void WinEDA_BasePcbFrame::UpdateStatusBar()
|
|||
|
||||
if( DisplayOpt.DisplayPolarCood ) // display polar coordinates
|
||||
{
|
||||
BASE_SCREEN* screen = GetBaseScreen();
|
||||
PCB_SCREEN* screen = GetScreen();
|
||||
|
||||
if( !screen )
|
||||
return;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ protected:
|
|||
|
||||
STRINGSET m_Members; ///< names of NET members of this class
|
||||
|
||||
/// The units on these parameters is 1/10000 of an inch, see #define PCB_INTERNAL_UNIT
|
||||
/// The units on these parameters is 1/10000 of an inch, see define #PCB_INTERNAL_UNIT
|
||||
|
||||
int m_Clearance; ///< clearance when routing
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Frame_Ref )
|
|||
|
||||
SetPenWidth();
|
||||
|
||||
BASE_SCREEN* screen = m_Parent->GetBaseScreen();
|
||||
PCB_SCREEN* screen = m_Parent->GetScreen();
|
||||
|
||||
if( aPrintAll )
|
||||
m_PrintMaskLayer = 0xFFFFFFFF;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* at run time, on the fly.
|
||||
* So they cannot be static.
|
||||
*
|
||||
* Therefore they are defined by #define, used inside menu constructors
|
||||
* Therefore they are defined by \#define, used inside menu constructors
|
||||
*/
|
||||
|
||||
#define HELP_UNDO _( "Undo last edition" )
|
||||
|
|
|
@ -170,6 +170,7 @@ D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
|
|||
* @param aPosition Flag bits, tuning the search, see pcbnew.h
|
||||
* @param aActiveLayer Layer to test.
|
||||
* @param aVisibleOnly Search only the visible layers if true.
|
||||
* @param aIgnoreLocked Ignore locked modules when true.
|
||||
* @return MODULE* The best module or NULL if none.
|
||||
*/
|
||||
MODULE* Locate_Prefered_Module( BOARD* aPcb, const wxPoint& aPosition, int aActiveLayer,
|
||||
|
|
|
@ -175,7 +175,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
|
|||
|
||||
if( s_screenModule == NULL )
|
||||
s_screenModule = new PCB_SCREEN();
|
||||
SetBaseScreen( s_screenModule );
|
||||
SetScreen( s_screenModule );
|
||||
GetBoard()->SetBoardDesignSettings( &s_ModuleEditorDesignSetting );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
LoadSettings();
|
||||
|
@ -241,9 +241,8 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
|
|||
* here, because if we reopen the Footprint editor, we expect to find
|
||||
* the last edited item
|
||||
*/
|
||||
SetBaseScreen( NULL ); /* Do not delete (by the destructor of
|
||||
* EDA_DRAW_FRAME) the PCB_SCREEN handling
|
||||
* g_ModuleEditor_Pcb
|
||||
SetScreen( NULL ); /* Do not delete (by the destructor of EDA_DRAW_FRAME) the
|
||||
* PCB_SCREEN handling g_ModuleEditor_Pcb
|
||||
*/
|
||||
|
||||
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) GetParent();
|
||||
|
|
|
@ -142,7 +142,7 @@ FILE * OpenNetlistFile( const wxString& aFullFileName )
|
|||
* only the netlist will be used
|
||||
*
|
||||
* the format of the netlist is something like:
|
||||
# EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22
|
||||
* \# EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22
|
||||
* (
|
||||
* ( 40C08647 $noname R20 4,7K {Lib=R}
|
||||
* ( 1 VCC )
|
||||
|
@ -153,7 +153,7 @@ FILE * OpenNetlistFile( const wxString& aFullFileName )
|
|||
* ( 2 MODA_1 )
|
||||
* )
|
||||
* }
|
||||
* #End
|
||||
* \#End
|
||||
*/
|
||||
bool WinEDA_PcbFrame::ReadPcbNetlist( const wxString& aNetlistFullFilename,
|
||||
const wxString& aCmpFullFileName,
|
||||
|
|
|
@ -287,7 +287,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* parent,
|
|||
SetIcon( wxICON( a_icon_pcbnew ) );
|
||||
|
||||
m_InternalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch
|
||||
SetBaseScreen( ScreenPcb );
|
||||
SetScreen( ScreenPcb );
|
||||
|
||||
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
|
||||
// initialize parameters in m_LayersManager
|
||||
|
|
|
@ -119,7 +119,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
|||
double userscale;
|
||||
double DrawZoom = 1;
|
||||
wxDC* dc = GetDC();
|
||||
BASE_SCREEN* screen = m_Parent->GetBaseScreen();
|
||||
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
|
||||
bool printMirror = m_PrintParams.m_PrintMirror;
|
||||
|
||||
wxBusyCursor dummy;
|
||||
|
@ -243,7 +243,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
|||
panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) );
|
||||
panel->m_ClipBox.SetSize( wxSize( MAX_VALUE, MAX_VALUE ) );
|
||||
|
||||
m_Parent->GetBaseScreen()->m_IsPrinting = true;
|
||||
m_Parent->GetScreen()->m_IsPrinting = true;
|
||||
int bg_color = g_DrawBgColor;
|
||||
|
||||
if( m_PrintParams.m_Print_Sheet_Ref )
|
||||
|
@ -300,7 +300,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
|||
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror, &m_PrintParams );
|
||||
|
||||
g_DrawBgColor = bg_color;
|
||||
m_Parent->GetBaseScreen()->m_IsPrinting = false;
|
||||
m_Parent->GetScreen()->m_IsPrinting = false;
|
||||
panel->m_ClipBox = tmp;
|
||||
|
||||
GRForceBlackPen( false );
|
||||
|
|
Loading…
Reference in New Issue