Commit 4787b38a authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Fixed minor problems (bugs 568357 and 568356). Changed French word...

Pcbnew: Fixed minor problems (bugs 568357 and 568356). Changed French word COTATION to DIMENSION in class COTATION (now class DIMENSION)
parent 90f6219a
......@@ -4,6 +4,12 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-apr-23, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Pcbnew:
Fixed minor problems.
Changed French word COTATION to DIMENSION in class COTATION (now class DIMENSION)
2010-apr-22, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++Pcbnew+Gerbview:
......
......@@ -38,7 +38,7 @@ enum KICAD_T {
TYPE_ZONE, // a segment used to fill a zone area (segment on a
// copper layer)
TYPE_MARKER_PCB, // a marker used to show something
TYPE_COTATION, // a dimension (graphic item)
TYPE_DIMENSION, // a dimension (graphic item)
TYPE_MIRE, // a target (graphic item)
TYPE_ZONE_EDGE_CORNER, // in zone outline: a point to define an outline
TYPE_ZONE_CONTAINER, // a zone area
......
......@@ -87,7 +87,7 @@ public:
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
* is virtual because some items (in fact: class COTATION)
* is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialisation
*/
virtual void SetLayer( int aLayer ) { m_Layer = aLayer; }
......
......@@ -32,7 +32,7 @@ class SEGVIA;
class D_PAD;
class TEXTE_MODULE;
class MIREPCB;
class COTATION;
class DIMENSION;
class EDGE_MODULE;
class WinEDA3D_DrawFrame;
class DRC;
......
......@@ -27,7 +27,7 @@ class SEGVIA;
class D_PAD;
class TEXTE_MODULE;
class MIREPCB;
class COTATION;
class DIMENSION;
class EDGE_MODULE;
class WinEDA3D_DrawFrame;
class DRC;
......@@ -854,11 +854,11 @@ public:
void Delete_Drawings_All_Layer( int aLayer );
// Dimension handling:
void Install_Edit_Cotation( COTATION* Cotation,
void Install_Edit_Dimension( DIMENSION* Dimension,
wxDC* DC,
const wxPoint& pos );
COTATION* Begin_Cotation( COTATION* Cotation, wxDC* DC );
void Delete_Cotation( COTATION* Cotation, wxDC* DC );
DIMENSION* Begin_Dimension( DIMENSION* Dimension, wxDC* DC );
void Delete_Dimension( DIMENSION* Dimension, wxDC* DC );
// netlist handling:
......
......@@ -477,7 +477,7 @@ void WinEDA_PcbFrame::Block_SelectItems()
select_me = true; // This item is in bloc: select it
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
......@@ -619,7 +619,7 @@ void WinEDA_PcbFrame::Block_Delete()
case TYPE_TEXTE: // a text on a layer
case TYPE_TRACK: // a track segment (segment on a copper layer)
case TYPE_VIA: // a via (like atrack segment on a copper layer)
case TYPE_COTATION: // a dimension (graphic item)
case TYPE_DIMENSION: // a dimension (graphic item)
case TYPE_MIRE: // a target (graphic item)
item->UnLink();
break;
......@@ -696,7 +696,7 @@ void WinEDA_PcbFrame::Block_Rotate()
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_MIRE:
case TYPE_COTATION:
case TYPE_DIMENSION:
break;
// This item is not put in undo list
......@@ -766,7 +766,7 @@ void WinEDA_PcbFrame::Block_Flip()
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_MIRE:
case TYPE_COTATION:
case TYPE_DIMENSION:
break;
// This item is not put in undo list
......@@ -834,7 +834,7 @@ void WinEDA_PcbFrame::Block_Move()
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_MIRE:
case TYPE_COTATION:
case TYPE_DIMENSION:
break;
// This item is not put in undo list
......@@ -955,10 +955,10 @@ void WinEDA_PcbFrame::Block_Duplicate()
}
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
{
COTATION* new_cotation = new COTATION( m_Pcb );
new_cotation->Copy( (COTATION*) item );
DIMENSION* new_cotation = new DIMENSION( m_Pcb );
new_cotation->Copy( (DIMENSION*) item );
m_Pcb->Add( new_cotation );
newitem = new_cotation;
}
......
......@@ -209,14 +209,15 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
EXCHG( ( (MIREPCB*) aItem )->m_Shape, ( (MIREPCB*) aImage )->m_Shape );
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
{
wxString txt = ( (COTATION*) aItem )->GetText();
( (COTATION*) aItem )->SetText( ( (COTATION*) aImage )->GetText() );
( (COTATION*) aImage )->SetText( txt );
EXCHG( ( (COTATION*) aItem )->m_Text->m_Size, ( (COTATION*) aImage )->m_Text->m_Size );
EXCHG( ( (COTATION*) aItem )->m_Text->m_Width, ( (COTATION*) aImage )->m_Text->m_Width );
EXCHG( ( (COTATION*) aItem )->m_Text->m_Mirror, ( (COTATION*) aImage )->m_Text->m_Mirror );
wxString txt = ( (DIMENSION*) aItem )->GetText();
( (DIMENSION*) aItem )->SetText( ( (DIMENSION*) aImage )->GetText() );
( (DIMENSION*) aImage )->SetText( txt );
EXCHG( ( (DIMENSION*) aItem )->m_Width, ( (DIMENSION*) aImage )->m_Width );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Size, ( (DIMENSION*) aImage )->m_Text->m_Size );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Width, ( (DIMENSION*) aImage )->m_Text->m_Width );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Mirror, ( (DIMENSION*) aImage )->m_Text->m_Mirror );
}
break;
......@@ -301,10 +302,10 @@ BOARD_ITEM* DuplicateStruct( BOARD_ITEM* aItem )
}
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
{
COTATION* new_cotation = new COTATION( aItem->GetParent() );
new_cotation->Copy( (COTATION*) aItem );
DIMENSION* new_cotation = new DIMENSION( aItem->GetParent() );
new_cotation->Copy( (DIMENSION*) aItem );
return new_cotation;
}
break;
......
......@@ -599,7 +599,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
m_Status_Pcb = 0;
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_EDGE_MODULE:
......@@ -672,7 +672,7 @@ BOARD_ITEM* BOARD::Remove( BOARD_ITEM* aBoardItem )
m_Zone.Remove( (SEGZONE*) aBoardItem );
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_EDGE_MODULE:
......@@ -965,7 +965,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_COTATION:
case TYPE_DIMENSION:
case TYPE_MIRE:
result = IterateForward( m_Drawings, inspector, testData, p );
......@@ -976,7 +976,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
{
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_COTATION:
case TYPE_DIMENSION:
case TYPE_MIRE:
continue;
......@@ -1369,7 +1369,7 @@ bool BOARD::Save( FILE* aFile ) const
case TYPE_TEXTE:
case TYPE_DRAWSEGMENT:
case TYPE_MIRE:
case TYPE_COTATION:
case TYPE_DIMENSION:
if( !item->Save( aFile ) )
goto out;
break;
......
/*****************************************/
/* class BOARD_ITEM: som basic functions */
/*****************************************/
/******************************************/
/* class BOARD_ITEM: some basic functions */
/******************************************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -217,8 +217,8 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
<< wxT(",") << ((MARKER_PCB*)item)->GetPos().y << wxT(")");
break;
case TYPE_COTATION:
text << _( "Dimension" ) << wxT( " \"" ) << ( (COTATION*) item )->GetText() << wxT( "\"" );
case TYPE_DIMENSION:
text << _( "Dimension" ) << wxT( " \"" ) << ( (DIMENSION*) item )->GetText() << wxT( "\"" );
break;
case TYPE_MIRE:
......@@ -291,7 +291,7 @@ const char** BOARD_ITEM::MenuIcon() const
xpm = pad_xpm; // @todo: create and use marker xpm
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
xpm = add_dimension_xpm;
break;
......
/*****************************/
/* COTATION class definition */
/* DIMENSION class definition */
/*****************************/
#include "fctsys.h"
......@@ -14,8 +14,8 @@
#include "kicad_string.h"
#include "protos.h"
COTATION::COTATION( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, TYPE_COTATION )
DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, TYPE_DIMENSION )
{
m_Layer = DRAW_LAYER;
m_Width = 50;
......@@ -26,14 +26,14 @@ COTATION::COTATION( BOARD_ITEM* aParent ) :
}
COTATION::~COTATION()
DIMENSION::~DIMENSION()
{
delete m_Text;
}
/* Setup the dimension text */
void COTATION::SetText( const wxString& NewText )
void DIMENSION::SetText( const wxString& NewText )
{
m_Text->m_Text = NewText;
}
......@@ -41,7 +41,7 @@ void COTATION::SetText( const wxString& NewText )
/* Return the dimension text
*/
wxString COTATION::GetText( void )
wxString DIMENSION::GetText( void )
{
return m_Text->m_Text;
}
......@@ -51,14 +51,14 @@ wxString COTATION::GetText( void )
* sets the layer this item is on.
* @param aLayer The layer number.
*/
void COTATION::SetLayer( int aLayer )
void DIMENSION::SetLayer( int aLayer )
{
m_Layer = aLayer;
m_Text->SetLayer( aLayer);
}
void COTATION::Copy( COTATION* source )
void DIMENSION::Copy( DIMENSION* source )
{
m_Value = source->m_Value;
SetLayer( source->GetLayer() );
......@@ -100,13 +100,13 @@ void COTATION::Copy( COTATION* source )
}
bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
bool DIMENSION::ReadDimensionDescr( FILE* File, int* LineNum )
{
char Line[2048], Text[2048];
while( GetLine( File, Line, LineNum ) != NULL )
{
if( strnicmp( Line, "$EndCOTATION", 4 ) == 0 )
if( strnicmp( Line, "$EndDIMENSION", 4 ) == 0 )
return TRUE;
if( Line[0] == 'V' )
......@@ -227,7 +227,7 @@ bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
* Function Move
* @param offset : moving vector
*/
void COTATION::Move(const wxPoint& offset)
void DIMENSION::Move(const wxPoint& offset)
{
m_Pos += offset;
m_Text->m_Pos += offset;
......@@ -267,7 +267,7 @@ void COTATION::Move(const wxPoint& offset)
* @param center : Rotation point
* @param angle : Rotation angle in 0.1 degrees
*/
void COTATION::Rotate(const wxPoint& centre, int angle)
void DIMENSION::Rotate(const wxPoint& centre, int angle)
{
RotatePoint( &m_Pos, centre, angle );
......@@ -300,7 +300,7 @@ void COTATION::Rotate(const wxPoint& centre, int angle)
* Flip this object, i.e. change the board side for this object
* @param const wxPoint& aCentre - the rotation point.
*/
void COTATION::Flip(const wxPoint& aCentre )
void DIMENSION::Flip(const wxPoint& aCentre )
{
Mirror( aCentre );
SetLayer( ChangeSideNumLayer( GetLayer() ) );
......@@ -314,7 +314,7 @@ void COTATION::Flip(const wxPoint& aCentre )
* the layer is not changed
* @param axis_pos : vertical axis position
*/
void COTATION::Mirror(const wxPoint& axis_pos)
void DIMENSION::Mirror(const wxPoint& axis_pos)
{
#define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
#define INVERT_ANGLE( phi ) (phi) = -(phi)
......@@ -343,14 +343,18 @@ void COTATION::Mirror(const wxPoint& axis_pos)
}
bool COTATION::Save( FILE* aFile ) const
bool DIMENSION::Save( FILE* aFile ) const
{
if( GetState( DELETED ) )
return true;
bool rc = false;
// note: COTATION was the previous name of DIMENSION
// this old keyword is used here for compatibility
const char keyWordLine[] = "$COTATION\n";
const char keyWordLineEnd[] = "$endCOTATION\n";
if( fprintf( aFile, "$COTATION\n" ) != sizeof("$COTATION\n")-1 )
if( fprintf( aFile, keyWordLine ) != sizeof(keyWordLine)-1 )
goto out;
fprintf( aFile, "Ge %d %d %lX\n", m_Shape, m_Layer, m_TimeStamp );
......@@ -397,7 +401,7 @@ bool COTATION::Save( FILE* aFile ) const
FlecheG2_ox, FlecheG2_oy,
FlecheG2_fx, FlecheG2_fy, m_Width );
if( fprintf( aFile, "$EndCOTATION\n" ) != sizeof("$EndCOTATION\n")-1 )
if( fprintf( aFile, keyWordLineEnd ) != sizeof(keyWordLineEnd)-1 )
goto out;
rc = true;
......@@ -407,11 +411,123 @@ out:
}
/** function AdjustDimensionDetails
* Calculate coordinates of segments used to draw the dimension.
* @param aDoNotChangeText (bool) if false, the dimension text is initialized
*/
void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
{
#define ARROW_SIZE 500 //size of arrows
int ii;
int mesure, deltax, deltay; /* valeur de la mesure sur les axes X et Y */
int fleche_up_X = 0, fleche_up_Y = 0; /* coord des fleches : barre / */
int fleche_dw_X = 0, fleche_dw_Y = 0; /* coord des fleches : barre \ */
int hx, hy; /* coord des traits de rappel de cote */
float angle, angle_f;
wxString msg;
/* Init layer : */
m_Text->SetLayer( GetLayer() );
/* calculate the size of the cdimension
* (text + line above the text) */
ii = m_Text->m_Size.y +
m_Text->m_Width + (m_Width * 3);
deltax = TraitD_ox - TraitG_ox;
deltay = TraitD_oy - TraitG_oy;
/* Calculate dimension value */
mesure = wxRound(hypot( (double) deltax, (double) deltay ) );
if( deltax || deltay )
angle = atan2( (double) deltay, (double) deltax );
else
angle = 0.0;
/* Calcul des parametre dimensions X et Y des fleches et traits de cotes */
hx = hy = ii;
/* On tient compte de l'inclinaison de la cote */
if( mesure )
{
hx = (abs) ( (int) ( ( (double) deltay * hx ) / mesure ) );
hy = (abs) ( (int) ( ( (double) deltax * hy ) / mesure ) );
if( TraitG_ox > Barre_ox )
hx = -hx;
if( TraitG_ox == Barre_ox )
hx = 0;
if( TraitG_oy > Barre_oy )
hy = -hy;
if( TraitG_oy == Barre_oy )
hy = 0;
angle_f = angle + (M_PI * 27.5 / 180);
fleche_up_X = (int) ( ARROW_SIZE * cos( angle_f ) );
fleche_up_Y = (int) ( ARROW_SIZE * sin( angle_f ) );
angle_f = angle - (M_PI * 27.5 / 180);
fleche_dw_X = (int) ( ARROW_SIZE * cos( angle_f ) );
fleche_dw_Y = (int) ( ARROW_SIZE * sin( angle_f ) );
}
FlecheG1_ox = Barre_ox;
FlecheG1_oy = Barre_oy;
FlecheG1_fx = Barre_ox + fleche_up_X;
FlecheG1_fy = Barre_oy + fleche_up_Y;
FlecheG2_ox = Barre_ox;
FlecheG2_oy = Barre_oy;
FlecheG2_fx = Barre_ox + fleche_dw_X;
FlecheG2_fy = Barre_oy + fleche_dw_Y;
/*la fleche de droite est symetrique a celle de gauche:
* / = -\ et \ = -/
*/
FlecheD1_ox = Barre_fx;
FlecheD1_oy = Barre_fy;
FlecheD1_fx = Barre_fx - fleche_dw_X;
FlecheD1_fy = Barre_fy - fleche_dw_Y;
FlecheD2_ox = Barre_fx;
FlecheD2_oy = Barre_fy;
FlecheD2_fx = Barre_fx - fleche_up_X;
FlecheD2_fy = Barre_fy - fleche_up_Y;
TraitG_fx = Barre_ox + hx;
TraitG_fy = Barre_oy + hy;
TraitD_fx = Barre_fx + hx;
TraitD_fy = Barre_fy + hy;
/* Calculate the better text position and orientation: */
m_Pos.x = m_Text->m_Pos.x
= (Barre_fx + TraitG_fx) / 2;
m_Pos.y = m_Text->m_Pos.y
= (Barre_fy + TraitG_fy) / 2;
m_Text->m_Orient = -(int) (angle * 1800 / M_PI);
if( m_Text->m_Orient < 0 )
m_Text->m_Orient += 3600;
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;
if( !aDoNotChangeText )
{
m_Value = mesure;
valeur_param( m_Value, msg );
SetText( msg );
}
}
/* Print 1 dimension: series of n + 1 segments text
/* Print 1 dimension: segments and text
*/
void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
void DIMENSION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int mode_color, const wxPoint& offset )
{
int ox, oy, typeaff, width, gcolor;
......@@ -502,9 +618,9 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
// see class_cotation.h
void COTATION::DisplayInfo( WinEDA_DrawFrame* frame )
void DIMENSION::DisplayInfo( WinEDA_DrawFrame* frame )
{
// for now, display only the text within the COTATION using class TEXTE_PCB.
// for now, display only the text within the DIMENSION using class TEXTE_PCB.
m_Text->DisplayInfo( frame );
}
......@@ -515,7 +631,7 @@ void COTATION::DisplayInfo( WinEDA_DrawFrame* frame )
* @param ref_pos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool COTATION::HitTest( const wxPoint& ref_pos )
bool DIMENSION::HitTest( const wxPoint& ref_pos )
{
int ux0, uy0;
int dx, dy, spot_cX, spot_cY;
......@@ -619,7 +735,7 @@ bool COTATION::HitTest( const wxPoint& ref_pos )
* @param EDA_Rect : the given EDA_Rect
* @return bool - true if a hit, else false
*/
bool COTATION::HitTest( EDA_Rect& refArea )
bool DIMENSION::HitTest( EDA_Rect& refArea )
{
if( refArea.Inside( m_Pos ) )
return true;
......
/*****************************/
/* COTATION class definition */
/* DIMENSION class definition */
/*****************************/
#ifndef DIMENSION_H
#define DIMENSION_H
#include "base_struct.h"
class COTATION : public BOARD_ITEM
class DIMENSION : public BOARD_ITEM
{
public:
int m_Width;
......@@ -25,8 +25,8 @@ public:
int FlecheG2_ox, FlecheG2_oy, FlecheG2_fx, FlecheG2_fy;
public:
COTATION( BOARD_ITEM* aParent );
~COTATION();
DIMENSION( BOARD_ITEM* aParent );
~DIMENSION();
wxPoint& GetPosition()
{
......@@ -40,7 +40,13 @@ public:
*/
void SetLayer( int aLayer );
bool ReadCotationDescr( FILE* File, int* LineNum );
/** function AdjustDimensionDetails
* Calculate coordinates of segments used to draw the dimension.
* @param aDoNotChangeText (bool) if false, the dimension text is initialized
*/
void AdjustDimensionDetails( bool aDoNotChangeText = false);
bool ReadDimensionDescr( FILE* File, int* LineNum );
/**
* Function Save
......@@ -53,7 +59,7 @@ public:
void SetText( const wxString& NewText );
wxString GetText( void );
void Copy( COTATION* source );
void Copy( DIMENSION* source );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aColorMode, const wxPoint& offset = ZeroOffset );
......
......@@ -218,7 +218,7 @@ void TEXTE_PCB::DisplayInfo( WinEDA_DrawFrame* frame )
wxASSERT( parent );
if( parent->Type() == TYPE_COTATION )
if( parent->Type() == TYPE_DIMENSION )
board = (BOARD*) parent->GetParent();
else
board = (BOARD*) parent;
......@@ -226,8 +226,8 @@ void TEXTE_PCB::DisplayInfo( WinEDA_DrawFrame* frame )
frame->ClearMsgPanel();
if( m_Parent && m_Parent->Type() == TYPE_COTATION )
frame->AppendMsgPanel( _( "COTATION" ), m_Text, DARKGREEN );
if( m_Parent && m_Parent->Type() == TYPE_DIMENSION )
frame->AppendMsgPanel( _( "DIMENSION" ), m_Text, DARKGREEN );
else
frame->AppendMsgPanel( _( "PCB Text" ), m_Text, DARKGREEN );
......
......@@ -39,7 +39,7 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
TYPE_MARKER_PCB, // in m_markers
TYPE_TEXTE, // in m_Drawings
TYPE_DRAWSEGMENT, // in m_Drawings
TYPE_COTATION, // in m_Drawings
TYPE_DIMENSION, // in m_Drawings
TYPE_MIRE, // in m_Drawings
TYPE_VIA, // in m_Tracks
TYPE_TRACK, // in m_Tracks
......@@ -56,7 +56,7 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
* const KICAD_T GENERAL_COLLECTOR::PrimaryItems[] = {
* TYPE_TEXTE,
* TYPE_DRAWSEGMENT,
* TYPE_COTATION,
* TYPE_DIMENSION,
* TYPE_VIA,
* TYPE_TRACK,
* TYPE_MODULE,
......@@ -69,7 +69,7 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
TYPE_MARKER_PCB,
TYPE_TEXTE,
TYPE_DRAWSEGMENT,
TYPE_COTATION,
TYPE_DIMENSION,
TYPE_MIRE,
TYPE_VIA,
TYPE_TRACK,
......@@ -174,7 +174,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
breakhere++;
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
breakhere++;
break;
......@@ -211,9 +211,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
case TYPE_PAD:
// there are pad specific visibility controls.
// Criterias to select a pad is:
// for smd pads: the module parent must be seen, and pads on the corresponding board side must be seen
// for smd pads: the module parent must be seen, and pads on the corresponding board side must be seen
// if pad is a thru hole, then it can be visible when its parent module is not.
// for through pads: pads on Front or Back board sides must be seen
// for through pads: pads on Front or Back board sides must be seen
pad = (D_PAD*) item;
if( (pad->m_Attribut != PAD_SMD) &&
(pad->m_Attribut != PAD_CONN) ) // a hole is present, so multiple layers
......@@ -244,7 +244,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
case TYPE_DRAWSEGMENT:
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
break;
case TYPE_MIRE:
......@@ -285,7 +285,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
goto exit;
}
// Pads are not sensitive to the layer visibility controls.
// Pads are not sensitive to the layer visibility controls.
// They all have their own separate visibility controls
// skip them if not visible
if ( pad )
......
This diff is collapsed.
......@@ -264,7 +264,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetToolID( id, wxCURSOR_HAND, _( "Add Modules" ) );
break;
case ID_PCB_COTATION_BUTT:
case ID_PCB_DIMENSION_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Dimension" ) );
break;
......@@ -803,14 +803,14 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetCurItem( NULL );
break;
case ID_POPUP_PCB_DELETE_COTATION:
case ID_POPUP_PCB_DELETE_DIMENSION:
DrawPanel->MouseToCursorSchema();
Delete_Cotation( (COTATION*) GetCurItem(), &dc );
Delete_Dimension( (DIMENSION*) GetCurItem(), &dc );
SetCurItem( NULL );
break;
case ID_POPUP_PCB_EDIT_COTATION:
Install_Edit_Cotation( (COTATION*) GetCurItem(), &dc, pos );
case ID_POPUP_PCB_EDIT_DIMENSION:
Install_Edit_Dimension( (DIMENSION*) GetCurItem(), &dc, pos );
DrawPanel->MouseToCursorSchema();
break;
......@@ -991,8 +991,8 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
Delete_Module( (MODULE*) Item, DC, true );
break;
case TYPE_COTATION:
Delete_Cotation( (COTATION*) Item, DC );
case TYPE_DIMENSION:
Delete_Dimension( (DIMENSION*) Item, DC );
break;
case TYPE_MIRE:
......
......@@ -139,7 +139,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( int aLayer )
{
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_COTATION:
case TYPE_DIMENSION:
case TYPE_MIRE:
if( item->GetLayer() == aLayer )
{
......
......@@ -136,8 +136,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, EDGE_LAYER, FILLED );
break;
case TYPE_COTATION:
PlotCotation( plotter, (COTATION*) PtStruct, EDGE_LAYER, FILLED );
case TYPE_DIMENSION:
PlotDimension( plotter, (DIMENSION*) PtStruct, EDGE_LAYER, FILLED );
break;
case TYPE_MIRE:
......
......@@ -981,9 +981,9 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
if( TESTLINE( "COTATION" ) )
{
COTATION* Cotation = new COTATION( board );
board->Add( Cotation, ADD_APPEND );
Cotation->ReadCotationDescr( File, &LineNum );
DIMENSION* Dimension = new DIMENSION( board );
board->Add( Dimension, ADD_APPEND );
Dimension->ReadDimensionDescr( File, &LineNum );
continue;
}
......
......@@ -339,7 +339,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
case TYPE_TRACK:
case TYPE_ZONE:
case TYPE_MARKER_PCB:
case TYPE_COTATION:
case TYPE_DIMENSION:
case TYPE_MIRE:
break;
......
......@@ -113,7 +113,7 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT,
EVT_TOOL_RCLICKED( ID_PCB_DIMENSION_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
// Options Toolbar
......
......@@ -88,7 +88,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
// see above.
break;
......@@ -331,23 +331,23 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DisplayError( this, wxT( "Internal err: Struct not TYPE_MODULE" ) );
break;
case ID_PCB_COTATION_BUTT:
case ID_PCB_DIMENSION_BUTT:
if( getActiveLayer() <= LAST_COPPER_LAYER )
{
DisplayError( this, _( "Cotation not authorized on Copper layers" ) );
DisplayError( this, _( "Dimension not authorized on Copper layers" ) );
break;
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = Begin_Cotation( NULL, DC );
DrawStruct = Begin_Dimension( NULL, DC );
SetCurItem( DrawStruct );
DrawPanel->m_AutoPAN_Request = true;
}
else if( DrawStruct
&& (DrawStruct->Type() == TYPE_COTATION)
&& (DrawStruct->Type() == TYPE_DIMENSION)
&& (DrawStruct->m_Flags & IS_NEW) )
{
DrawStruct = Begin_Cotation( (COTATION*) DrawStruct, DC );
DrawStruct = Begin_Dimension( (DIMENSION*) DrawStruct, DC );
SetCurItem( DrawStruct );
DrawPanel->m_AutoPAN_Request = true;
}
......@@ -444,8 +444,8 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
DrawPanel->MouseToCursorSchema();
break;
case TYPE_COTATION:
Install_Edit_Cotation( (COTATION*) DrawStruct, DC, pos );
case TYPE_DIMENSION:
Install_Edit_Dimension( (DIMENSION*) DrawStruct, DC, pos );
DrawPanel->MouseToCursorSchema();
break;
......
......@@ -211,12 +211,12 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
createPopUpMenuForMarkers( (MARKER_PCB*) item, aPopMenu );
break;
case TYPE_COTATION:
case TYPE_DIMENSION:
if( !flags )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_COTATION,
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DIMENSION,
_( "Edit Dimension" ), edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_COTATION,
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION,
_( "Delete Dimension" ), delete_xpm );
}
break;
......@@ -302,7 +302,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case ID_PCB_ARC_BUTT:
case ID_PCB_ADD_TEXT_BUTT:
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_COTATION_BUTT:
case ID_PCB_DIMENSION_BUTT:
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_NO_CU_LAYER,
_( "Select Working Layer" ), select_w_layer_xpm );
aPopMenu->AppendSeparator();
......
......@@ -209,7 +209,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_TOOL( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_LINE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DIMENSION_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_SHOW_1_RATSNEST_BUTT,
......@@ -225,7 +225,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_DIMENSION_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE,
ID_POPUP_PCB_AUTOPLACE_END_RANGE,
......
......@@ -89,7 +89,7 @@ enum pcbnew_ids
ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE,
ID_POPUP_PCB_DELETE_MARKER,
ID_POPUP_PCB_DELETE_COTATION,
ID_POPUP_PCB_DELETE_DIMENSION,
ID_POPUP_PCB_MOVE_MIRE_REQUEST,
ID_POPUP_PCB_DELETE_MIRE,
......@@ -97,7 +97,7 @@ enum pcbnew_ids
ID_POPUP_PCB_STOP_CURRENT_DRAWING,
ID_POPUP_PCB_EDIT_COTATION,
ID_POPUP_PCB_EDIT_DIMENSION,
ID_POPUP_PCB_END_TRACK,
ID_POPUP_PCB_PLACE_VIA,
ID_POPUP_PCB_PLACE_MICROVIA,
......@@ -223,7 +223,7 @@ enum pcbnew_ids
ID_PCB_PAD_SETUP,
ID_PCB_COTATION_BUTT,
ID_PCB_DIMENSION_BUTT,
ID_PCB_DRAWINGS_WIDTHS_SETUP,
ID_PCB_GEN_CMP_FILE,
......
......@@ -79,7 +79,7 @@ void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* PtSegm, int masque_layer,
GRTraceMode trace_mode );
void PlotCotation( PLOTTER* plotter, COTATION* Cotation, int masque_layer,
void PlotDimension( PLOTTER* plotter, DIMENSION* Dimension, int masque_layer,
GRTraceMode trace_mode );
void PlotMirePcb( PLOTTER* plotter, MIREPCB* PtMire, int masque_layer,
......
......@@ -55,9 +55,9 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
trace_mode );
break;
case TYPE_COTATION:
PlotCotation( plotter,
(COTATION*) PtStruct,
case TYPE_DIMENSION:
PlotDimension( plotter,
(DIMENSION*) PtStruct,
masque_layer,
trace_mode );
break;
......@@ -276,61 +276,61 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
}
void PlotCotation( PLOTTER* plotter, COTATION* Cotation, int masque_layer,
void PlotDimension( PLOTTER* plotter, DIMENSION* Dimension, int masque_layer,
GRTraceMode trace_mode )
{
DRAWSEGMENT* DrawTmp;
if( (g_TabOneLayerMask[Cotation->GetLayer()] & masque_layer) == 0 )
if( (g_TabOneLayerMask[Dimension->GetLayer()] & masque_layer) == 0 )
return;
DrawTmp = new DRAWSEGMENT( NULL );
DrawTmp->m_Width = (trace_mode==FILAIRE) ? -1 : Cotation->m_Width;
DrawTmp->SetLayer( Cotation->GetLayer() );
DrawTmp->m_Width = (trace_mode==FILAIRE) ? -1 : Dimension->m_Width;
DrawTmp->SetLayer( Dimension->GetLayer() );
PlotTextePcb( plotter, Cotation->m_Text, masque_layer, trace_mode );
PlotTextePcb( plotter, Dimension->m_Text, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->Barre_ox;
DrawTmp->m_Start.y = Cotation->Barre_oy;
DrawTmp->m_End.x = Cotation->Barre_fx;
DrawTmp->m_End.y = Cotation->Barre_fy;
DrawTmp->m_Start.x = Dimension->Barre_ox;
DrawTmp->m_Start.y = Dimension->Barre_oy;
DrawTmp->m_End.x = Dimension->Barre_fx;
DrawTmp->m_End.y = Dimension->Barre_fy;
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->TraitG_ox;
DrawTmp->m_Start.y = Cotation->TraitG_oy;
DrawTmp->m_End.x = Cotation->TraitG_fx;
DrawTmp->m_End.y = Cotation->TraitG_fy;
DrawTmp->m_Start.x = Dimension->TraitG_ox;
DrawTmp->m_Start.y = Dimension->TraitG_oy;
DrawTmp->m_End.x = Dimension->TraitG_fx;
DrawTmp->m_End.y = Dimension->TraitG_fy;
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->TraitD_ox;
DrawTmp->m_Start.y = Cotation->TraitD_oy;
DrawTmp->m_End.x = Cotation->TraitD_fx;
DrawTmp->m_End.y = Cotation->TraitD_fy;
DrawTmp->m_Start.x = Dimension->TraitD_ox;
DrawTmp->m_Start.y = Dimension->TraitD_oy;
DrawTmp->m_End.x = Dimension->TraitD_fx;
DrawTmp->m_End.y = Dimension->TraitD_fy;
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->FlecheD1_ox;
DrawTmp->m_Start.y = Cotation->FlecheD1_oy;
DrawTmp->m_End.x = Cotation->FlecheD1_fx;
DrawTmp->m_End.y = Cotation->FlecheD1_fy;
DrawTmp->m_Start.x = Dimension->FlecheD1_ox;
DrawTmp->m_Start.y = Dimension->FlecheD1_oy;
DrawTmp->m_End.x = Dimension->FlecheD1_fx;
DrawTmp->m_End.y = Dimension->FlecheD1_fy;
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->FlecheD2_ox;
DrawTmp->m_Start.y = Cotation->FlecheD2_oy;
DrawTmp->m_End.x = Cotation->FlecheD2_fx;
DrawTmp->m_End.y = Cotation->FlecheD2_fy;
DrawTmp->m_Start.x = Dimension->FlecheD2_ox;
DrawTmp->m_Start.y = Dimension->FlecheD2_oy;
DrawTmp->m_End.x = Dimension->FlecheD2_fx;
DrawTmp->m_End.y = Dimension->FlecheD2_fy;
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->FlecheG1_ox;
DrawTmp->m_Start.y = Cotation->FlecheG1_oy;
DrawTmp->m_End.x = Cotation->FlecheG1_fx;
DrawTmp->m_End.y = Cotation->FlecheG1_fy;
DrawTmp->m_Start.x = Dimension->FlecheG1_ox;
DrawTmp->m_Start.y = Dimension->FlecheG1_oy;
DrawTmp->m_End.x = Dimension->FlecheG1_fx;
DrawTmp->m_End.y = Dimension->FlecheG1_fy;
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
DrawTmp->m_Start.x = Cotation->FlecheG2_ox;
DrawTmp->m_Start.y = Cotation->FlecheG2_oy;
DrawTmp->m_End.x = Cotation->FlecheG2_fx;
DrawTmp->m_End.y = Cotation->FlecheG2_fy;
DrawTmp->m_Start.x = Dimension->FlecheG2_ox;
DrawTmp->m_Start.y = Dimension->FlecheG2_oy;
DrawTmp->m_End.x = Dimension->FlecheG2_fx;
DrawTmp->m_End.y = Dimension->FlecheG2_fy;
PlotDrawSegment( plotter, DrawTmp, masque_layer, trace_mode );
delete DrawTmp;
......@@ -805,8 +805,8 @@ void WinEDA_BasePcbFrame::Plot_Standard_Layer( PLOTTER* aPlotter,
PlotTextePcb( aPlotter, (TEXTE_PCB*) item, aLayerMask, aPlotMode );
break;
case TYPE_COTATION:
PlotCotation( aPlotter, (COTATION*) item, aLayerMask, aPlotMode );
case TYPE_DIMENSION:
PlotDimension( aPlotter, (DIMENSION*) item, aLayerMask, aPlotMode );
break;
case TYPE_MIRE:
......
......@@ -49,7 +49,7 @@ void WinEDA_ModuleEditFrame::PrintPage( wxDC* aDC,
DisplayOpt.ContrastModeDisplay = false;
DisplayOpt.DisplayPadFill = true;
DisplayOpt.DisplayViaFill = true;
DisplayOpt.DisplayViaFill = true;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
......@@ -148,7 +148,7 @@ void WinEDA_PcbFrame::PrintPage( wxDC* aDC,
// to the current printed layer
DisplayOpt.ContrastModeDisplay = true;
DisplayOpt.DisplayPadFill = true;
// Calculate the active layer number to print from its mask layer:
GetScreen()->m_Active_Layer = 0;
for(int kk = 0; kk < 32; kk ++ )
......@@ -159,19 +159,19 @@ void WinEDA_PcbFrame::PrintPage( wxDC* aDC,
break;
}
}
// pads on Silkscreen layer are usually plot in sketch mode:
if( (GetScreen()->m_Active_Layer == SILKSCREEN_N_BACK) ||
(GetScreen()->m_Active_Layer == SILKSCREEN_N_FRONT) )
DisplayOpt.DisplayPadFill = false;
}
else
{
DisplayOpt.DisplayPadFill = false;
}
}
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
......@@ -203,7 +203,7 @@ void WinEDA_PcbFrame::PrintPage( wxDC* aDC,
switch( item->Type() )
{
case TYPE_DRAWSEGMENT:
case TYPE_COTATION:
case TYPE_DIMENSION:
case TYPE_TEXTE:
case TYPE_MIRE:
if( ( ( 1 << item->GetLayer() ) & aPrintMaskLayer ) == 0 )
......
......@@ -36,7 +36,7 @@ void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
case ID_PCB_CIRCLE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_COTATION_BUTT:
case ID_PCB_DIMENSION_BUTT:
case ID_PCB_ADD_TEXT_BUTT:
InstallPcbOptionsFrame( ID_PCB_DRAWINGS_WIDTHS_SETUP );
break;
......@@ -65,7 +65,7 @@ void WinEDA_ModuleEditFrame::ToolOnRightClick( wxCommandEvent& event )
case ID_PCB_CIRCLE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_COTATION_BUTT:
case ID_PCB_DIMENSION_BUTT:
case ID_PCB_ADD_TEXT_BUTT:
InstallOptionsFrame( pos );
break;
......
......@@ -443,7 +443,7 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
_( "Add text" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_COTATION_BUTT, wxEmptyString,
m_VToolBar->AddTool( ID_PCB_DIMENSION_BUTT, wxEmptyString,
wxBitmap( add_dimension_xpm ),
_( "Add dimension" ), wxITEM_CHECK );
......
......@@ -129,7 +129,7 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
switch( item->Type() )
{
case TYPE_COTATION:
case TYPE_DIMENSION:
case TYPE_TEXTE:
case TYPE_MIRE:
case TYPE_DRAWSEGMENT:
......
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