improved pcbnew marker support
This commit is contained in:
parent
d985f2d640
commit
aba115f0fb
|
@ -13,6 +13,9 @@ email address.
|
||||||
added EDA_BaseStruct::DeleteStructList()
|
added EDA_BaseStruct::DeleteStructList()
|
||||||
deleted gerbview/struct.cpp, pcbnew/struct.cpp,
|
deleted gerbview/struct.cpp, pcbnew/struct.cpp,
|
||||||
BOARD::~BOARD() now deletes objects that it owns.
|
BOARD::~BOARD() now deletes objects that it owns.
|
||||||
|
Collectors now finds MARQUEURs also
|
||||||
|
added MARQUEURS::Display_Infos()
|
||||||
|
added MARQUEURS::HitTest()
|
||||||
|
|
||||||
|
|
||||||
2007-Oct-2 UPDATE Dick Hollenbeck <dick@softplc.com>
|
2007-Oct-2 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
|
|
|
@ -190,6 +190,7 @@ void BASE_SCREEN::SetZoomList( int* zoomlist )
|
||||||
// Init liste
|
// Init liste
|
||||||
if( m_ZoomList )
|
if( m_ZoomList )
|
||||||
free( m_ZoomList );
|
free( m_ZoomList );
|
||||||
|
|
||||||
m_ZoomList = (int*) MyZMalloc( nbitems * sizeof( int) );
|
m_ZoomList = (int*) MyZMalloc( nbitems * sizeof( int) );
|
||||||
|
|
||||||
for( ii = 0, zoom = zoomlist; ii < nbitems; zoom++, ii++ )
|
for( ii = 0, zoom = zoomlist; ii < nbitems; zoom++, ii++ )
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* msgpanel.cpp - fonctions des classes du type WinEDA_MsgPanel */
|
/* msgpanel.cpp - fonctions des classes du type WinEDA_MsgPanel */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
|
@ -14,131 +14,132 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
/* table des evenements captes par un WinEDA_MsgPanel */
|
/* table des evenements captes par un WinEDA_MsgPanel */
|
||||||
BEGIN_EVENT_TABLE(WinEDA_MsgPanel, wxPanel)
|
BEGIN_EVENT_TABLE( WinEDA_MsgPanel, wxPanel )
|
||||||
EVT_PAINT(WinEDA_MsgPanel::OnPaint)
|
EVT_PAINT( WinEDA_MsgPanel::OnPaint )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************/
|
||||||
|
/* Fonctions de base de WinEDA_MsgPanel: l'ecran de messages */
|
||||||
|
/***********************************************************/
|
||||||
|
|
||||||
/***********************************************************/
|
WinEDA_MsgPanel::WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id,
|
||||||
/* Fonctions de base de WinEDA_MsgPanel: l'ecran de messages */
|
const wxPoint& pos, const wxSize& size ) :
|
||||||
/***********************************************************/
|
wxPanel( parent, id, pos, size )
|
||||||
|
|
||||||
WinEDA_MsgPanel::WinEDA_MsgPanel(WinEDA_DrawFrame *parent, int id,
|
|
||||||
const wxPoint& pos, const wxSize& size):
|
|
||||||
wxPanel(parent, id, pos, size )
|
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
SetFont( *g_MsgFont );
|
SetFont( *g_MsgFont );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WinEDA_MsgPanel::~WinEDA_MsgPanel()
|
WinEDA_MsgPanel::~WinEDA_MsgPanel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
void WinEDA_MsgPanel::OnPaint(wxPaintEvent & event)
|
void WinEDA_MsgPanel::OnPaint( wxPaintEvent& event )
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc( this );
|
||||||
|
|
||||||
EraseMsgBox(&dc); event.Skip();
|
EraseMsgBox( &dc ); event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void WinEDA_MsgPanel::Affiche_1_Parametre(int pos_X,const wxString & texte_H,
|
void WinEDA_MsgPanel::Affiche_1_Parametre( int pos_X, const wxString& texte_H,
|
||||||
const wxString & texte_L,int color)
|
const wxString& texte_L, int color )
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Routine d'affichage d'un parametre.
|
* Routine d'affichage d'un parametre.
|
||||||
pos_X = cadrage horizontal
|
* pos_X = cadrage horizontal
|
||||||
si pos_X < 0 : la position horizontale est la derniere
|
* si pos_X < 0 : la position horizontale est la derniere
|
||||||
valeur demandee >= 0
|
* valeur demandee >= 0
|
||||||
texte_H = texte a afficher en ligne superieure.
|
* texte_H = texte a afficher en ligne superieure.
|
||||||
si "", par d'affichage sur cette ligne
|
* si "", par d'affichage sur cette ligne
|
||||||
texte_L = texte a afficher en ligne inferieure.
|
* texte_L = texte a afficher en ligne inferieure.
|
||||||
si "", par d'affichage sur cette ligne
|
* si "", par d'affichage sur cette ligne
|
||||||
color = couleur d'affichage
|
* color = couleur d'affichage
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
static int old_pos_X;
|
static int old_pos_X;
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxSize FontSizeInPixels, DrawSize;
|
wxSize FontSizeInPixels, DrawSize;
|
||||||
wxClientDC dc(this);
|
|
||||||
|
|
||||||
DrawSize = GetClientSize();
|
wxClientDC dc( this );
|
||||||
|
|
||||||
|
DrawSize = GetClientSize();
|
||||||
|
|
||||||
|
dc.SetBackground( *wxBLACK_BRUSH );
|
||||||
|
dc.SetBackgroundMode( wxSOLID );
|
||||||
|
|
||||||
dc.SetBackground(* wxBLACK_BRUSH );
|
|
||||||
dc.SetBackgroundMode(wxSOLID);
|
|
||||||
// dc.SetBackgroundMode(wxTRANSPARENT);
|
// dc.SetBackgroundMode(wxTRANSPARENT);
|
||||||
dc.SetTextBackground(GetBackgroundColour());
|
dc.SetTextBackground( GetBackgroundColour() );
|
||||||
dc.SetFont(*g_MsgFont);
|
dc.SetFont( *g_MsgFont );
|
||||||
dc.GetTextExtent( wxT("W"), &FontSizeInPixels.x, &FontSizeInPixels.y );
|
dc.GetTextExtent( wxT( "W" ), &FontSizeInPixels.x, &FontSizeInPixels.y );
|
||||||
|
|
||||||
if ( color >= 0 )
|
if( color >= 0 )
|
||||||
{
|
{
|
||||||
color &= MASKCOLOR;
|
color &= MASKCOLOR;
|
||||||
dc.SetTextForeground(wxColour(
|
dc.SetTextForeground( wxColour(
|
||||||
ColorRefs[color].m_Red, ColorRefs[color].m_Green,
|
ColorRefs[color].m_Red, ColorRefs[color].m_Green,
|
||||||
ColorRefs[color].m_Blue) );
|
ColorRefs[color].m_Blue ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pos_X >= 0 )
|
if( pos_X >= 0 )
|
||||||
{
|
{
|
||||||
old_pos_X = pos.x = pos_X * (FontSizeInPixels.x + 2);
|
old_pos_X = pos.x = pos_X * (FontSizeInPixels.x + 2);
|
||||||
}
|
}
|
||||||
else pos.x = old_pos_X;
|
else
|
||||||
|
pos.x = old_pos_X;
|
||||||
|
|
||||||
|
if( !texte_H.IsEmpty() )
|
||||||
if( !texte_H.IsEmpty())
|
{
|
||||||
{
|
pos.y = (DrawSize.y / 2) - FontSizeInPixels.y;;
|
||||||
pos.y = (DrawSize.y/2) - FontSizeInPixels.y;;
|
dc.DrawText( texte_H.GetData(), pos.x, pos.y );
|
||||||
dc.DrawText(texte_H.GetData(), pos.x, pos.y);
|
}
|
||||||
}
|
|
||||||
if( !texte_L.IsEmpty())
|
if( !texte_L.IsEmpty() )
|
||||||
{
|
{
|
||||||
pos.y = DrawSize.y - FontSizeInPixels.y;
|
pos.y = DrawSize.y - FontSizeInPixels.y;
|
||||||
dc.DrawText(texte_L.GetData(), pos.x, pos.y);
|
dc.DrawText( texte_L.GetData(), pos.x, pos.y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
void WinEDA_MsgPanel::EraseMsgBox()
|
void WinEDA_MsgPanel::EraseMsgBox()
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
/* Effacement de la fenetre d'affichage des messages de bas d'ecran
|
/* Effacement de la fenetre d'affichage des messages de bas d'ecran
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxClientDC dc(this);
|
wxClientDC dc( this );
|
||||||
EraseMsgBox(&dc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************/
|
EraseMsgBox( &dc );
|
||||||
void WinEDA_MsgPanel::EraseMsgBox(wxDC * DC)
|
|
||||||
/*******************************************/
|
|
||||||
{
|
|
||||||
wxSize size;
|
|
||||||
wxColor color;
|
|
||||||
wxPen pen;
|
|
||||||
wxBrush brush;
|
|
||||||
|
|
||||||
size = GetClientSize();
|
|
||||||
color = GetBackgroundColour();
|
|
||||||
pen.SetColour(color);
|
|
||||||
brush.SetColour(color);
|
|
||||||
brush.SetStyle(wxSOLID);
|
|
||||||
DC->SetPen(pen);
|
|
||||||
DC->SetBrush(brush);
|
|
||||||
|
|
||||||
DC->DrawRectangle(0,0,size.x,size.y);
|
|
||||||
DC->SetBrush(wxNullBrush);
|
|
||||||
DC->SetPen(wxNullPen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************/
|
||||||
|
void WinEDA_MsgPanel::EraseMsgBox( wxDC* DC )
|
||||||
|
/*******************************************/
|
||||||
|
{
|
||||||
|
wxSize size;
|
||||||
|
wxColor color;
|
||||||
|
wxPen pen;
|
||||||
|
wxBrush brush;
|
||||||
|
|
||||||
|
size = GetClientSize();
|
||||||
|
color = GetBackgroundColour();
|
||||||
|
pen.SetColour( color );
|
||||||
|
brush.SetColour( color );
|
||||||
|
brush.SetStyle( wxSOLID );
|
||||||
|
DC->SetPen( pen );
|
||||||
|
DC->SetBrush( brush );
|
||||||
|
|
||||||
|
DC->DrawRectangle( 0, 0, size.x, size.y );
|
||||||
|
DC->SetBrush( wxNullBrush );
|
||||||
|
DC->SetPen( wxNullPen );
|
||||||
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
case HK_NEXT_SEARCH:
|
case HK_NEXT_SEARCH:
|
||||||
if( ItemInEdit )
|
if( ItemInEdit )
|
||||||
break;
|
break;
|
||||||
if( g_LastSearchIsMarker )
|
if( g_LastSearchIsMarker )
|
||||||
WinEDA_SchematicFrame::FindMarker( 1 );
|
WinEDA_SchematicFrame::FindMarker( 1 );
|
||||||
else
|
else
|
||||||
FindSchematicItem( wxEmptyString, 2 );
|
FindSchematicItem( wxEmptyString, 2 );
|
||||||
|
|
|
@ -448,6 +448,23 @@ public:
|
||||||
~MARQUEUR();
|
~MARQUEUR();
|
||||||
void UnLink();
|
void UnLink();
|
||||||
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode );
|
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 HitTest
|
||||||
|
* tests if the given wxPoint is within the bounds of this object.
|
||||||
|
* @param ref_pos A wxPoint to test
|
||||||
|
* @return bool - true if a hit, else false
|
||||||
|
*/
|
||||||
|
bool HitTest( const wxPoint& ref_pos );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPEMARQUEUR:
|
case TYPEMARQUEUR:
|
||||||
text << _( "Marker" );
|
text << _( "Marker" ) << wxT( " @(" ) << ((MARQUEUR*)item)->m_Pos.x << wxT(",") << ((MARQUEUR*)item)->m_Pos.y << wxT(")");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPECOTATION:
|
case TYPECOTATION:
|
||||||
|
|
|
@ -681,7 +681,7 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
|
||||||
switch( Type() )
|
switch( Type() )
|
||||||
{
|
{
|
||||||
case TYPEVIA:
|
case TYPEVIA:
|
||||||
msg = g_ViaType_Name[m_Shape & 255];
|
msg = g_ViaType_Name[Shape()];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPETRACK:
|
case TYPETRACK:
|
||||||
|
@ -764,6 +764,7 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
|
||||||
|
|
||||||
int drill_value = m_Drill >= 0 ?
|
int drill_value = m_Drill >= 0 ?
|
||||||
m_Drill : g_DesignSettings.m_ViaDrill;
|
m_Drill : g_DesignSettings.m_ViaDrill;
|
||||||
|
|
||||||
valeur_param( (unsigned) drill_value, msg );
|
valeur_param( (unsigned) drill_value, msg );
|
||||||
|
|
||||||
text_pos += 8;
|
text_pos += 8;
|
||||||
|
|
|
@ -303,6 +303,36 @@ void MARQUEUR::UnLink()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MARQUEUR::Display_Infos( WinEDA_DrawFrame* frame )
|
||||||
|
{
|
||||||
|
int text_pos;
|
||||||
|
|
||||||
|
frame->MsgPanel->EraseMsgBox();
|
||||||
|
|
||||||
|
text_pos = 1;
|
||||||
|
Affiche_1_Parametre( frame, text_pos, _( "Type" ), _("Marker"), DARKCYAN );
|
||||||
|
|
||||||
|
text_pos = 12;
|
||||||
|
Affiche_1_Parametre( frame, text_pos, _( "Marker Error Text" ), m_Diag, RED );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool MARQUEUR::HitTest( const wxPoint& refPos )
|
||||||
|
{
|
||||||
|
// currently the MARKER is about 14 pixels by 14 pixels
|
||||||
|
int xCenter = m_Pos.x + 7;
|
||||||
|
int yCenter = m_Pos.y + 7;
|
||||||
|
|
||||||
|
int dx = refPos.x - xCenter;
|
||||||
|
int dy = refPos.y - yCenter;
|
||||||
|
|
||||||
|
if( ABS(dx) <= 7 && ABS(dy) <= 7 )
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Class SCREEN: classe de gestion d'un affichage */
|
/* Class SCREEN: classe de gestion d'un affichage */
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
|
@ -33,8 +33,12 @@
|
||||||
|
|
||||||
// see collectors.h
|
// see collectors.h
|
||||||
const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
|
const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
|
||||||
|
|
||||||
|
// there are some restrictions on the order of items in the general case.
|
||||||
|
// all items in m_Drawings for instance should be contiguous.
|
||||||
TYPETEXTE,
|
TYPETEXTE,
|
||||||
TYPEDRAWSEGMENT,
|
TYPEDRAWSEGMENT,
|
||||||
|
TYPEMARQUEUR,
|
||||||
TYPECOTATION,
|
TYPECOTATION,
|
||||||
TYPEVIA,
|
TYPEVIA,
|
||||||
TYPETRACK,
|
TYPETRACK,
|
||||||
|
@ -49,6 +53,7 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
|
||||||
const KICAD_T GENERAL_COLLECTOR::PrimaryItems[] = {
|
const KICAD_T GENERAL_COLLECTOR::PrimaryItems[] = {
|
||||||
TYPETEXTE,
|
TYPETEXTE,
|
||||||
TYPEDRAWSEGMENT,
|
TYPEDRAWSEGMENT,
|
||||||
|
TYPEMARQUEUR,
|
||||||
TYPECOTATION,
|
TYPECOTATION,
|
||||||
TYPEVIA,
|
TYPEVIA,
|
||||||
TYPETRACK,
|
TYPETRACK,
|
||||||
|
@ -60,6 +65,7 @@ const KICAD_T GENERAL_COLLECTOR::PrimaryItems[] = {
|
||||||
const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
|
const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
|
||||||
TYPETEXTE,
|
TYPETEXTE,
|
||||||
TYPEDRAWSEGMENT,
|
TYPEDRAWSEGMENT,
|
||||||
|
TYPEMARQUEUR,
|
||||||
TYPECOTATION,
|
TYPECOTATION,
|
||||||
TYPEVIA,
|
TYPEVIA,
|
||||||
TYPETRACK,
|
TYPETRACK,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
/* Routines generales d'affichage des curseurs et des marqueurs */
|
/* Routines generales d'affichage des curseurs et des marqueurs */
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
/* fichier curseurs.cpp */
|
/* fichier curseurs.cpp */
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -14,57 +14,61 @@
|
||||||
/* Routines Locales : */
|
/* Routines Locales : */
|
||||||
|
|
||||||
|
|
||||||
/* Forme (bit_map) du marqueur */
|
/* Forme (bit_map) du marqueur */
|
||||||
static char Default_MarkerBitmap[]=
|
static char Default_MarkerBitmap[] =
|
||||||
{
|
|
||||||
12, 12, /* Dimensions x et y du dessin de marqueurs*/
|
|
||||||
1,1,1,1,1,1,1,1,0,0,0,0, /* bitmap: 1 = color, 0 = notrace */
|
|
||||||
1,1,1,0,1,0,1,1,0,0,0,0,
|
|
||||||
1,1,1,1,0,0,0,1,0,0,0,0,
|
|
||||||
1,0,1,1,1,0,0,0,0,0,0,0,
|
|
||||||
1,1,0,1,1,1,0,0,0,0,0,0,
|
|
||||||
1,1,0,0,1,1,1,0,0,0,0,0,
|
|
||||||
1,1,1,0,0,1,1,1,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,1,1,1,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,1,1,1,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,1,1,1,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,1,1,1,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,1,0
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
void MARQUEUR::Draw( WinEDA_DrawPanel * panel, wxDC * DC, int DrawMode)
|
|
||||||
/**********************************************************************/
|
|
||||||
/*
|
|
||||||
Trace un repere sur l'ecran au point de coordonnees PCB pos
|
|
||||||
Le marqueur est defini par un tableau de 2 + (lig*col) elements:
|
|
||||||
1er element: dim nbre ligne
|
|
||||||
2er element: dim nbre col
|
|
||||||
suite: lig * col elements a 0 ou 1 : si 1 mise a color du pixel
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int px, py;
|
12, 12, /* Dimensions x et y du dessin de marqueurs*/
|
||||||
int ii, ii_max, jj, jj_max;
|
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* bitmap: 1 = color, 0 = notrace */
|
||||||
char * pt_bitmap = m_Bitmap;
|
1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0,
|
||||||
|
1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
|
||||||
if ( pt_bitmap == NULL ) pt_bitmap = Default_MarkerBitmap;
|
1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
|
||||||
|
1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,
|
||||||
|
1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0
|
||||||
|
};
|
||||||
|
|
||||||
GRSetDrawMode(DC, DrawMode);
|
|
||||||
|
|
||||||
px = GRMapX(m_Pos.x); py = GRMapY(m_Pos.y);
|
/**********************************************************************/
|
||||||
|
void MARQUEUR::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode )
|
||||||
|
/**********************************************************************/
|
||||||
|
|
||||||
/* Lecture des dimensions */
|
/*
|
||||||
ii_max = *(pt_bitmap++); jj_max = *(pt_bitmap++);
|
* Trace un repere sur l'ecran au point de coordonnees PCB pos
|
||||||
|
* Le marqueur est defini par un tableau de 2 + (lig*col) elements:
|
||||||
|
* 1er element: dim nbre ligne
|
||||||
|
* 2er element: dim nbre col
|
||||||
|
* suite: lig * col elements a 0 ou 1 : si 1 mise a color du pixel
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
int px, py;
|
||||||
|
int ii, ii_max, jj, jj_max;
|
||||||
|
char* pt_bitmap = m_Bitmap;
|
||||||
|
|
||||||
/* Trace du bitmap */
|
if( pt_bitmap == NULL )
|
||||||
for( ii = 0; ii < ii_max; ii++)
|
pt_bitmap = Default_MarkerBitmap;
|
||||||
{
|
|
||||||
for( jj = 0; jj < jj_max; jj++, pt_bitmap++)
|
GRSetDrawMode( DC, DrawMode );
|
||||||
{
|
|
||||||
if(*pt_bitmap) GRSPutPixel(&panel->m_ClipBox, DC,
|
px = GRMapX( m_Pos.x );
|
||||||
px+ii , py+jj , m_Color);
|
py = GRMapY( m_Pos.y );
|
||||||
}
|
|
||||||
}
|
/* Lecture des dimensions */
|
||||||
|
ii_max = *(pt_bitmap++);
|
||||||
|
jj_max = *(pt_bitmap++);
|
||||||
|
|
||||||
|
/* Trace du bitmap */
|
||||||
|
for( ii = 0; ii < ii_max; ii++ )
|
||||||
|
{
|
||||||
|
for( jj = 0; jj < jj_max; jj++, pt_bitmap++ )
|
||||||
|
{
|
||||||
|
if( *pt_bitmap )
|
||||||
|
GRSPutPixel( &panel->m_ClipBox, DC,
|
||||||
|
px + ii, py + jj, m_Color );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,12 @@ static bool Test_Pad_to_Pads_Drc( WinEDA_BasePcbFrame* frame,
|
||||||
static int TestClearanceSegmToPad( const D_PAD* pad_to_test, int seg_width, int isol );
|
static int TestClearanceSegmToPad( const D_PAD* pad_to_test, int seg_width, int isol );
|
||||||
static int TestMarginToCircle( int cx, int cy, int rayon, int longueur );
|
static int TestMarginToCircle( int cx, int cy, int rayon, int longueur );
|
||||||
static int Tst_Ligne( int x1, int y1, int x2, int y2 );
|
static int Tst_Ligne( int x1, int y1, int x2, int y2 );
|
||||||
|
|
||||||
static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
|
static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
|
||||||
TRACK* pt_ref, BOARD_ITEM* pt_item, int errnumber );
|
TRACK* pt_ref, BOARD_ITEM* pt_item, int errnumber );
|
||||||
static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
||||||
BOARD* Pcb, D_PAD* pad1, D_PAD* pad2 );
|
static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
|
||||||
|
D_PAD* pad1, D_PAD* pad2 );
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
@ -923,6 +925,7 @@ static bool Test_Pad_to_Pads_Drc( WinEDA_BasePcbFrame* frame,
|
||||||
MaskLayer = pad_ref->m_Masque_Layer & ALL_CU_LAYERS;
|
MaskLayer = pad_ref->m_Masque_Layer & ALL_CU_LAYERS;
|
||||||
int x_limite = max_size + g_DesignSettings.m_TrackClearence +
|
int x_limite = max_size + g_DesignSettings.m_TrackClearence +
|
||||||
pad_ref->m_Rayon + pad_ref->m_Pos.x;
|
pad_ref->m_Rayon + pad_ref->m_Pos.x;
|
||||||
|
|
||||||
for( ; pad_list < end_buffer; pad_list++ )
|
for( ; pad_list < end_buffer; pad_list++ )
|
||||||
{
|
{
|
||||||
pad = *pad_list;
|
pad = *pad_list;
|
||||||
|
@ -939,11 +942,11 @@ static bool Test_Pad_to_Pads_Drc( WinEDA_BasePcbFrame* frame,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* The pad must be in a net (i.e pt_pad->m_NetCode != 0 ),
|
/* The pad must be in a net (i.e pt_pad->m_NetCode != 0 ),
|
||||||
* But noe probleme if pads have the same netcode (same net)*/
|
* But no problem if pads have the same netcode (same net)*/
|
||||||
if( pad->m_NetCode && (pad_ref->m_NetCode == pad->m_NetCode) )
|
if( pad->m_NetCode && (pad_ref->m_NetCode == pad->m_NetCode) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* No proble if pads are from the same footprint
|
/* No problem if pads are from the same footprint
|
||||||
* and have the same pad number ( equivalent pads ) */
|
* and have the same pad number ( equivalent pads ) */
|
||||||
if( (pad->m_Parent == pad_ref->m_Parent) && (pad->m_NumPadName == pad_ref->m_NumPadName) )
|
if( (pad->m_Parent == pad_ref->m_Parent) && (pad->m_NumPadName == pad_ref->m_NumPadName) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -1151,6 +1154,7 @@ static int TestClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int dis
|
||||||
|
|
||||||
if( bflag == OK_DRC )
|
if( bflag == OK_DRC )
|
||||||
return OK_DRC;
|
return OK_DRC;
|
||||||
|
|
||||||
/* Erreur DRC : analyse fine de la forme de la pastille */
|
/* Erreur DRC : analyse fine de la forme de la pastille */
|
||||||
|
|
||||||
switch( pad_to_test->m_PadShape )
|
switch( pad_to_test->m_PadShape )
|
||||||
|
@ -1360,7 +1364,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
|
||||||
|
|
||||||
wxString module_name = ( (MODULE*) (pad->m_Parent) )->m_Reference->m_Text;
|
wxString module_name = ( (MODULE*) (pad->m_Parent) )->m_Reference->m_Text;
|
||||||
|
|
||||||
msg.Printf( _( "%d Drc Err %d %s (net %s)and PAD %s (%s) net %s @ %d,%d\n" ),
|
msg.Printf( _( "%d Drc Err %d %s (net %s) and PAD %s (%s) net %s @ %d,%d\n" ),
|
||||||
ErrorsDRC_Count, errnumber, tracktype.GetData(),
|
ErrorsDRC_Count, errnumber, tracktype.GetData(),
|
||||||
netname1.GetData(),
|
netname1.GetData(),
|
||||||
pad_name.GetData(), module_name.GetData(),
|
pad_name.GetData(), module_name.GetData(),
|
||||||
|
@ -1437,12 +1441,14 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
|
||||||
wxString pad_name2 = pad2->ReturnStringPadName();
|
wxString pad_name2 = pad2->ReturnStringPadName();
|
||||||
wxString module_name2 = ( (MODULE*) (pad2->m_Parent) )->m_Reference->m_Text;
|
wxString module_name2 = ( (MODULE*) (pad2->m_Parent) )->m_Reference->m_Text;
|
||||||
wxString netname1, netname2;
|
wxString netname1, netname2;
|
||||||
|
|
||||||
EQUIPOT* equipot = Pcb->FindNet( pad1->m_NetCode );
|
EQUIPOT* equipot = Pcb->FindNet( pad1->m_NetCode );
|
||||||
|
|
||||||
if( equipot )
|
if( equipot )
|
||||||
netname1 = equipot->m_Netname;
|
netname1 = equipot->m_Netname;
|
||||||
else
|
else
|
||||||
netname1 = wxT( "<noname>" );
|
netname1 = wxT( "<noname>" );
|
||||||
|
|
||||||
equipot = Pcb->FindNet( pad2->m_NetCode );
|
equipot = Pcb->FindNet( pad2->m_NetCode );
|
||||||
if( equipot )
|
if( equipot )
|
||||||
netname2 = equipot->m_Netname;
|
netname2 = equipot->m_Netname;
|
||||||
|
@ -1450,19 +1456,21 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
|
||||||
netname2 = wxT( "<noname>" );
|
netname2 = wxT( "<noname>" );
|
||||||
|
|
||||||
msg.Printf( _( "%d Drc Err: PAD %s (%s) net %s @ %d,%d and PAD %s (%s) net %s @ %d,%d\n" ),
|
msg.Printf( _( "%d Drc Err: PAD %s (%s) net %s @ %d,%d and PAD %s (%s) net %s @ %d,%d\n" ),
|
||||||
ErrorsDRC_Count, pad_name1.GetData(), module_name1.GetData(),
|
ErrorsDRC_Count,
|
||||||
netname1.GetData(), pad1->m_Pos.x, pad1->m_Pos.y,
|
pad_name1.GetData(), module_name1.GetData(), netname1.GetData(), pad1->m_Pos.x, pad1->m_Pos.y,
|
||||||
pad_name2.GetData(), module_name2.GetData(),
|
pad_name2.GetData(), module_name2.GetData(), netname2.GetData(), pad2->m_Pos.x, pad2->m_Pos.y );
|
||||||
netname2.GetData(), pad2->m_Pos.x, pad2->m_Pos.y );
|
|
||||||
if( DrcFrame )
|
if( DrcFrame )
|
||||||
DrcFrame->m_logWindow->AppendText( msg );
|
DrcFrame->m_logWindow->AppendText( msg );
|
||||||
else
|
else
|
||||||
panel->m_Parent->Affiche_Message( msg );
|
panel->m_Parent->Affiche_Message( msg );
|
||||||
|
|
||||||
if( s_RptFile )
|
if( s_RptFile )
|
||||||
fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) );
|
fprintf( s_RptFile, "%s", CONV_TO_UTF8( msg ) );
|
||||||
|
|
||||||
if( current_marqueur == NULL )
|
if( current_marqueur == NULL )
|
||||||
current_marqueur = new MARQUEUR( Pcb );
|
current_marqueur = new MARQUEUR( Pcb );
|
||||||
|
|
||||||
current_marqueur->m_Pos = pad1->m_Pos;
|
current_marqueur->m_Pos = pad1->m_Pos;
|
||||||
current_marqueur->m_Color = WHITE;
|
current_marqueur->m_Color = WHITE;
|
||||||
current_marqueur->m_Diag = msg;
|
current_marqueur->m_Diag = msg;
|
||||||
|
|
|
@ -47,10 +47,9 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
PCB_SCREEN* screen = m_Parent->GetScreen();
|
PCB_SCREEN* screen = m_Parent->GetScreen();
|
||||||
wxPoint locate_pos;
|
wxPoint locate_pos;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
bool succes = FALSE;
|
|
||||||
bool FindMarker = FALSE;
|
bool FindMarker = FALSE;
|
||||||
MODULE* Module;
|
|
||||||
int StartCount;
|
int StartCount;
|
||||||
|
BOARD_ITEM* foundItem = 0;
|
||||||
|
|
||||||
switch( event.GetId() )
|
switch( event.GetId() )
|
||||||
{
|
{
|
||||||
|
@ -60,6 +59,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_FIND_MARKER:
|
case ID_FIND_MARKER:
|
||||||
s_MarkerCount = 0;
|
s_MarkerCount = 0;
|
||||||
|
// fall thru
|
||||||
|
|
||||||
case ID_FIND_NEXT_MARKER:
|
case ID_FIND_NEXT_MARKER:
|
||||||
FindMarker = TRUE;
|
FindMarker = TRUE;
|
||||||
|
@ -73,16 +73,17 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
|
|
||||||
if( FindMarker )
|
if( FindMarker )
|
||||||
{
|
{
|
||||||
MARQUEUR* Marker = (MARQUEUR*) m_Parent->m_Pcb->m_Drawings;
|
MARQUEUR* marker = (MARQUEUR*) m_Parent->m_Pcb->m_Drawings;
|
||||||
for( ; Marker != NULL; Marker = (MARQUEUR*) Marker->Pnext )
|
for( ; marker; marker = (MARQUEUR*) marker->Next() )
|
||||||
{
|
{
|
||||||
if( Marker->Type() != TYPEMARQUEUR )
|
if( marker->Type() != TYPEMARQUEUR )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
StartCount++;
|
StartCount++;
|
||||||
if( StartCount > s_MarkerCount )
|
if( StartCount > s_MarkerCount )
|
||||||
{
|
{
|
||||||
succes = TRUE;
|
foundItem = marker;
|
||||||
locate_pos = Marker->m_Pos;
|
locate_pos = marker->m_Pos;
|
||||||
s_MarkerCount++;
|
s_MarkerCount++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -90,27 +91,27 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( Module = m_Parent->m_Pcb->m_Modules; Module != NULL; Module = (MODULE*) Module->Pnext )
|
for( MODULE* module = m_Parent->m_Pcb->m_Modules; module; module = (MODULE*) module->Next() )
|
||||||
{
|
{
|
||||||
if( WildCompareString( s_OldStringFound, Module->m_Reference->m_Text.GetData(),
|
if( WildCompareString( s_OldStringFound, module->GetReference().GetData(),
|
||||||
FALSE ) )
|
FALSE ) )
|
||||||
{
|
{
|
||||||
StartCount++;
|
StartCount++;
|
||||||
if( StartCount > s_ItemCount )
|
if( StartCount > s_ItemCount )
|
||||||
{
|
{
|
||||||
succes = TRUE;
|
foundItem = module;
|
||||||
locate_pos = Module->m_Pos;
|
locate_pos = module->m_Pos;
|
||||||
s_ItemCount++;
|
s_ItemCount++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( WildCompareString( s_OldStringFound, Module->m_Value->m_Text.GetData(), FALSE ) )
|
if( WildCompareString( s_OldStringFound, module->m_Value->m_Text.GetData(), FALSE ) )
|
||||||
{
|
{
|
||||||
StartCount++;
|
StartCount++;
|
||||||
if( StartCount > s_ItemCount )
|
if( StartCount > s_ItemCount )
|
||||||
{
|
{
|
||||||
succes = TRUE;
|
foundItem = module;
|
||||||
locate_pos = Module->m_Pos;
|
locate_pos = module->m_Pos;
|
||||||
s_ItemCount++;
|
s_ItemCount++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -118,8 +119,17 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( succes )
|
if( foundItem )
|
||||||
{
|
{
|
||||||
|
m_Parent->SetCurItem( foundItem );
|
||||||
|
|
||||||
|
if( FindMarker )
|
||||||
|
msg = _( "Marker found" );
|
||||||
|
else
|
||||||
|
msg.Printf( _( "<%s> Found" ), s_OldStringFound.GetData() );
|
||||||
|
|
||||||
|
m_Parent->Affiche_Message( msg );
|
||||||
|
|
||||||
/* Il y a peut-etre necessite de recadrer le dessin: */
|
/* Il y a peut-etre necessite de recadrer le dessin: */
|
||||||
if( !m_Parent->DrawPanel->IsPointOnDisplay( locate_pos ) )
|
if( !m_Parent->DrawPanel->IsPointOnDisplay( locate_pos ) )
|
||||||
{
|
{
|
||||||
|
@ -135,21 +145,18 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
|
||||||
m_Parent->DrawPanel->MouseToCursorSchema();
|
m_Parent->DrawPanel->MouseToCursorSchema();
|
||||||
m_Parent->DrawPanel->CursorOn( m_DC );
|
m_Parent->DrawPanel->CursorOn( m_DC );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FindMarker )
|
|
||||||
msg = _( "Marker found" );
|
|
||||||
else
|
|
||||||
msg.Printf( _( "<%s> Found" ), s_OldStringFound.GetData() );
|
|
||||||
m_Parent->Affiche_Message( msg );
|
|
||||||
EndModal( 1 );
|
EndModal( 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Parent->Affiche_Message( wxEmptyString );
|
m_Parent->Affiche_Message( wxEmptyString );
|
||||||
|
|
||||||
if( FindMarker )
|
if( FindMarker )
|
||||||
msg = _( "Marker not found" );
|
msg = _( "Marker not found" );
|
||||||
else
|
else
|
||||||
msg.Printf( _( "<%s> Not Found" ), s_OldStringFound.GetData() );
|
msg.Printf( _( "<%s> Not Found" ), s_OldStringFound.GetData() );
|
||||||
|
|
||||||
DisplayError( this, msg, 10 );
|
DisplayError( this, msg, 10 );
|
||||||
EndModal( 0 );
|
EndModal( 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -565,6 +565,7 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
|
||||||
case ID_POPUP_ZOOM_PLUS:
|
case ID_POPUP_ZOOM_PLUS:
|
||||||
case ID_ZOOM_PLUS_KEY:
|
case ID_ZOOM_PLUS_KEY:
|
||||||
move_mouse_cursor = TRUE;
|
move_mouse_cursor = TRUE;
|
||||||
|
// fall thru
|
||||||
|
|
||||||
case ID_ZOOM_PLUS_BUTT:
|
case ID_ZOOM_PLUS_BUTT:
|
||||||
if( zoom_type == ID_ZOOM_PLUS_BUTT )
|
if( zoom_type == ID_ZOOM_PLUS_BUTT )
|
||||||
|
@ -576,6 +577,7 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
|
||||||
case ID_POPUP_ZOOM_MOINS:
|
case ID_POPUP_ZOOM_MOINS:
|
||||||
case ID_ZOOM_MOINS_KEY:
|
case ID_ZOOM_MOINS_KEY:
|
||||||
move_mouse_cursor = TRUE;
|
move_mouse_cursor = TRUE;
|
||||||
|
// fall thru
|
||||||
|
|
||||||
case ID_ZOOM_MOINS_BUTT:
|
case ID_ZOOM_MOINS_BUTT:
|
||||||
if( zoom_type == ID_ZOOM_MOINS_BUTT )
|
if( zoom_type == ID_ZOOM_MOINS_BUTT )
|
||||||
|
|
5
todo.txt
5
todo.txt
|
@ -51,3 +51,8 @@ understanding by new developers.
|
||||||
*** Implement the graying in/out of "Edit/Undo", "Edit/Redo" menu items,
|
*** Implement the graying in/out of "Edit/Undo", "Edit/Redo" menu items,
|
||||||
when Undo/Redo stack is empty/filled.
|
when Undo/Redo stack is empty/filled.
|
||||||
|
|
||||||
|
|
||||||
|
*** Implement action for ID_POPUP_PCB_DELETE_MARKER, since onrightclick.cpp
|
||||||
|
can now identify a marker. To see where the user gets a menu to delete a marker:
|
||||||
|
void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue