7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-14 19:49:36 +00:00

BOARD_ITEM::Draw()

This commit is contained in:
dickelbeck 2008-04-01 05:21:50 +00:00
parent c439e0da05
commit aa93f54d97
56 changed files with 755 additions and 830 deletions

View File

@ -10,6 +10,10 @@ email address.
+all
Tweaked class MsgPanel so that the screen drawing only happens from
its OnPaint() function.
+pcbnew
Added virtual BOARD_ITEM::Draw() and forced all BOARD_ITEM derived classes
to implement it so that all these functions are also virtual.
Made the offset argument default to the new wxPoint BOARD_ITEM::ZeroOffset
2008-Mar-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>

View File

@ -94,7 +94,7 @@ void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( Module )
{
Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_COPY );
Module->Draw( DrawPanel, DC, GR_COPY );
Module->Display_Infos( this );
}

View File

@ -574,6 +574,11 @@ public:
}
/**
* A value of wxPoint(0,0) which can be passed to the Draw() functions.
*/
static wxPoint ZeroOffset;
BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
@ -600,6 +605,18 @@ public:
void SetLayer( int aLayer ) { m_Layer = aLayer; }
/**
* Function Draw
* overrides Draw() from EDA_BaseStruct in order to make it virtual
* without the default color argument, which is more appropriate for
* BOARD_ITEMs which have their own color information.
*/
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset )
{
}
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so

View File

@ -287,7 +287,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb )
PutOnGrid( &m_CurrentScreen->m_Curseur );
Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
Module->Draw( DrawPanel, DC, GR_XOR );
Place_Module( Module, DC ); /* positionne Module et recalcule cadre */
current.x += Module->m_RealBoundaryBox.GetWidth() + pas_grille;
@ -309,7 +309,7 @@ void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe )
if( Module ) /* Traitement du module */
{
Module->SetLocked( Fixe );
Module->Display_Infos( this );
GetScreen()->SetModify();
}
@ -354,9 +354,9 @@ void WinEDA_PcbFrame::ReOrientModules( const wxString& ModuleMask,
if( WildCompareString( ModuleMask, Module->m_Reference->m_Text, FALSE ) )
{
m_CurrentScreen->SetModify();
Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
Module->Draw( DrawPanel, DC, GR_XOR );
Rotate_Module( NULL, Module, Orient, FALSE );
Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
Module->Draw( DrawPanel, DC, GR_OR );
}
}
}

View File

@ -182,7 +182,7 @@ void WinEDA_PcbFrame::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC
if( Module->m_ModuleStatus & MODULE_to_PLACE ) // Erase from screen
{
NbModules++;
Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
Module->Draw( DrawPanel, DC, GR_XOR );
}
else
{
@ -379,13 +379,13 @@ int WinEDA_PcbFrame::GenPlaceBoard()
* et initialise les cellules du board a
* - HOLE pour les cellules occupees par un segment EDGE
* - CELL_is_ZONE pour les cellules internes au contour EDGE (s'il est ferme)
*
*
* la surface de placement (board) donne les cellules internes au contour
* du pcb, et parmi celle-ci les cellules libres et les cellules deja occupees
*
*
* le bitmap des penalites donnent les cellules occupes par les modules,
* augmentes d'une surface de penalite liee au nombre de pads du module
*
*
* le bitmap des penalites est mis a 0
* l'occupation des cellules est laisse a 0
*/
@ -720,7 +720,7 @@ int TstRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side )
/* tst si la surface rectangulaire (ux,y0 .. ux,y1):
* - est sur une zone libre ( retourne OCCUPED_By_MODULE sinon)
* - est sur la surface utile du board ( retourne OUT_OF_BOARD sinon)
*
*
* retourne 0 si OK
*/
{
@ -873,7 +873,7 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
return -1;
pt_local_chevelu = local_liste_chevelu;
ii = nb_local_chevelu;
ii = nb_local_chevelu;
cout = 0;
while( ii-- > 0 )
@ -892,18 +892,18 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC )
}
/* Evaluation du cout du chevelu: */
dx = fx - ox;
dx = fx - ox;
dy = fy - oy;
dx = abs( dx );
dx = abs( dx );
dy = abs( dy );
if( dx < dy )
EXCHG( dx, dy );/* dx >= dy */
/* cout de la distance: */
icout = (float) dx * dx;
/* cout de l'inclinaison */
icout += 3 * (float) dy * dy;
icout = sqrt( icout );
@ -926,10 +926,10 @@ void Build_PlacedPads_List( BOARD* Pcb )
* des caract utiles des pads du PCB pour Placement Automatique )
* Cette liste est restreinte a la liste des pads des modules deja places sur
* la carte.
*
*
* parametres:
* adresse du buffer de classement = Pcb->ptr_pads;
*
*
* Variables globales mise a jour:
* pointeur ptr_pads (adr de classement de la liste des pads)
* nb_pads = nombre utile de pastilles classes

View File

@ -79,12 +79,12 @@ static bool InstallBlockCmdFrame( WinEDA_BasePcbFrame* parent,
parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_ExecBlockCmdFrame* frame = new WinEDA_ExecBlockCmdFrame( parent, title );
nocmd = frame->ShowModal();
nocmd = frame->ShowModal();
frame->Destroy();
parent->GetScreen()->m_Curseur = oldpos;
parent->DrawPanel->MouseToCursorSchema();
parent->DrawPanel->m_IgnoreMouseEvents = FALSE;
@ -117,7 +117,7 @@ WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
fgSizer1 = new wxFlexGridSizer( 1, 1, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
// Selection des options :
m_Include_Modules = new wxCheckBox( this, -1, _( "Include Modules" ), wxDefaultPosition, wxDefaultSize, 0 );
m_Include_Modules->SetValue( Block_Include_Modules );
@ -403,7 +403,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
int Color;
BASE_SCREEN* screen = panel->GetScreen();
Color = YELLOW;
Color = YELLOW;
GRSetDrawMode( DC, g_XorMode );
/* Effacement ancien cadre */
@ -463,11 +463,11 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
{
NextS = module->Next();
if( module->HitTest( GetScreen()->BlockLocate ) )
{
module->m_Flags = 0;
module->DeleteStructure();
m_Pcb->m_Status_Pcb = 0;
}
{
module->m_Flags = 0;
module->DeleteStructure();
m_Pcb->m_Status_Pcb = 0;
}
}
}
@ -480,7 +480,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
{
NextS = pt_segm->Next();
if( pt_segm->HitTest( GetScreen()->BlockLocate ) )
{
{
/* la piste est ici bonne a etre efface */
pt_segm->DeleteStructure();
}
@ -491,7 +491,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
masque_layer = EDGE_LAYER;
if( Block_Include_Draw_Items )
masque_layer = ALL_LAYERS;
if( !Block_Include_Edges_Items )
masque_layer &= ~EDGE_LAYER;
@ -520,14 +520,12 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* le texte est ici bon a etre efface */
( (TEXTE_PCB*) PtStruct )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
PtStruct->Draw( DrawPanel, DC, GR_XOR );
/* Suppression du texte en Memoire*/
PtStruct->DeleteStructure();
break;
case TYPEMIRE:
#undef STRUCT
#define STRUCT ( (MIREPCB*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -537,8 +535,6 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
break;
case TYPECOTATION:
#undef STRUCT
#define STRUCT ( (COTATION*) PtStruct )
if( (g_TabOneLayerMask[STRUCT->GetLayer()] & masque_layer) == 0 )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
@ -561,29 +557,29 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
{
NextSegZ = pt_segm->Next();
if( pt_segm->HitTest( GetScreen()->BlockLocate ) )
{
{
pt_segm->DeleteStructure();
}
}
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
{
m_Pcb->Delete(m_Pcb->GetArea(ii));
ii--; // because the current data was removed, ii points actually the next data
}
}
{
m_Pcb->Delete(m_Pcb->GetArea(ii));
ii--; // because the current data was removed, ii points actually the next data
}
}
}
DrawPanel->Refresh( TRUE );
if( g_Show_Ratsnest )
Compile_Ratsnest( DC, TRUE );
else
{
m_Pcb->m_Status_Pcb = 0; /* we need (later) a full ratnest computation */
build_liste_pads();
}
else
{
m_Pcb->m_Status_Pcb = 0; /* we need (later) a full ratnest computation */
build_liste_pads();
}
}
@ -666,19 +662,19 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
while( track )
{
if( track->HitTest( GetScreen()->BlockLocate ) )
{
{
RotatePoint( &track->m_Start, centre, 900 );
RotatePoint( &track->m_End, centre, 900 );
}
track = track->Next();
}
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
{
m_Pcb->GetArea(ii)->Rotate(centre, 900);
}
}
{
m_Pcb->GetArea(ii)->Rotate(centre, 900);
}
}
}
masque_layer = EDGE_LAYER;
@ -848,14 +844,14 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
}
track = (TRACK*) track->Pnext;
}
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
{
m_Pcb->GetArea(ii)->Mirror( wxPoint(0, centerY) );
{
m_Pcb->GetArea(ii)->Mirror( wxPoint(0, centerY) );
m_Pcb->GetArea(ii)->SetLayer( ChangeSideNumLayer( m_Pcb->GetArea(ii)->GetLayer() ) );
}
}
}
}
}
masque_layer = EDGE_LAYER;
@ -925,7 +921,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
break;
/* l'element est ici bon a etre modifie */
STRUCT->Mirror( wxPoint(0, centerY) );
STRUCT->Mirror( wxPoint(0, centerY) );
STRUCT->SetLayer( ChangeSideNumLayer( STRUCT->GetLayer() ) );
break;
@ -1018,13 +1014,13 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
}
track = (TRACK*) track->Pnext;
}
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
for ( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
{
m_Pcb->GetArea(ii)->Move( MoveVector );
}
}
{
m_Pcb->GetArea(ii)->Move( MoveVector );
}
}
}
masque_layer = EDGE_LAYER;
@ -1046,7 +1042,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
STRUCT->m_Start += MoveVector;
STRUCT->m_Start += MoveVector;
STRUCT->m_End += MoveVector;
break;
@ -1081,7 +1077,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre efface */
( (COTATION*) PtStruct )->Move( wxPoint(MoveVector) );
( (COTATION*) PtStruct )->Move( wxPoint(MoveVector) );
break;
default:
@ -1107,7 +1103,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
EDA_BaseStruct* PtStruct;
int masque_layer;
wxPoint oldpos;
wxPoint MoveVector = GetScreen()->BlockLocate.m_MoveVector;
wxPoint MoveVector = GetScreen()->BlockLocate.m_MoveVector;
oldpos = GetScreen()->m_Curseur;
DrawPanel->ManageCurseur = NULL;
@ -1124,7 +1120,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
if( Block_Include_Modules )
{
bool Show_Ratsnest_tmp = g_Show_Ratsnest;
g_Show_Ratsnest = false;
g_Show_Ratsnest = false;
module = m_Pcb->m_Modules;
oldpos = GetScreen()->m_Curseur;
@ -1143,7 +1139,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
new_module->Pback = m_Pcb;
m_Pcb->m_Modules->Pback = new_module;
m_Pcb->m_Modules = new_module;
GetScreen()->m_Curseur = module->m_Pos + MoveVector;
GetScreen()->m_Curseur = module->m_Pos + MoveVector;
Place_Module( new_module, DC );
}
@ -1160,7 +1156,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{
next_track = track->Next();
if( track->HitTest( GetScreen()->BlockLocate ) )
{
{
/* la piste est ici bonne a etre deplacee */
m_Pcb->m_Status_Pcb = 0;
new_track = track->Copy();
@ -1181,7 +1177,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
while( segzone )
{
if( segzone->HitTest( GetScreen()->BlockLocate ) )
{
{
new_segzone = (SEGZONE*) segzone->Copy();
new_segzone->Insert( m_Pcb, NULL );
new_segzone->m_Start += MoveVector;
@ -1191,19 +1187,19 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
segzone = segzone->Next();
}
unsigned imax = m_Pcb->GetAreaCount();
for ( unsigned ii = 0; ii < imax; ii++ )
{
unsigned imax = m_Pcb->GetAreaCount();
for ( unsigned ii = 0; ii < imax; ii++ )
{
if( m_Pcb->GetArea(ii)->HitTest( GetScreen()->BlockLocate ) )
{
ZONE_CONTAINER * new_zone = new ZONE_CONTAINER(m_Pcb);
new_zone->Copy( m_Pcb->GetArea(ii) );
new_zone->m_TimeStamp = GetTimeStamp();
new_zone->Move( MoveVector );
m_Pcb->Add(new_zone);
new_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
}
}
{
ZONE_CONTAINER * new_zone = new ZONE_CONTAINER(m_Pcb);
new_zone->Copy( m_Pcb->GetArea(ii) );
new_zone->m_TimeStamp = GetTimeStamp();
new_zone->Move( MoveVector );
m_Pcb->Add(new_zone);
new_zone->Draw( DrawPanel, DC, GR_OR );
}
}
}
masque_layer = EDGE_LAYER;
@ -1225,11 +1221,11 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
break;
if( ! PtStruct->HitTest( GetScreen()->BlockLocate ) )
break;
/* l'element est ici bon a etre copie */
DRAWSEGMENT* new_drawsegment = new DRAWSEGMENT( m_Pcb );
new_drawsegment->Copy( STRUCT );
new_drawsegment->Pnext = m_Pcb->m_Drawings;
new_drawsegment->Pback = m_Pcb;
m_Pcb->m_Drawings->Pback = new_drawsegment;
@ -1257,7 +1253,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
m_Pcb->m_Drawings = new_pcbtext;
/* Redessin du Texte */
new_pcbtext->m_Pos += MoveVector;
new_pcbtext->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
new_pcbtext->Draw( DrawPanel, DC, GR_OR );
break;
}
@ -1277,7 +1273,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
m_Pcb->m_Drawings->Pback = new_mire;
m_Pcb->m_Drawings = new_mire;
new_mire->m_Pos += MoveVector;
new_mire->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
new_mire->Draw( DrawPanel, DC, GR_OR );
break;
}
@ -1296,8 +1292,8 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
new_cotation->Pback = m_Pcb;
m_Pcb->m_Drawings->Pback = new_cotation;
m_Pcb->m_Drawings = new_cotation;
new_cotation->Move( MoveVector );
new_cotation->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
new_cotation->Move( MoveVector );
new_cotation->Draw( DrawPanel, DC, GR_OR );
break;
}

View File

@ -293,7 +293,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{
DrawBlockStruct* PtBlock;
BASE_SCREEN* screen = panel->m_Parent->GetScreen();
EDA_BaseStruct* item;
BOARD_ITEM* item;
wxPoint move_offset;
MODULE* Currentmodule = g_EDA_Appl->m_ModuleEditFrame->m_Pcb->m_Modules;
@ -320,11 +320,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
switch( item->Type() )
{
case TYPETEXTEMODULE:
( (TEXTE_MODULE*) item )->Draw( panel, DC, move_offset, g_XorMode );
break;
case TYPEEDGEMODULE:
( (EDGE_MODULE*) item )->Draw( panel, DC, move_offset, g_XorMode );
item->Draw( panel, DC, g_XorMode, move_offset );
break;
default:
@ -337,7 +334,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{
if( pad->m_Selected == 0 )
continue;
pad->Draw( panel, DC, move_offset, g_XorMode );
pad->Draw( panel, DC, g_XorMode, move_offset );
}
}
}
@ -365,11 +362,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
switch( item->Type() )
{
case TYPETEXTEMODULE:
( (TEXTE_MODULE*) item )->Draw( panel, DC, move_offset, g_XorMode );
break;
case TYPEEDGEMODULE:
( (EDGE_MODULE*) item )->Draw( panel, DC, move_offset, g_XorMode );
item->Draw( panel, DC, g_XorMode, move_offset );
break;
default:
@ -382,7 +376,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{
if( pad->m_Selected == 0 )
continue;
pad->Draw( panel, DC, move_offset, g_XorMode );
pad->Draw( panel, DC, g_XorMode, move_offset );
}
}
}
@ -495,13 +489,13 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
case TYPEEDGEMODULE:
( (EDGE_MODULE*) item )->m_Start.x += offset.x;
( (EDGE_MODULE*) item )->m_Start.y += offset.y;
( (EDGE_MODULE*) item )->m_End.x += offset.x;
( (EDGE_MODULE*) item )->m_End.y += offset.y;
( (EDGE_MODULE*) item )->m_Start0.x += offset.x;
( (EDGE_MODULE*) item )->m_Start0.y += offset.y;
( (EDGE_MODULE*) item )->m_End0.x += offset.x;
( (EDGE_MODULE*) item )->m_End0.y += offset.y;
break;
@ -596,7 +590,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
SETMIRROR( ( (TEXTE_MODULE*) item )->GetPosition().x );
( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->GetPosition().x;
break;
default:
;
}
@ -650,7 +644,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->GetPosition();
( (TEXTE_MODULE*) item )->m_Orient += 900;
break;
default:
;
}

View File

@ -7,6 +7,12 @@
#include "pcbnew.h"
/* This is an odd place for this, but cvpcb won't link if it is
in class_board_item.cpp like I first tried it.
*/
wxPoint BOARD_ITEM::ZeroOffset(0,0);
/*****************/
/* Class BOARD: */
/*****************/
@ -1037,7 +1043,7 @@ void BOARD::RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMo
{
ZONE_CONTAINER* edge_zone = GetArea(ii);
if( (aLayer < 0) || (aLayer == edge_zone->GetLayer()) )
edge_zone->Draw( panel, aDC, wxPoint( 0, 0 ), aDrawMode );
edge_zone->Draw( panel, aDC, aDrawMode );
}
}

View File

@ -16,6 +16,7 @@
#include "Add_Mires.xpm"
/********************************************************/
wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
/********************************************************/

View File

@ -69,7 +69,7 @@ wxString COTATION:: GetText( void )
/* Reutun the dimension text
*/
{
return m_Text->m_Text;
return m_Text->m_Text;
}
@ -123,7 +123,7 @@ bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
if( Line[0] == 'G' )
{
int layer;
sscanf( Line + 2, " %d %d %lX", &m_Shape, &layer, &m_TimeStamp );
/* Mise a jour des param .layer des sous structures */
@ -234,22 +234,22 @@ void COTATION::Move(const wxPoint& offset)
* @param offset : moving vector
*/
{
m_Pos += offset;
m_Text->m_Pos += offset;
Barre_ox += offset.x; Barre_oy += offset.y;
Barre_fx += offset.x; Barre_fy += offset.y;
TraitG_ox += offset.x; TraitG_oy += offset.y;
TraitG_fx += offset.x; TraitG_fy += offset.y;
TraitD_ox += offset.x; TraitD_oy += offset.y;
TraitD_fx += offset.x; TraitD_fy += offset.y;
FlecheG1_ox += offset.x; FlecheG1_oy += offset.y;
FlecheG1_fx += offset.x; FlecheG1_fy += offset.y;
FlecheG2_ox += offset.x; FlecheG2_oy += offset.y;
FlecheG2_fx += offset.x; FlecheG2_fy += offset.y;
FlecheD1_ox += offset.x; FlecheD1_oy += offset.y;
FlecheD1_fx += offset.x; FlecheD1_fy += offset.y;
FlecheD2_ox += offset.x; FlecheD2_oy += offset.y;
FlecheD2_fx += offset.x; FlecheD2_fy += offset.y;
m_Pos += offset;
m_Text->m_Pos += offset;
Barre_ox += offset.x; Barre_oy += offset.y;
Barre_fx += offset.x; Barre_fy += offset.y;
TraitG_ox += offset.x; TraitG_oy += offset.y;
TraitG_fx += offset.x; TraitG_fy += offset.y;
TraitD_ox += offset.x; TraitD_oy += offset.y;
TraitD_fx += offset.x; TraitD_fy += offset.y;
FlecheG1_ox += offset.x; FlecheG1_oy += offset.y;
FlecheG1_fx += offset.x; FlecheG1_fy += offset.y;
FlecheG2_ox += offset.x; FlecheG2_oy += offset.y;
FlecheG2_fx += offset.x; FlecheG2_fy += offset.y;
FlecheD1_ox += offset.x; FlecheD1_oy += offset.y;
FlecheD1_fx += offset.x; FlecheD1_fy += offset.y;
FlecheD2_ox += offset.x; FlecheD2_oy += offset.y;
FlecheD2_fx += offset.x; FlecheD2_fy += offset.y;
}
@ -262,30 +262,30 @@ void COTATION::Rotate(const wxPoint& centre, int angle)
* @param angle : Rotation angle in 0.1 degrees
*/
{
RotatePoint( &m_Pos, centre, 900 );
RotatePoint( &m_Pos, centre, 900 );
RotatePoint( &m_Text->m_Pos, centre, 900 );
m_Text->m_Orient += 900;
if( m_Text->m_Orient >= 3600 )
m_Text->m_Orient -= 3600;
if( (m_Text->m_Orient > 900)
&& (m_Text->m_Orient <2700) )
m_Text->m_Orient -= 1800;
RotatePoint( &m_Text->m_Pos, centre, 900 );
m_Text->m_Orient += 900;
if( m_Text->m_Orient >= 3600 )
m_Text->m_Orient -= 3600;
if( (m_Text->m_Orient > 900)
&& (m_Text->m_Orient <2700) )
m_Text->m_Orient -= 1800;
RotatePoint( &Barre_ox, &Barre_oy, centre.x, centre.y, 900 );
RotatePoint( &Barre_fx, &Barre_fy, centre.x, centre.y, 900 );
RotatePoint( &TraitG_ox, &TraitG_oy, centre.x, centre.y, 900 );
RotatePoint( &TraitG_fx, &TraitG_fy, centre.x, centre.y, 900 );
RotatePoint( &TraitD_ox, &TraitD_oy, centre.x, centre.y, 900 );
RotatePoint( &TraitD_fx, &TraitD_fy, centre.x, centre.y, 900 );
RotatePoint( &FlecheG1_ox, &FlecheG1_oy, centre.x, centre.y, 900 );
RotatePoint( &FlecheG1_fx, &FlecheG1_fy, centre.x, centre.y, 900 );
RotatePoint( &FlecheG2_ox, &FlecheG2_oy, centre.x, centre.y, 900 );
RotatePoint( &FlecheG2_fx, &FlecheG2_fy, centre.x, centre.y, 900 );
RotatePoint( &FlecheD1_ox, &FlecheD1_oy, centre.x, centre.y, 900 );
RotatePoint( &FlecheD1_fx, &FlecheD1_fy, centre.x, centre.y, 900 );
RotatePoint( &FlecheD2_ox, &FlecheD2_oy, centre.x, centre.y, 900 );
RotatePoint( &FlecheD2_fx, &FlecheD2_fy, centre.x, centre.y, 900 );
RotatePoint( &Barre_ox, &Barre_oy, centre.x, centre.y, 900 );
RotatePoint( &Barre_fx, &Barre_fy, centre.x, centre.y, 900 );
RotatePoint( &TraitG_ox, &TraitG_oy, centre.x, centre.y, 900 );
RotatePoint( &TraitG_fx, &TraitG_fy, centre.x, centre.y, 900 );
RotatePoint( &TraitD_ox, &TraitD_oy, centre.x, centre.y, 900 );
RotatePoint( &TraitD_fx, &TraitD_fy, centre.x, centre.y, 900 );
RotatePoint( &FlecheG1_ox, &FlecheG1_oy, centre.x, centre.y, 900 );
RotatePoint( &FlecheG1_fx, &FlecheG1_fy, centre.x, centre.y, 900 );
RotatePoint( &FlecheG2_ox, &FlecheG2_oy, centre.x, centre.y, 900 );
RotatePoint( &FlecheG2_fx, &FlecheG2_fy, centre.x, centre.y, 900 );
RotatePoint( &FlecheD1_ox, &FlecheD1_oy, centre.x, centre.y, 900 );
RotatePoint( &FlecheD1_fx, &FlecheD1_fy, centre.x, centre.y, 900 );
RotatePoint( &FlecheD2_ox, &FlecheD2_oy, centre.x, centre.y, 900 );
RotatePoint( &FlecheD2_fx, &FlecheD2_fy, centre.x, centre.y, 900 );
}
@ -302,28 +302,28 @@ void COTATION::Mirror(const wxPoint& axis_pos)
{
#define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
#define INVERT_ANGLE( phi ) (phi) = -(phi)
INVERT( m_Pos.y );
INVERT( m_Text->m_Pos.y );
INVERT_ANGLE( m_Text->m_Orient );
if( m_Text->m_Orient >= 3600 )
m_Text->m_Orient -= 3600;
if( (m_Text->m_Orient > 900) && (m_Text->m_Orient <2700) )
m_Text->m_Orient -= 1800;
INVERT( m_Pos.y );
INVERT( m_Text->m_Pos.y );
INVERT_ANGLE( m_Text->m_Orient );
if( m_Text->m_Orient >= 3600 )
m_Text->m_Orient -= 3600;
if( (m_Text->m_Orient > 900) && (m_Text->m_Orient <2700) )
m_Text->m_Orient -= 1800;
INVERT( Barre_oy );
INVERT( Barre_fy );
INVERT( TraitG_oy );
INVERT( TraitG_fy );
INVERT( TraitD_oy );
INVERT( TraitD_fy );
INVERT( FlecheG1_oy );
INVERT( FlecheG1_fy );
INVERT( FlecheG2_oy );
INVERT( FlecheG2_fy );
INVERT( FlecheD1_oy );
INVERT( FlecheD1_fy );
INVERT( FlecheD2_oy );
INVERT( FlecheD2_fy );
INVERT( Barre_oy );
INVERT( Barre_fy );
INVERT( TraitG_oy );
INVERT( TraitG_fy );
INVERT( TraitD_oy );
INVERT( TraitD_fy );
INVERT( FlecheG1_oy );
INVERT( FlecheG1_fy );
INVERT( FlecheG2_oy );
INVERT( FlecheG2_fy );
INVERT( FlecheD1_oy );
INVERT( FlecheD1_fy );
INVERT( FlecheD2_oy );
INVERT( FlecheD2_fy );
}
/****************************************/
@ -334,7 +334,7 @@ bool COTATION::Save( FILE* aFile ) const
return true;
bool rc = false;
if( fprintf( aFile, "$COTATION\n" ) != sizeof("$COTATION\n")-1 )
goto out;
@ -384,19 +384,19 @@ bool COTATION::Save( FILE* aFile ) const
if( fprintf( aFile, "$EndCOTATION\n" ) != sizeof("$EndCOTATION\n")-1 )
goto out;
rc = true;
out:
return rc;
}
/************************************************************************/
void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int mode_color )
int mode_color, const wxPoint& offset )
/************************************************************************/
/* impression de 1 cotation : serie de n segments + 1 texte
@ -408,7 +408,7 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
ox = offset.x;
oy = offset.y;
m_Text->Draw( panel, DC, offset, mode_color );
m_Text->Draw( panel, DC, mode_color, offset );
gcolor = g_DesignSettings.m_LayerColor[m_Layer];
if( (gcolor & ITEM_NOT_SHOW) != 0 )
@ -416,7 +416,7 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems;
width = m_Width;
if( width / zoom < 2 )
typeaff = FILAIRE;
@ -513,95 +513,95 @@ bool COTATION::HitTest( const wxPoint& ref_pos )
}
/* Localisation des SEGMENTS ?) */
ux0 = Barre_ox;
ux0 = Barre_ox;
uy0 = Barre_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = Barre_fx - ux0;
dx = Barre_fx - ux0;
dy = Barre_fy - uy0;
spot_cX = ref_pos.x - ux0;
spot_cX = ref_pos.x - ux0;
spot_cY = ref_pos.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = TraitG_ox;
ux0 = TraitG_ox;
uy0 = TraitG_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = TraitG_fx - ux0;
dx = TraitG_fx - ux0;
dy = TraitG_fy - uy0;
spot_cX = ref_pos.x - ux0;
spot_cX = ref_pos.x - ux0;
spot_cY = ref_pos.y - uy0;
/* detection : */
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = TraitD_ox;
ux0 = TraitD_ox;
uy0 = TraitD_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = TraitD_fx - ux0;
dx = TraitD_fx - ux0;
dy = TraitD_fy - uy0;
spot_cX = ref_pos.x - ux0;
spot_cX = ref_pos.x - ux0;
spot_cY = ref_pos.y - uy0;
/* detection : */
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = FlecheD1_ox;
ux0 = FlecheD1_ox;
uy0 = FlecheD1_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = FlecheD1_fx - ux0;
dx = FlecheD1_fx - ux0;
dy = FlecheD1_fy - uy0;
spot_cX = ref_pos.x - ux0;
spot_cX = ref_pos.x - ux0;
spot_cY = ref_pos.y - uy0;
/* detection : */
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = FlecheD2_ox;
ux0 = FlecheD2_ox;
uy0 = FlecheD2_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = FlecheD2_fx - ux0;
dx = FlecheD2_fx - ux0;
dy = FlecheD2_fy - uy0;
spot_cX = ref_pos.x - ux0;
spot_cX = ref_pos.x - ux0;
spot_cY = ref_pos.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = FlecheG1_ox;
ux0 = FlecheG1_ox;
uy0 = FlecheG1_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = FlecheG1_fx - ux0;
dx = FlecheG1_fx - ux0;
dy = FlecheG1_fy - uy0;
spot_cX = ref_pos.x - ux0;
spot_cX = ref_pos.x - ux0;
spot_cY = ref_pos.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true;
ux0 = FlecheG2_ox;
ux0 = FlecheG2_ox;
uy0 = FlecheG2_oy;
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
dx = FlecheG2_fx - ux0;
dx = FlecheG2_fx - ux0;
dy = FlecheG2_fy - uy0;
spot_cX = ref_pos.x - ux0;
spot_cX = ref_pos.x - ux0;
spot_cY = ref_pos.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
@ -618,7 +618,7 @@ bool COTATION::HitTest( const wxPoint& ref_pos )
*/
bool COTATION::HitTest( EDA_Rect& refArea )
{
if( refArea.Inside( m_Pos ) )
return true;
return false;
if( refArea.Inside( m_Pos ) )
return true;
return false;
}

View File

@ -32,8 +32,8 @@ public:
{
return m_Pos;
}
bool ReadCotationDescr( FILE* File, int* LineNum );
/**
@ -41,9 +41,9 @@ public:
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
*/
bool Save( FILE* aFile ) const;
/* supprime du chainage la structure Struct */
void UnLink();
@ -53,29 +53,30 @@ public:
void Copy( COTATION* source );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int mode_color );
/**
* Function Move
* @param offset : moving vector
*/
void Move(const wxPoint& offset);
void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aColorMode, const wxPoint& offset = ZeroOffset );
/**
* Function Rotate
* @param offset : Rotation point
* @param angle : Rotation angle in 0.1 degrees
*/
void Rotate(const wxPoint& centre, int angle);
/**
* Function Move
* @param offset : moving vector
*/
void Move(const wxPoint& offset);
/**
* Function Mirror
* Mirror the Dimension , relative to a given horizontal axis
* the text is not mirrored. only its position (and angle) is mirrored
* the layer is not changed
* @param axis_pos : vertical axis position
*/
void Mirror(const wxPoint& axis_pos);
/**
* Function Rotate
* @param offset : Rotation point
* @param angle : Rotation angle in 0.1 degrees
*/
void Rotate(const wxPoint& centre, int angle);
/**
* Function Mirror
* Mirror the Dimension , relative to a given horizontal axis
* the text is not mirrored. only its position (and angle) is mirrored
* the layer is not changed
* @param axis_pos : vertical axis position
*/
void Mirror(const wxPoint& axis_pos);
/**
* Function Display_Infos
@ -83,9 +84,9 @@ public:
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
@ -93,17 +94,17 @@ public:
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& ref_pos );
/**
* Function HitTest (overlayed)
* tests if the given EDA_Rect intersect this object.
* For now, the anchor must be inside this rect.
* For now, the anchor must be inside this rect.
* @param refArea : the given EDA_Rect
* @return bool - true if a hit, else false
*/
bool HitTest( EDA_Rect& refArea );
/**
* Function GetClass
* returns the class name.

View File

@ -127,7 +127,7 @@ void EDGE_MODULE::SetDrawCoord()
/********************************************************************************/
void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode )
int draw_mode, const wxPoint& offset )
/********************************************************************************/
/* Affichage d'un segment contour de module :

View File

@ -60,10 +60,10 @@ public:
void SetDrawCoord();
/* drawing functions */
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode );
void Draw3D( Pcb3D_GLCanvas* glcanvas );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset );
void Draw3D( Pcb3D_GLCanvas* glcanvas );
/**
* Function Display_Infos

View File

@ -182,7 +182,7 @@ bool MARKER::HitTest( const wxPoint& refPos )
/**********************************************************************/
void MARKER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode )
void MARKER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode, const wxPoint& offset )
/**********************************************************************/
/*

View File

@ -3,7 +3,7 @@
/***************************************/
#ifndef CLASS_MARKER_H
#define CLASS_MARKER_H
#define CLASS_MARKER_H
#include "base_struct.h"
@ -18,9 +18,9 @@ protected:
wxSize m_Size; ///< Size of the graphic symbol
DRC_ITEM m_drc;
void init();
public:
MARKER( BOARD_ITEM* StructFather );
@ -34,8 +34,8 @@ public:
* @param bText Text describing the second of the two conflicting objects
* @param bPos The position of the second of two objects
*/
MARKER( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
MARKER( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos );
/**
* Constructor
@ -44,14 +44,14 @@ public:
* @param aText Text describing the object
* @param aPos The position of the object
*/
MARKER( int aErrorCode, const wxPoint& aMarkerPos,
MARKER( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos );
~MARKER();
~MARKER();
void UnLink();
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode, const wxPoint& offset = ZeroOffset );
/**
@ -63,7 +63,7 @@ public:
return (wxPoint&) m_drc.GetPosition();
}
/**
* Function GetPos
* returns the position of this MARKER, const.
@ -73,7 +73,7 @@ public:
return m_drc.GetPosition();
}
/**
* Function SetData
* fills in all the reportable data associated with a MARKER.
@ -84,10 +84,10 @@ public:
* @param bText Text describing the second of the two conflicting objects
* @param bPos The position of the second of two objects
*/
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos,
const wxString& bText, const wxPoint& bPos );
/**
* Function SetData
* fills in all the reportable data associated with a MARKER.
@ -96,10 +96,10 @@ public:
* @param aText Text describing the object
* @param aPos The position of the object
*/
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
const wxString& aText, const wxPoint& aPos );
/**
* Function GetReporter
* returns the DRC_ITEM held within this MARKER so that its
@ -111,30 +111,30 @@ public:
return m_drc;
}
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
*/
bool Save( FILE* aFile ) const
{
// not implemented, this is here to satisfy BOARD_ITEM::Save()
// "pure" virtual-ness
return true;
}
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.

View File

@ -101,30 +101,30 @@ bool MIREPCB::Save( FILE* aFile ) const
return true;
bool rc = false;
if( fprintf( aFile, "$MIREPCB\n" ) != sizeof("$MIREPCB\n")-1 )
goto out;
fprintf( aFile, "Po %X %d %d %d %d %d %8.8lX\n",
m_Shape, m_Layer,
m_Pos.x, m_Pos.y,
m_Size, m_Width, m_TimeStamp );
if( fprintf( aFile, "$EndMIREPCB\n" ) != sizeof("$EndMIREPCB\n")-1 )
goto out;
rc = true;
out:
out:
return rc;
}
/**********************************************************/
void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int mode_color )
int mode_color, const wxPoint& offset )
/**********************************************************/
/* Affichage de 1 mire : 2 segments + 1 cercle
@ -226,8 +226,8 @@ bool MIREPCB::HitTest( const wxPoint& refPos )
*/
bool MIREPCB::HitTest( EDA_Rect& refArea )
{
if( refArea.Inside( m_Pos ) )
return true;
return false;
if( refArea.Inside( m_Pos ) )
return true;
return false;
}

View File

@ -23,16 +23,16 @@ public:
{
return m_Pos;
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
*/
bool Save( FILE* aFile ) const;
bool ReadMirePcbDescr( FILE* File, int* LineNum );
/* supprime du chainage la structure Struct */
@ -40,9 +40,9 @@ public:
void Copy( MIREPCB* source );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int mode_color );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
@ -54,7 +54,7 @@ public:
/**
* Function HitTest (overlayed)
* tests if the given EDA_Rect intersect this object.
* For now, the anchor must be inside this rect.
* For now, the anchor must be inside this rect.
* @param refArea : the given EDA_Rect
* @return bool - true if a hit, else false
*/

