Commit 5e448ec4 authored by CHARRAS's avatar CHARRAS

pcbnew: locate zones added (forgotten in new PcbGeneralLocateAndDisplay() );...

pcbnew: locate zones added (forgotten in new PcbGeneralLocateAndDisplay() ); Add class_board_item.cpp
parent ef498f88
/* XPM */
static char * general_ratsnet_xpm[] = {
#ifndef XPMMAIN
extern char *general_ratsnet_xpm[];
#else
char * general_ratsnet_xpm[] = {
"16 16 41 1",
" c None",
". c #FFFFFF",
......@@ -58,3 +62,5 @@ static char * general_ratsnet_xpm[] = {
"...'123 4-;5 ",
"...6-78 90a ",
" b( .. "};
#endif
......@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-sept-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ pcbnew:
* add class_board_item.cpp file and move BOARD_ITEM::MenuText() and BOARD_ITEM::MenuIcon() in it
* Add zone detection, forgotten in PcbGeneralLocateAndDisplay()
+ class_collector.h:
add void COLLECTOR::Remove( unsigned int item_position ), needed by zone detection, see PcbGeneralLocateAndDisplay
2007-Sep-25 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
......
......@@ -181,6 +181,7 @@
#include "../bitmaps/library_update.xpm"
#include "../bitmaps/transistor.xpm"
#include "../bitmaps/kicad_icon_small.xpm"
#include "../bitmaps/general_ratsnet.xpm"
// Largeur du toolbar vertical
#define VTOOLBAR_WIDTH 26
......
......@@ -109,6 +109,15 @@ public:
m_List.push_back( item );
}
/**
* Function Remove
* removes the item at item_position (first position is 0);
* @param item_position index.
*/
void Remove( unsigned int item_position )
{
m_List.erase( m_List.begin() + item_position );
}
/**
* Function operator[int]
......@@ -220,32 +229,6 @@ public:
}
*/
/**
* Function Collect
* scans an EDA_BaseStruct using this class's Inspector method, which does
* the collection.
* @param container An EDA_BaseStruct to scan, including those items it contains.
* @param aRefBox An EDA_Rect to use in bounds-testing.
*
* example implementation, in derived class:
*
virtual void Collect( EDA_BaseStruct* container, const EDA_Rect& aRefBox )
{
example implementation:
SetBoundingBox( aRefBox ); // pass box to Inspect()
Empty(); // empty the collection
// visit the board with the INSPECTOR (me).
container->Visit( this, // INSPECTOR* inspector
NULL, // const void* testData,
m_ScanTypes);
SetTimeNow(); // when it was taken
}
*/
};
#endif // COLLECTOR_H
......
/*****************************************/
/* class BOARD_ITEM: som basic functions */
/*****************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
#include "id.h"
#include "collectors.h"
#include "bitmaps.h"
#include "add_cotation.xpm"
#include "Add_Mires.xpm"
#include "Add_Zone.xpm"
/********************************************************/
wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
/********************************************************/
/** return a specific comment for "this". Used in pop up menus
* @param aPcb = the parent board
*/
{
wxString text;
const BOARD_ITEM* item = this;
EQUIPOT* net;
switch( item->Type() )
{
case PCB_EQUIPOT_STRUCT_TYPE:
text << _( "Net" ) << ( (EQUIPOT*) item )->m_Netname << wxT( " " ) <<
( (EQUIPOT*) item )->m_NetCode;
break;
case TYPEMODULE:
text << _( "Footprint" ) << wxT( " " ) << ( (MODULE*) item )->GetReference();
text << wxT( " (" ) << ReturnPcbLayerName( item->m_Layer ) << wxT( ")" );
break;
case TYPEPAD:
text << _( "Pad" ) << wxT( " " ) << ( (D_PAD*) item )->ReturnStringPadName() << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
break;
case TYPEDRAWSEGMENT:
text << _( "Pcb Graphic" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ); // @todo: extend text
break;
case TYPETEXTE:
text << _( "Pcb Text" ) << wxT( " " );;
if( ( (TEXTE_PCB*) item )->m_Text.Len() < 12 )
text << ( (TEXTE_PCB*) item )->m_Text;
else
text += ( (TEXTE_PCB*) item )->m_Text.Left( 10 ) + wxT( ".." );
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() );
break;
case TYPETEXTEMODULE:
switch( ( (TEXTE_MODULE*) item )->m_Type )
{
case TEXT_is_REFERENCE:
text << _( "Reference" ) << wxT( " " ) << ( (TEXTE_MODULE*) item )->m_Text;
break;
case TEXT_is_VALUE:
text << _( "Value" ) << wxT( " " ) << ( (TEXTE_MODULE*) item )->m_Text << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
break;
default: // wrap this one in quotes:
text << _( "Text" ) << wxT( " \"" ) << ( (TEXTE_MODULE*) item )->m_Text <<
wxT( "\"" ) << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
break;
}
break;
case TYPEEDGEMODULE:
text << _( "Graphic" ) << wxT( " " );
const wxChar* cp;
switch( ( (EDGE_MODULE*) item )->m_Shape )
{
case S_SEGMENT:
cp = _( "Line" ); break;
case S_RECT:
cp = _( "Rect" ); break;
case S_ARC:
cp = _( "Arc" ); break;
case S_CIRCLE:
cp = _( "Circle" ); break;
/* used in Gerbview: */
case S_ARC_RECT:
cp = wxT( "arc_rect" ); break;
case S_SPOT_OVALE:
cp = wxT( "spot_oval" ); break;
case S_SPOT_CIRCLE:
cp = wxT( "spot_circle" ); break;
case S_SPOT_RECT:
cp = wxT( "spot_rect" ); break;
case S_POLYGON:
cp = wxT( "polygon" ); break;
default:
cp = wxT( "??EDGE??" ); break;
}
text << *cp << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
break;
case TYPETRACK:
text << _( "Track" ) << wxT( " " ) << ( (TRACK*) item )->m_NetCode;
net = aPcb->FindNet( ( (TRACK*) item )->m_NetCode );
if( net )
{
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
}
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() );
break;
case TYPEZONE:
text << _( "Zone" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() );
break;
case TYPEVIA:
text << _( "Via" ) << wxT( " " ) << ( (SEGVIA*) item )->m_NetCode;
net = aPcb->FindNet( ( (TRACK*) item )->m_NetCode );
if( net )
{
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
}
break;
case TYPEMARQUEUR:
text << _( "Marker" );
break;
case TYPECOTATION:
text << _( "Dimension" ) << wxT(" \"") << ((COTATION*) item)->GetText() << wxT("\"");
break;
case TYPEMIRE:
text << _( "Mire" ); // @todo: extend text, Mire is not an english word!
break;
case TYPEEDGEZONE:
text << _( "Edge Zone" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ); // @todo: extend text
break;
default:
text << item->GetClass() << wxT( " Unexpected item type: BUG!!" );
break;
}
return text;
}
/*****************************************/
const char** BOARD_ITEM::MenuIcon() const
/*****************************************/
/** return a specific icon pointer (an xpm icon) for "this". Used in pop up menus
* @return an icon pointer (can be NULL)
*/
{
char** xpm;
const BOARD_ITEM* item = this;
switch( item->Type() )
{
case PCB_EQUIPOT_STRUCT_TYPE:
xpm = general_ratsnet_xpm;
break;
case TYPEMODULE:
xpm = module_xpm;
break;
case TYPEPAD:
xpm = pad_xpm;
break;
case TYPEDRAWSEGMENT:
xpm = add_dashed_line_xpm;
break;
case TYPETEXTE:
xpm = add_text_xpm;
break;
case TYPETEXTEMODULE:
xpm = footprint_text_xpm;
break;
case TYPEEDGEMODULE:
xpm = show_mod_edge_xpm;
break;
case TYPETRACK:
xpm = showtrack_xpm;
break;
case TYPEZONE:
xpm = add_zone_xpm;
break;
case TYPEVIA:
xpm = pad_sketch_xpm;
break;
case TYPEMARQUEUR:
xpm = pad_xpm; // @todo: create and use marker xpm
break;
case TYPECOTATION:
xpm = add_cotation_xpm;
break;
case TYPEMIRE:
xpm = add_mires_xpm;
break;
case TYPEEDGEZONE:
xpm = show_mod_edge_xpm; // @todo: pcb edge xpm
break;
default:
xpm = 0;
break;
}
return (const char**) xpm;
}
......@@ -56,13 +56,23 @@ void COTATION::UnLink()
}
/* Changement du texte de la cotation */
/* Setup the dimension text */
void COTATION:: SetText( const wxString& NewText )
{
m_Text->m_Text = NewText;
}
/**********************************/
wxString COTATION:: GetText( void )
/**********************************/
/* Reutun the dimension text
*/
{
return m_Text->m_Text;
}
/*************************************/
void COTATION::Copy( COTATION* source )
/*************************************/
......
......@@ -36,6 +36,7 @@ public:
/* Modification du texte de la cotation */
void SetText( const wxString& NewText );
wxString GetText( void );
void Copy( COTATION* source );
......
......@@ -38,6 +38,7 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
TYPECOTATION,
TYPEVIA,
TYPETRACK,
TYPEZONE,
TYPEPAD,
TYPETEXTEMODULE,
TYPEMODULE,
......@@ -94,6 +95,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
{
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
MODULE* module = NULL;
bool skip_item = false;
#if 0 // debugging
static int breakhere = 0;
......@@ -114,6 +116,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
case TYPETRACK:
breakhere++;
break;
case TYPEZONE:
breakhere++;
break;
case TYPETEXTE:
breakhere++;
break;
......@@ -167,6 +172,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
break;
case TYPETRACK:
break;
case TYPEZONE:
if( ! DisplayOpt.DisplayZones ) skip_item = true;
break;
case TYPETEXTE:
break;
case TYPEDRAWSEGMENT:
......@@ -226,7 +234,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
{
if( item->HitTest( m_RefPos ) )
{
Append( item );
if ( ! skip_item ) Append( item );
goto exit;
}
}
......@@ -253,7 +261,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
{
if( item->HitTest( m_RefPos ) )
{
Append2nd( item );
if ( ! skip_item ) Append2nd( item );
goto exit;
}
}
......
This diff is collapsed.
......@@ -31,6 +31,7 @@ OBJECTS= $(TARGET).o classpcb.o\
class_edge_mod.o \
class_text_mod.o\
class_pcb_text.o\
class_board_item.o\
class_board.o\
drawframe.o\
drawpanel.o\
......
......@@ -45,7 +45,6 @@
#include "Mode_Track.xpm"
#include "tool_ratsnet.xpm"
#include "local_ratsnet.xpm"
#include "general_ratsnet.xpm"
#include "add_cotation.xpm"
#define SEL_LAYER_HELP _( \
......
......@@ -20,18 +20,16 @@ void Trace_Pistes( WinEDA_DrawPanel* panel, BOARD* Pcb, wxDC* DC, int drawmode )
/* Draw all tracks and zones.
*/
{
TRACK* track;
track = Pcb->m_Track;
TRACK * track = Pcb->m_Track;
for( ; track != NULL; track = track->Next() )
{
track->Draw( panel, DC, drawmode );
}
track = Pcb->m_Zone;
for( ; track != NULL; track = track->Next() )
SEGZONE * zone = Pcb->m_Zone;
for( ; zone != NULL; zone = zone->Next() )
{
track->Draw( panel, DC, drawmode );
zone->Draw( panel, DC, drawmode );
}
}
......
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