Commit 6769e4c9 authored by charras's avatar charras

code cleaning and fixed a TODO remark in EDA_BoardDesignSettings::SetEnabledLayers( int aMask )

parent b275d34d
...@@ -287,8 +287,8 @@ void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -287,8 +287,8 @@ void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
screen->m_BlockLocate.m_State = STATE_NO_BLOCK; screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
screen->m_BlockLocate.m_Command = BLOCK_ABORT; screen->m_BlockLocate.m_Command = BLOCK_ABORT;
Panel->m_Parent->HandleBlockEnd( DC ); Panel->GetParent()->HandleBlockEnd( DC );
screen->m_BlockLocate.m_Command = BLOCK_IDLE; screen->m_BlockLocate.m_Command = BLOCK_IDLE;
Panel->m_Parent->DisplayToolMsg( wxEmptyString ); Panel->GetParent()->DisplayToolMsg( wxEmptyString );
} }
...@@ -61,7 +61,7 @@ bool DrawPage( WinEDA_DrawPanel* panel ) ...@@ -61,7 +61,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
/* scale is the ratio resolution/internal units */ /* scale is the ratio resolution/internal units */
float scale = 82.0 / panel->m_Parent->m_InternalUnits; float scale = 82.0 / panel->GetParent()->m_InternalUnits;
if( ActiveScreen->m_BlockLocate.m_Command != BLOCK_IDLE ) if( ActiveScreen->m_BlockLocate.m_Command != BLOCK_IDLE )
{ {
......
...@@ -103,8 +103,6 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, ...@@ -103,8 +103,6 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
WinEDA_DrawPanel::~WinEDA_DrawPanel() WinEDA_DrawPanel::~WinEDA_DrawPanel()
{ {
wxASSERT( wxGetApp().m_EDA_Config != NULL );
wxGetApp().m_EDA_Config->Write( wxT( "AutoPAN" ), m_AutoPAN_Enable ); wxGetApp().m_EDA_Config->Write( wxT( "AutoPAN" ), m_AutoPAN_Enable );
} }
...@@ -112,9 +110,6 @@ WinEDA_DrawPanel::~WinEDA_DrawPanel() ...@@ -112,9 +110,6 @@ WinEDA_DrawPanel::~WinEDA_DrawPanel()
BASE_SCREEN* WinEDA_DrawPanel::GetScreen() BASE_SCREEN* WinEDA_DrawPanel::GetScreen()
{ {
WinEDA_DrawFrame* parentFrame = m_Parent; WinEDA_DrawFrame* parentFrame = m_Parent;
wxASSERT( parentFrame );
return parentFrame->GetBaseScreen(); return parentFrame->GetBaseScreen();
} }
......
...@@ -578,7 +578,7 @@ EDA_Rect SCH_COMPONENT::GetBoundaryBox() const ...@@ -578,7 +578,7 @@ EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
} }
/* Used if undo / redo command: /* Used in undo / redo command:
* swap data between this and copyitem * swap data between this and copyitem
*/ */
void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem ) void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
......
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
void SetConvert( int convert ) void SetConvert( int convert )
{ {
wxASSERT( convert >= 1 ); wxASSERT( convert >= 0 );
m_convert = convert; m_convert = convert;
} }
......
...@@ -29,6 +29,13 @@ private: ...@@ -29,6 +29,13 @@ private:
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
wxString m_ConfigPath; // subpath for configuration wxString m_ConfigPath; // subpath for configuration
protected:
static wxString m_libraryName;
static wxString m_entryName;
static int m_unit;
static int m_convert;
static wxSize m_clientSize;
public: public:
WinEDA_ViewlibFrame( wxWindow* father, WinEDA_ViewlibFrame( wxWindow* father,
CMP_LIBRARY* Library = NULL, CMP_LIBRARY* Library = NULL,
...@@ -71,13 +78,6 @@ private: ...@@ -71,13 +78,6 @@ private:
void ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ); void ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
protected:
static wxString m_libraryName;
static wxString m_entryName;
static int m_unit;
static int m_convert;
static wxSize m_clientSize;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
...@@ -56,7 +56,7 @@ void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector ) ...@@ -56,7 +56,7 @@ void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector )
void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList ) void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList )
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->m_Parent; WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->GetParent();
PICKED_ITEMS_LIST itemsList; PICKED_ITEMS_LIST itemsList;
ITEM_PICKER itemWrapper; ITEM_PICKER itemWrapper;
...@@ -99,7 +99,7 @@ DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) ); ...@@ -99,7 +99,7 @@ DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) );
void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct ) void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->m_Parent; WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->GetParent();
if( !DrawStruct ) if( !DrawStruct )
return; return;
......
...@@ -113,7 +113,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -113,7 +113,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
if( item->m_Flags & IS_NEW ) if( item->m_Flags & IS_NEW )
{ {
if( item->Type() == COMPONENT_ARC_DRAW_TYPE ) if( item->Type() == COMPONENT_ARC_DRAW_TYPE )
Panel->m_Parent->RedrawActiveWindow( DC, TRUE ); Panel->GetParent()->RedrawActiveWindow( DC, TRUE );
else else
item->Draw( Panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL, item->Draw( Panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL,
DefaultTransformMatrix ); DefaultTransformMatrix );
......
...@@ -204,8 +204,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) ...@@ -204,8 +204,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
if( Flag == NEW_PART ) if( Flag == NEW_PART )
{ {
DisplayComponentsNamesInLib( this, Lib, CmpName, DisplayComponentsNamesInLib( this, Lib, CmpName, m_entryName );
m_entryName );
} }
if( Flag == NEXT_PART ) if( Flag == NEXT_PART )
......
...@@ -148,14 +148,7 @@ public: ...@@ -148,14 +148,7 @@ public:
* changes the bit-mask of enabled layers * changes the bit-mask of enabled layers
* @param aMask = The new bit-mask of enabled layers * @param aMask = The new bit-mask of enabled layers
*/ */
void SetEnabledLayers( int aMask ) void SetEnabledLayers( int aMask );
{
// TODO; ensure consistency with m_CopperLayerCount
m_EnabledLayers = aMask;
// A disabled layer cannot be visible
m_VisibleLayers &= aMask;
}
/** /**
......
...@@ -16,8 +16,10 @@ class PCB_SCREEN; ...@@ -16,8 +16,10 @@ class PCB_SCREEN;
class WinEDA_DrawPanel : public wxScrolledWindow class WinEDA_DrawPanel : public wxScrolledWindow
{ {
public: private:
WinEDA_DrawFrame* m_Parent; WinEDA_DrawFrame* m_Parent;
public:
EDA_Rect m_ClipBox; // the clipbox used in screen EDA_Rect m_ClipBox; // the clipbox used in screen
// redraw (usually gives the // redraw (usually gives the
// visible area in internal units) // visible area in internal units)
...@@ -74,12 +76,13 @@ public: ...@@ -74,12 +76,13 @@ public:
BASE_SCREEN* GetScreen(); BASE_SCREEN* GetScreen();
WinEDA_DrawFrame* GetParent()
{
return m_Parent;
}
bool IsPointOnDisplay( wxPoint ref_pos );
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
void SetBoundaryBox();
void ReDraw( wxDC* DC, bool erasebg = TRUE );
void PrintPage( wxDC* DC, void PrintPage( wxDC* DC,
bool Print_Sheet_Ref, bool Print_Sheet_Ref,
int PrintMask, int PrintMask,
...@@ -110,6 +113,10 @@ public: ...@@ -110,6 +113,10 @@ public:
bool OnRightClick( wxMouseEvent& event ); bool OnRightClick( wxMouseEvent& event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
bool IsPointOnDisplay( wxPoint ref_pos );
void SetBoundaryBox();
void ReDraw( wxDC* DC, bool erasebg = TRUE );
/** Function CursorRealPosition /** Function CursorRealPosition
* @return the position in user units of location ScreenPos * @return the position in user units of location ScreenPos
* @param ScreenPos = the screen (in pixel) position to convert * @param ScreenPos = the screen (in pixel) position to convert
...@@ -157,16 +164,12 @@ public: ...@@ -157,16 +164,12 @@ public:
void MouseTo( const wxPoint& Mouse ); void MouseTo( const wxPoint& Mouse );
/* Cursor functions */ /* Cursor functions */
void Trace_Curseur( wxDC* DC, int color = WHITE ); // Draw the // Draw the user cursor (grid cursor)
// user cursor void Trace_Curseur( wxDC* DC, int color = WHITE );
// (grid // remove the grid cursor from the display
// cursor) void CursorOff( wxDC* DC );
void CursorOff( wxDC* DC ); // remove the // display the grid cursor
// grid cursor void CursorOn( wxDC* DC );
// from the
// display
void CursorOn( wxDC* DC ); // display the
// grid cursor
/** /**
* Release managed cursor. * Release managed cursor.
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#define LAYER_COUNT 32 #define LAYER_COUNT 32
#define LAYER_BACK (1 << LAYER_N_BACK) ///< bit mask for copper layer
#define CUIVRE_LAYER (1 << LAYER_N_BACK) ///< bit mask for copper layer #define CUIVRE_LAYER (1 << LAYER_N_BACK) ///< bit mask for copper layer
#define LAYER_2 (1 << LAYER_N_2) ///< bit mask for layer 2 #define LAYER_2 (1 << LAYER_N_2) ///< bit mask for layer 2
#define LAYER_3 (1 << LAYER_N_3) ///< bit mask for layer 3 #define LAYER_3 (1 << LAYER_N_3) ///< bit mask for layer 3
...@@ -90,6 +91,7 @@ ...@@ -90,6 +91,7 @@
#define LAYER_14 (1 << LAYER_N_14) ///< bit mask for layer 14 #define LAYER_14 (1 << LAYER_N_14) ///< bit mask for layer 14
#define LAYER_15 (1 << LAYER_N_15) ///< bit mask for layer 15 #define LAYER_15 (1 << LAYER_N_15) ///< bit mask for layer 15
#define CMP_LAYER (1 << LAYER_N_FRONT) ///< bit mask for component layer #define CMP_LAYER (1 << LAYER_N_FRONT) ///< bit mask for component layer
#define LAYER_FRONT (1 << LAYER_N_FRONT) ///< bit mask for component layer
#define ADHESIVE_LAYER_CU (1 << ADHESIVE_N_CU) #define ADHESIVE_LAYER_CU (1 << ADHESIVE_N_CU)
#define ADHESIVE_LAYER_CMP (1 << ADHESIVE_N_CMP) #define ADHESIVE_LAYER_CMP (1 << ADHESIVE_N_CMP)
#define SOLDERPASTE_LAYER_CU (1 << SOLDERPASTE_N_CU) #define SOLDERPASTE_LAYER_CU (1 << SOLDERPASTE_N_CU)
......
...@@ -119,12 +119,39 @@ void EDA_BoardDesignSettings::SetCopperLayerCount( int aNewLayerCount ) ...@@ -119,12 +119,39 @@ void EDA_BoardDesignSettings::SetCopperLayerCount( int aNewLayerCount )
// ensure consistency with the m_EnabledLayers member // ensure consistency with the m_EnabledLayers member
m_EnabledLayers &= ~ALL_CU_LAYERS; m_EnabledLayers &= ~ALL_CU_LAYERS;
m_EnabledLayers |= CUIVRE_LAYER; m_EnabledLayers |= LAYER_BACK;
if( m_CopperLayerCount > 1 ) if( m_CopperLayerCount > 1 )
m_EnabledLayers |= CMP_LAYER; m_EnabledLayers |= LAYER_FRONT;
for( int ii = 1; ii < aNewLayerCount - 1; ii++ ) for( int ii = 1; ii < aNewLayerCount - 1; ii++ )
m_EnabledLayers |= 1 << ii; m_EnabledLayers |= 1 << ii;
} }
/**
* Function SetEnabledLayers
* changes the bit-mask of enabled layers
* @param aMask = The new bit-mask of enabled layers
*/
void EDA_BoardDesignSettings::SetEnabledLayers( int aMask )
{
m_EnabledLayers = aMask;
// Ensure consistency with m_CopperLayerCount
long enabledLayers = aMask & ~ALL_CU_LAYERS;
// Back and front layers are always existing (but not necessary enabled)
// so we must count them
enabledLayers |= LAYER_BACK|LAYER_FRONT;
long mask = 1;
m_CopperLayerCount = 0;
for( int ii = 0; ii < NB_COPPER_LAYERS; ii++, mask <<= 1 )
{
if( (aMask & mask) )
m_CopperLayerCount ++;
}
// A disabled layer cannot be visible
m_VisibleLayers &= aMask;
}
...@@ -169,7 +169,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -169,7 +169,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
color = g_DesignSettings.m_LayerColor[m_Layer]; color = g_DesignSettings.m_LayerColor[m_Layer];
frame = (WinEDA_BasePcbFrame*) panel->m_Parent; frame = (WinEDA_BasePcbFrame*) panel->GetParent();
screen = frame->GetScreen(); screen = frame->GetScreen();
...@@ -189,7 +189,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -189,7 +189,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( !typeaff ) if( !typeaff )
typeaff = SKETCH; typeaff = SKETCH;
} }
if( panel->GetScreen()->Scale( m_Width ) < L_MIN_DESSIN ) if( screen->Scale( m_Width ) < L_MIN_DESSIN )
typeaff = FILAIRE; typeaff = FILAIRE;
switch( type_trace ) switch( type_trace )
......
...@@ -38,7 +38,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -38,7 +38,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
if( m_Flags & DO_NOT_DRAW ) if( m_Flags & DO_NOT_DRAW )
return; return;
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent();
PCB_SCREEN* screen = frame->GetScreen(); PCB_SCREEN* screen = frame->GetScreen();
if( frame->m_DisplayPadFill == FILLED ) if( frame->m_DisplayPadFill == FILLED )
fillpad = 1; fillpad = 1;
......
...@@ -345,7 +345,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, ...@@ -345,7 +345,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
return; return;
screen = (PCB_SCREEN*) panel->GetScreen(); screen = (PCB_SCREEN*) panel->GetScreen();
frame = (WinEDA_BasePcbFrame*) panel->m_Parent; frame = (WinEDA_BasePcbFrame*) panel->GetParent();
pos.x = m_Pos.x - offset.x; pos.x = m_Pos.x - offset.x;
pos.y = m_Pos.y - offset.y; pos.y = m_Pos.y - offset.y;
......
...@@ -715,7 +715,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi ...@@ -715,7 +715,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int fillvia = 0; int fillvia = 0;
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent();
PCB_SCREEN* screen = frame->GetScreen(); PCB_SCREEN* screen = frame->GetScreen();
if( frame->m_DisplayViaFill == FILLED ) if( frame->m_DisplayViaFill == FILLED )
......
...@@ -208,7 +208,7 @@ static void Exit_EditCotation( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -208,7 +208,7 @@ static void Exit_EditCotation( WinEDA_DrawPanel* Panel, wxDC* DC )
status_cotation = 0; status_cotation = 0;
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
((WinEDA_PcbFrame*)Panel->m_Parent)->SetCurItem(NULL); ((WinEDA_PcbFrame*)Panel->GetParent())->SetCurItem(NULL);
} }
......
...@@ -524,6 +524,11 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event ) ...@@ -524,6 +524,11 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
m_EnabledLayers = getUILayerMask(); m_EnabledLayers = getUILayerMask();
m_Pcb->SetEnabledLayers( m_EnabledLayers ); m_Pcb->SetEnabledLayers( m_EnabledLayers );
/* Ensure enabled layers are also visible
* This is mainly to avoid mistakes if some enabled
* layers are not visible when exiting this dialog
*/
m_Pcb->SetVisibleLayers( m_EnabledLayers );
for( int layer = FIRST_COPPER_LAYER; for( int layer = FIRST_COPPER_LAYER;
layer <= LAST_COPPER_LAYER; ++layer ) layer <= LAST_COPPER_LAYER; ++layer )
......
...@@ -124,7 +124,7 @@ void Build_1_Pad_SegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, D_PAD* PtPad ...@@ -124,7 +124,7 @@ void Build_1_Pad_SegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, D_PAD* PtPad
int net_code = PtPad->GetNet(); int net_code = PtPad->GetNet();
int MasqueLayer; int MasqueLayer;
wxPoint pos; wxPoint pos;
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->GetBoard(); BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetBoard();
Track = pcb->m_Track->GetStartNetCode( net_code ); Track = pcb->m_Track->GetStartNetCode( net_code );
...@@ -197,7 +197,7 @@ void Collect_TrackSegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -197,7 +197,7 @@ void Collect_TrackSegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC,
* Les net_codes sont supposes a jour. * Les net_codes sont supposes a jour.
*/ */
{ {
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->GetBoard(); BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetBoard();
TRACK* track = pcb->m_Track->GetStartNetCode( net_code ); TRACK* track = pcb->m_Track->GetStartNetCode( net_code );
for( ; track; track = track->Next() ) for( ; track; track = track->Next() )
......
...@@ -33,7 +33,7 @@ void Abort_Edit_Pcb_Text( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -33,7 +33,7 @@ void Abort_Edit_Pcb_Text( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
( (WinEDA_PcbFrame*) Panel->m_Parent )->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
TEXTE_PCB* TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem(); TEXTE_PCB* TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem();
......
...@@ -192,7 +192,7 @@ static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -192,7 +192,7 @@ static void Exit_EditEdge( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
( (WinEDA_PcbFrame*) Panel->m_Parent )->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
} }
......
...@@ -35,7 +35,7 @@ static PICKED_ITEMS_LIST s_ItemsListPicker; ...@@ -35,7 +35,7 @@ static PICKED_ITEMS_LIST s_ItemsListPicker;
*/ */
static void Exit_Editrack( WinEDA_DrawPanel* Panel, wxDC* DC ) static void Exit_Editrack( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) Panel->m_Parent; WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) Panel->GetParent();
TRACK* track = (TRACK*) frame->GetCurItem(); TRACK* track = (TRACK*) frame->GetCurItem();
if( track && ( track->Type()==TYPE_VIA || track->Type()==TYPE_TRACK ) ) if( track && ( track->Type()==TYPE_VIA || track->Type()==TYPE_TRACK ) )
...@@ -616,7 +616,7 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack ) ...@@ -616,7 +616,7 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack )
*/ */
static void PushTrack( WinEDA_DrawPanel* panel ) static void PushTrack( WinEDA_DrawPanel* panel )
{ {
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->GetBoard(); BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetBoard();
wxPoint cursor = ActiveScreen->m_Curseur; wxPoint cursor = ActiveScreen->m_Curseur;
wxPoint cv, vec, n; wxPoint cv, vec, n;
TRACK* track = g_CurrentTrackSegment; TRACK* track = g_CurrentTrackSegment;
...@@ -682,7 +682,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, ...@@ -682,7 +682,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen();
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent();
bool Track_fill_copy = DisplayOpt.DisplayPcbTrackFill; bool Track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.DisplayPcbTrackFill = true; DisplayOpt.DisplayPcbTrackFill = true;
......
...@@ -181,7 +181,7 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -181,7 +181,7 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
( (WinEDA_PcbFrame*) Panel->m_Parent )->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
if( MirePcb == NULL ) if( MirePcb == NULL )
return; return;
......
...@@ -53,7 +53,7 @@ void Show_Pads_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module ) ...@@ -53,7 +53,7 @@ void Show_Pads_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
*/ */
void Rastnest_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module ) void Rastnest_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
{ {
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent();
frame->build_ratsnest_module( DC, module ); frame->build_ratsnest_module( DC, module );
frame->trace_ratsnest_module( DC ); frame->trace_ratsnest_module( DC );
...@@ -153,7 +153,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -153,7 +153,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
DRAG_SEGM* pt_drag; DRAG_SEGM* pt_drag;
TRACK* pt_segm; TRACK* pt_segm;
MODULE* module; MODULE* module;
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->m_Parent; WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->GetParent();
module = (MODULE*) pcbframe->GetScreen()->GetCurItem(); module = (MODULE*) pcbframe->GetScreen()->GetCurItem();
pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK; pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
...@@ -594,7 +594,7 @@ void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module ) ...@@ -594,7 +594,7 @@ void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
if( g_Show_Module_Ratsnest && panel ) if( g_Show_Module_Ratsnest && panel )
{ {
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent();
frame->build_ratsnest_module( DC, module ); frame->build_ratsnest_module( DC, module );
frame->trace_ratsnest_module( DC ); frame->trace_ratsnest_module( DC );
} }
......
...@@ -62,7 +62,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -62,7 +62,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->GetScreen()->m_Curseur = oldpos; Panel->GetScreen()->m_Curseur = oldpos;
g_HightLigt_Status = FALSE; g_HightLigt_Status = FALSE;
( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight( ( (WinEDA_PcbFrame*) Panel->GetParent() )->GetBoard()->DrawHighLight(
Panel, Panel,
DC, DC,
g_HightLigth_NetCode ); g_HightLigth_NetCode );
...@@ -107,7 +107,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -107,7 +107,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
( (WinEDA_PcbFrame*) Panel->m_Parent )->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
/* Undo move and redraw trace segments. */ /* Undo move and redraw trace segments. */
DRAG_SEGM* pt_drag = g_DragSegmentList; DRAG_SEGM* pt_drag = g_DragSegmentList;
...@@ -126,7 +126,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -126,7 +126,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
g_HightLigth_NetCode = Old_HightLigth_NetCode; g_HightLigth_NetCode = Old_HightLigth_NetCode;
g_HightLigt_Status = Old_HightLigt_Status; g_HightLigt_Status = Old_HightLigt_Status;
if( g_HightLigt_Status ) if( g_HightLigt_Status )
( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight( ( (WinEDA_PcbFrame*) Panel->GetParent() )->GetBoard()->DrawHighLight(
Panel, Panel,
DC, DC,
g_HightLigth_NetCode ); g_HightLigth_NetCode );
...@@ -194,7 +194,7 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -194,7 +194,7 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
DisplayOpt.DisplayPcbTrackFill = track_fill_copy; DisplayOpt.DisplayPcbTrackFill = track_fill_copy;
// Display track length // Display track length
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent();
Track->DisplayInfo( frame ); Track->DisplayInfo( frame );
} }
...@@ -454,7 +454,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel, ...@@ -454,7 +454,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
tSegmentToEnd->Draw( panel, DC, draw_mode ); tSegmentToEnd->Draw( panel, DC, draw_mode );
// Display track length // Display track length
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent();
Track->DisplayInfo( frame ); Track->DisplayInfo( frame );
} }
......
...@@ -200,12 +200,12 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -200,12 +200,12 @@ static void Print_Module( WinEDA_DrawPanel* panel, wxDC* DC,
if( (masklayer & ALL_CU_LAYERS) == 0 ) if( (masklayer & ALL_CU_LAYERS) == 0 )
{ {
int tmp_fill = int tmp_fill =
( (WinEDA_BasePcbFrame*) panel->m_Parent )->m_DisplayPadFill; ( (WinEDA_BasePcbFrame*) panel->GetParent() )->m_DisplayPadFill;
// Switch in sketch mode // Switch in sketch mode
( (WinEDA_BasePcbFrame*) panel->m_Parent )->m_DisplayPadFill = 0; ( (WinEDA_BasePcbFrame*) panel->GetParent() )->m_DisplayPadFill = 0;
pt_pad->Draw( panel, DC, draw_mode ); pt_pad->Draw( panel, DC, draw_mode );
( (WinEDA_BasePcbFrame*) panel->m_Parent )->m_DisplayPadFill = ( (WinEDA_BasePcbFrame*) panel->GetParent() )->m_DisplayPadFill =
tmp_fill; tmp_fill;
} }
else // on copper layer, draw pads according to current options else // on copper layer, draw pads according to current options
......
...@@ -33,7 +33,7 @@ void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, ...@@ -33,7 +33,7 @@ void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
WinEDA_BasePcbFrame* frame; WinEDA_BasePcbFrame* frame;
screen = (PCB_SCREEN*) panel->GetScreen(); screen = (PCB_SCREEN*) panel->GetScreen();
frame = (WinEDA_BasePcbFrame*) panel->m_Parent; frame = (WinEDA_BasePcbFrame*) panel->GetParent();
tmp = frame->m_DisplayPadFill; tmp = frame->m_DisplayPadFill;
frame->m_DisplayPadFill = FALSE; frame->m_DisplayPadFill = FALSE;
......
...@@ -139,7 +139,7 @@ static void Abort_Zone_Create_Outline( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -139,7 +139,7 @@ static void Abort_Zone_Create_Outline( WinEDA_DrawPanel* Panel, wxDC* DC )
* cancels the Begin_Zone command if at least one EDGE_ZONE was created. * cancels the Begin_Zone command if at least one EDGE_ZONE was created.
*/ */
{ {
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->m_Parent; WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->GetParent();
ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour; ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
if( zone ) if( zone )
...@@ -383,7 +383,7 @@ void Abort_Zone_Move_Corner_Or_Outlines( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -383,7 +383,7 @@ void Abort_Zone_Move_Corner_Or_Outlines( WinEDA_DrawPanel* Panel, wxDC* DC )
* cancels the Begin_Zone state if at least one EDGE_ZONE has been created. * cancels the Begin_Zone state if at least one EDGE_ZONE has been created.
*/ */
{ {
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->m_Parent; WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->GetParent();
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) pcbframe->GetCurItem(); ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) pcbframe->GetCurItem();
if( zone_container->m_Flags == IS_MOVED ) if( zone_container->m_Flags == IS_MOVED )
...@@ -431,7 +431,7 @@ void Show_Zone_Corner_Or_Outline_While_Move_Mouse( WinEDA_DrawPanel* Panel, wxDC ...@@ -431,7 +431,7 @@ void Show_Zone_Corner_Or_Outline_While_Move_Mouse( WinEDA_DrawPanel* Panel, wxDC
/* Redraws the zone outline when moving a corner according to the cursor position /* Redraws the zone outline when moving a corner according to the cursor position
*/ */
{ {
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->m_Parent; WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->GetParent();
ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem(); ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem();
if( erase ) /* Undraw edge in old position*/ if( erase ) /* Undraw edge in old position*/
...@@ -727,7 +727,7 @@ static void Show_New_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, b ...@@ -727,7 +727,7 @@ static void Show_New_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, b
/* Redraws the zone outlines when moving mouse /* Redraws the zone outlines when moving mouse
*/ */
{ {
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) panel->m_Parent; WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) panel->GetParent();
wxPoint c_pos = pcbframe->GetScreen()->m_Curseur; wxPoint c_pos = pcbframe->GetScreen()->m_Curseur;
ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour; ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
......
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