View File

@ -262,7 +262,7 @@ void MODULE::UnLink()
/**********************************************************/
void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode )
int draw_mode, const wxPoint& offset )
/**********************************************************/
/** Function Draw
@ -273,46 +273,38 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
* @param draw_mode = GR_OR, GR_XOR, GR_AND
*/
{
D_PAD* pt_pad;
EDA_BaseStruct* PtStruct;
TEXTE_MODULE* PtTexte;
if( (m_Flags & DO_NOT_DRAW) )
return;
/* Draw pads */
pt_pad = m_Pads;
D_PAD* pt_pad = m_Pads;
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
{
if( pt_pad->m_Flags & IS_MOVED )
continue;
pt_pad->Draw( panel, DC, offset, draw_mode );
pt_pad->Draw( panel, DC, draw_mode, offset );
}
/* Draws foootprint anchor */
// Draws foootprint anchor
DrawAncre( panel, DC, offset, DIM_ANCRE_MODULE, draw_mode );
/* Draw graphic items */
if( !(m_Reference->m_Flags & IS_MOVED) )
m_Reference->Draw( panel, DC, offset, draw_mode );
if( !(m_Value->m_Flags & IS_MOVED) )
m_Value->Draw( panel, DC, offset, draw_mode );
m_Reference->Draw( panel, DC, draw_mode, offset );
PtStruct = m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
if( !(m_Value->m_Flags & IS_MOVED) )
m_Value->Draw( panel, DC, draw_mode, offset );
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
{
if( PtStruct->m_Flags & IS_MOVED )
if( item->m_Flags & IS_MOVED )
continue;
switch( PtStruct->Type() )
switch( item->Type() )
{
case TYPETEXTEMODULE:
PtTexte = (TEXTE_MODULE*) PtStruct;
PtTexte->Draw( panel, DC, offset, draw_mode );
break;
case TYPEEDGEMODULE:
( (EDGE_MODULE*) PtStruct )->Draw( panel, DC, offset, draw_mode );
item->Draw( panel, DC, draw_mode, offset );
break;
default:
@ -335,16 +327,12 @@ void MODULE::DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC,
* @param draw_mode = GR_OR, GR_XOR, GR_AND
*/
{
EDA_BaseStruct* PtStruct;
/* Draw graphic items */
PtStruct = m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
{
switch( PtStruct->Type() )
switch( item->Type() )
{
case TYPEEDGEMODULE:
( (EDGE_MODULE*) PtStruct )->Draw( panel, DC, offset, draw_mode );
item->Draw( panel, DC, draw_mode, offset );
break;
default:
@ -1082,9 +1070,9 @@ EDA_Rect MODULE::GetBoundingBox()
area.Merge( text_area );
}
// Add the Clearence shape size: (shape around the pads when the clearence is shown
// Not optimized, but the draw cost is small (perhaps smaller than optimization)
area.Inflate(g_DesignSettings.m_TrackClearence, g_DesignSettings.m_TrackClearence);
// Add the Clearence shape size: (shape around the pads when the clearence is shown
// Not optimized, but the draw cost is small (perhaps smaller than optimization)
area.Inflate(g_DesignSettings.m_TrackClearence, g_DesignSettings.m_TrackClearence);
return area;
}

View File

@ -165,10 +165,10 @@ public:
* @param panel = draw panel, Used to know the clip box
* @param DC = Current Device Context
* @param offset = draw offset (usually wxPoint(0,0)
* @param draw_mode = GR_OR, GR_XOR..
* @param aDrawMode = GR_OR, GR_XOR..
*/
void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );
void Draw3D( Pcb3D_GLCanvas* glcanvas );
void DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode );

View File

@ -218,7 +218,7 @@ void D_PAD::UnLink()
/*******************************************************************************************/
void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode )
void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoint& offset )
/*******************************************************************************************/
/** Draw a pad:

View File

@ -66,7 +66,7 @@ public:
int m_physical_connexion; // variable used in rastnest computations
// handle block number in track connection
int m_zone_connexion; // variable used in rastnest computations
int m_zone_connexion; // variable used in rastnest computations
// handle block number in zone connection
public:
@ -111,7 +111,9 @@ public:
/* drawing functions */
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset );
void Draw3D( Pcb3D_GLCanvas* glcanvas );
// others

