Commit 0d8cb9b5 authored by Wayne Stambaugh's avatar Wayne Stambaugh

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