View File

@ -146,7 +146,7 @@ out:
/**********************************************************************/
void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode )
int DrawMode, const wxPoint& offset )
/**********************************************************************/
/*

View File

@ -9,50 +9,49 @@
class TEXTE_PCB : public BOARD_ITEM, public EDA_TextStruct
{
public:
TEXTE_PCB( BOARD_ITEM* parent );
TEXTE_PCB( TEXTE_PCB* textepcb );
~TEXTE_PCB();
TEXTE_PCB( BOARD_ITEM* parent );
TEXTE_PCB( TEXTE_PCB* textepcb );
~TEXTE_PCB();
/**
* Function GetPosition
* returns the position of this object.
* @return wxPoint& - The position of this object, non-const so it
* @return wxPoint& - The position of this object, non-const so it
* can be changed
*/
wxPoint& GetPosition()
{
return m_Pos; // within EDA_TextStruct
}
/* supprime du chainage la structure Struct */
void UnLink();
/* duplicate structure */
void Copy( TEXTE_PCB* source );
void Draw( WinEDA_DrawPanel * panel, wxDC * DC,
const wxPoint & offset, int DrawMode );
/* supprime du chainage la structure Struct */
void UnLink();
/* duplicate structure */
void Copy( TEXTE_PCB* source );
void Draw( WinEDA_DrawPanel * panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );
// File Operations:
int ReadTextePcbDescr( FILE* File, int* LineNum );
// File Operations:
int ReadTextePcbDescr( FILE* File, int* LineNum );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
*/
bool Save( FILE* aFile ) const;
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
*/
void Display_Infos( WinEDA_DrawFrame* frame );
@ -66,19 +65,19 @@ public:
{
return EDA_TextStruct::HitTest( refPos );
}
/**
* Function HitTest (overlayed)
* tests if the given EDA_Rect intersect this object.
* @param refArea the given EDA_Rect to test
* @return bool - true if a hit, else false
*/
/**
* Function HitTest (overlayed)
* tests if the given EDA_Rect intersect this object.
* @param refArea the given EDA_Rect to test
* @return bool - true if a hit, else false
*/
bool HitTest( EDA_Rect& refArea )
{
return EDA_TextStruct::HitTest( refArea );
}
/**
* Function GetClass
* returns the class name.
@ -93,13 +92,13 @@ public:
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
virtual void Show( int nestLevel, std::ostream& os );
#endif
};
#endif // #define CLASS_PCB_TEXT_H

View File

@ -106,7 +106,7 @@ void TEXTE_MODULE::Copy( TEXTE_MODULE* source ) // copy structure
m_Type = source->m_Type; // 0: ref,1: val, others = 2..255
m_Orient = source->m_Orient; // orientation in 1/10 deg
m_Pos0 = source->m_Pos0; // text coordinates relatives to the footprint ancre, orient 0
// Text coordinate ref point is the text centre
// Text coordinate ref point is the text centre
m_Size = source->m_Size;
m_Width = source->m_Width;
@ -201,23 +201,23 @@ void TEXTE_MODULE:: SetLocalCoord()
*/
EDA_Rect TEXTE_MODULE::GetTextRect(void)
{
EDA_Rect area;
EDA_Rect area;
int dx, dy;
dx = ( m_Size.x * GetLength() ) / 2;
dx = (dx * 10) / 9 ; /* letter size = 10/9 */
dx += m_Width / 2;
dx += m_Width / 2;
dy = ( m_Size.y + m_Width ) / 2;
wxPoint Org = m_Pos; // This is the position of the centre of the area
Org.x -= dx;
Org.y -= dy;
area.SetOrigin( Org);
area.SetHeight(2 * dy);
area.SetWidth(2 * dx);
area.Normalize();
return area;
wxPoint Org = m_Pos; // This is the position of the centre of the area
Org.x -= dx;
Org.y -= dy;
area.SetOrigin( Org);
area.SetHeight(2 * dy);
area.SetWidth(2 * dx);
area.Normalize();
return area;
}
/**
@ -229,11 +229,11 @@ EDA_Rect TEXTE_MODULE::GetTextRect(void)
bool TEXTE_MODULE::HitTest( const wxPoint& refPos )
{
wxPoint rel_pos;
EDA_Rect area = GetTextRect();
EDA_Rect area = GetTextRect();
/* Rotate refPos to - angle
* to test if refPos is within area (which is relative to an horizontal text)
*/
*/
rel_pos = refPos;
RotatePoint( &rel_pos, m_Pos, - GetDrawRotation() );
@ -249,25 +249,25 @@ bool TEXTE_MODULE::HitTest( const wxPoint& refPos )
*/
EDA_Rect TEXTE_MODULE::GetBoundingBox()
{
// Calculate area without text fielsd:
EDA_Rect text_area;
int angle = GetDrawRotation();
wxPoint textstart, textend;
// Calculate area without text fielsd:
EDA_Rect text_area;
int angle = GetDrawRotation();
wxPoint textstart, textend;
text_area = GetTextRect();
textstart = text_area.GetOrigin();
textend = text_area.GetEnd();
RotatePoint( &textstart, m_Pos, angle);
RotatePoint( &textend, m_Pos, angle);
text_area.SetOrigin(textstart);
text_area.SetEnd(textend);
text_area.Normalize();
return text_area;
text_area = GetTextRect();
textstart = text_area.GetOrigin();
textend = text_area.GetEnd();
RotatePoint( &textstart, m_Pos, angle);
RotatePoint( &textend, m_Pos, angle);
text_area.SetOrigin(textstart);
text_area.SetEnd(textend);
text_area.Normalize();
return text_area;
}
/******************************************************************************************/
void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int draw_mode )
void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoint& offset )
/******************************************************************************************/
/** Function Draw

View File

@ -19,13 +19,13 @@ public:
wxPoint m_Pos; // Real (physical)coord
int m_Width;
wxPoint m_Pos0; // text coordinates relatives to the footprint ancre, orient 0
// Text coordinate ref point is the text centre
// Text coordinate ref point is the text centre
char m_Unused; // unused (reserved for future extensions)
char m_Miroir; // Show normal / mirror
char m_NoShow; // 0: visible 1: invisible (bool)
char m_Type; // 0: ref,1: val, others = 2..255
int m_Orient; // orientation in 1/10 deg relative to the footprint
// Physical orient is m_Orient + m_Parent->m_Orient
// Physical orient is m_Orient + m_Parent->m_Orient
wxSize m_Size; // text size
wxString m_Text;
@ -44,7 +44,7 @@ public:
return m_Pos;
}
/* supprime du chainage la structure Struct */
void UnLink();
@ -55,11 +55,11 @@ public:
int GetLength(); /* text length */
int Pitch(); /* retourne le pas entre 2 caracteres */
int GetDrawRotation(); // Return text rotation for drawings and plotting
/** Function GetTextRect
* @return an EDA_Rect which gives the position and size of the text area (for the 0 orient text and footprint)
*/
EDA_Rect GetTextRect(void);
/** Function GetTextRect
* @return an EDA_Rect which gives the position and size of the text area (for the 0 orient text and footprint)
*/
EDA_Rect GetTextRect(void);
/**
* Function GetBoundingBox
@ -67,7 +67,7 @@ public:
*/
EDA_Rect GetBoundingBox();
void SetDrawCoord(); // mise a jour des coordonn<6E>s absolues de trac<61>
void SetDrawCoord(); // mise a jour des coordonn<6E>s absolues de trac<61>
// a partir des coord relatives
void SetLocalCoord(); // mise a jour des coordonn<6E>s relatives
@ -77,26 +77,26 @@ public:
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
*/
bool Save( FILE* aFile ) const;
int ReadDescr( FILE* File, int* LineNum = NULL );
/* drawing functions */
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int draw_mode );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
@ -115,7 +115,7 @@ public:
* @return bool - true if on given layer, else false.
*/
bool IsOnLayer( int aLayer ) const;
/**
* Function IsOnOneOfTheseLayers
* returns true if this object is on one of the given layers. Is virtual so
@ -127,9 +127,9 @@ public:
bool IsOnOneOfTheseLayers( int aLayerMask ) const;
*/
/**
* Function GetClass
* returns the class name.
@ -144,7 +144,7 @@ public:
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/

Some files were not shown because too many files have changed in this diff Show More