pcbnew: locate zones added (forgotten in new PcbGeneralLocateAndDisplay() ); Add class_board_item.cpp
This commit is contained in:
parent
ef498f88fd
commit
5e448ec475
|
@ -1,60 +1,66 @@
|
||||||
/* XPM */
|
/* XPM */
|
||||||
static char * general_ratsnet_xpm[] = {
|
#ifndef XPMMAIN
|
||||||
"16 16 41 1",
|
extern char *general_ratsnet_xpm[];
|
||||||
" c None",
|
|
||||||
". c #FFFFFF",
|
#else
|
||||||
"+ c #2F2F2F",
|
char * general_ratsnet_xpm[] = {
|
||||||
"@ c #444342",
|
"16 16 41 1",
|
||||||
"# c #AEAEAE",
|
" c None",
|
||||||
"$ c #1D1D1D",
|
". c #FFFFFF",
|
||||||
"% c #F2D7C1",
|
"+ c #2F2F2F",
|
||||||
"& c #F2BD8E",
|
"@ c #444342",
|
||||||
"* c #3C3631",
|
"# c #AEAEAE",
|
||||||
"= c #403D3B",
|
"$ c #1D1D1D",
|
||||||
"- c #F2B279",
|
"% c #F2D7C1",
|
||||||
"; c #F29747",
|
"& c #F2BD8E",
|
||||||
"> c #443B33",
|
"* c #3C3631",
|
||||||
", c #B1B1B1",
|
"= c #403D3B",
|
||||||
"' c #444444",
|
"- c #F2B279",
|
||||||
") c #333231",
|
"; c #F29747",
|
||||||
"! c #C3C3C3",
|
"> c #443B33",
|
||||||
"~ c #372E28",
|
", c #B1B1B1",
|
||||||
"{ c #3C3129",
|
"' c #444444",
|
||||||
"] c #413B36",
|
") c #333231",
|
||||||
"^ c #423F3D",
|
"! c #C3C3C3",
|
||||||
"/ c #382F29",
|
"~ c #372E28",
|
||||||
"( c #1C1006",
|
"{ c #3C3129",
|
||||||
"_ c #323232",
|
"] c #413B36",
|
||||||
": c #161514",
|
"^ c #423F3D",
|
||||||
"< c #181818",
|
"/ c #382F29",
|
||||||
"[ c #3B3A39",
|
"( c #1C1006",
|
||||||
"} c #3F3F3F",
|
"_ c #323232",
|
||||||
"| c #171009",
|
": c #161514",
|
||||||
"1 c #F2D7C0",
|
"< c #181818",
|
||||||
"2 c #F2BC8E",
|
"[ c #3B3A39",
|
||||||
"3 c #3D3731",
|
"} c #3F3F3F",
|
||||||
"4 c #1D1917",
|
"| c #171009",
|
||||||
"5 c #2A1F16",
|
"1 c #F2D7C0",
|
||||||
"6 c #413E3C",
|
"2 c #F2BC8E",
|
||||||
"7 c #F29647",
|
"3 c #3D3731",
|
||||||
"8 c #1B1007",
|
"4 c #1D1917",
|
||||||
"9 c #261D16",
|
"5 c #2A1F16",
|
||||||
"0 c #443A32",
|
"6 c #413E3C",
|
||||||
"a c #BBBBBB",
|
"7 c #F29647",
|
||||||
"b c #1A1109",
|
"8 c #1B1007",
|
||||||
" ... ... ",
|
"9 c #261D16",
|
||||||
" .. .. ",
|
"0 c #443A32",
|
||||||
" +@# ... ",
|
"a c #BBBBBB",
|
||||||
" $%&* .. ",
|
"b c #1A1109",
|
||||||
" =-;>.....,') ",
|
" ... ... ",
|
||||||
"..!~{!.....'%&].",
|
" .. .. ",
|
||||||
".. ... ^-;>.",
|
" +@# ... ",
|
||||||
". ... .!/( ",
|
" $%&* .. ",
|
||||||
" ..... ",
|
" =-;>.....,') ",
|
||||||
" ... ",
|
"..!~{!.....'%&].",
|
||||||
" ..... ",
|
".. ... ^-;>.",
|
||||||
" ... .!_: ",
|
". ... .!/( ",
|
||||||
" <[!. }%&| ",
|
" ..... ",
|
||||||
"...'123 4-;5 ",
|
" ... ",
|
||||||
"...6-78 90a ",
|
" ..... ",
|
||||||
" b( .. "};
|
" ... .!_: ",
|
||||||
|
" <[!. }%&| ",
|
||||||
|
"...'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
|
Please add newer entries at the top, list the date and your name with
|
||||||
email address.
|
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>
|
2007-Sep-25 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
|
@ -181,6 +181,7 @@
|
||||||
#include "../bitmaps/library_update.xpm"
|
#include "../bitmaps/library_update.xpm"
|
||||||
#include "../bitmaps/transistor.xpm"
|
#include "../bitmaps/transistor.xpm"
|
||||||
#include "../bitmaps/kicad_icon_small.xpm"
|
#include "../bitmaps/kicad_icon_small.xpm"
|
||||||
|
#include "../bitmaps/general_ratsnet.xpm"
|
||||||
|
|
||||||
// Largeur du toolbar vertical
|
// Largeur du toolbar vertical
|
||||||
#define VTOOLBAR_WIDTH 26
|
#define VTOOLBAR_WIDTH 26
|
||||||
|
|
|
@ -109,6 +109,15 @@ public:
|
||||||
m_List.push_back( item );
|
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]
|
* Function operator[int]
|
||||||
|
@ -219,33 +228,7 @@ public:
|
||||||
SetTimeNow(); // when it was taken
|
SetTimeNow(); // when it was taken
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
#endif // COLLECTOR_H
|
||||||
|
|
|
@ -0,0 +1,249 @@
|
||||||
|
/*****************************************/
|
||||||
|
/* 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 )
|
void COTATION:: SetText( const wxString& NewText )
|
||||||
{
|
{
|
||||||
m_Text->m_Text = NewText;
|
m_Text->m_Text = NewText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************/
|
||||||
|
wxString COTATION:: GetText( void )
|
||||||
|
/**********************************/
|
||||||
|
/* Reutun the dimension text
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
return m_Text->m_Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************/
|
/*************************************/
|
||||||
void COTATION::Copy( COTATION* source )
|
void COTATION::Copy( COTATION* source )
|
||||||
/*************************************/
|
/*************************************/
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
|
|
||||||
/* Modification du texte de la cotation */
|
/* Modification du texte de la cotation */
|
||||||
void SetText( const wxString& NewText );
|
void SetText( const wxString& NewText );
|
||||||
|
wxString GetText( void );
|
||||||
|
|
||||||
void Copy( COTATION* source );
|
void Copy( COTATION* source );
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
|
||||||
TYPECOTATION,
|
TYPECOTATION,
|
||||||
TYPEVIA,
|
TYPEVIA,
|
||||||
TYPETRACK,
|
TYPETRACK,
|
||||||
|
TYPEZONE,
|
||||||
TYPEPAD,
|
TYPEPAD,
|
||||||
TYPETEXTEMODULE,
|
TYPETEXTEMODULE,
|
||||||
TYPEMODULE,
|
TYPEMODULE,
|
||||||
|
@ -94,6 +95,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
|
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
|
||||||
MODULE* module = NULL;
|
MODULE* module = NULL;
|
||||||
|
bool skip_item = false;
|
||||||
|
|
||||||
#if 0 // debugging
|
#if 0 // debugging
|
||||||
static int breakhere = 0;
|
static int breakhere = 0;
|
||||||
|
@ -114,6 +116,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
|
||||||
case TYPETRACK:
|
case TYPETRACK:
|
||||||
breakhere++;
|
breakhere++;
|
||||||
break;
|
break;
|
||||||
|
case TYPEZONE:
|
||||||
|
breakhere++;
|
||||||
|
break;
|
||||||
case TYPETEXTE:
|
case TYPETEXTE:
|
||||||
breakhere++;
|
breakhere++;
|
||||||
break;
|
break;
|
||||||
|
@ -167,6 +172,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
|
||||||
break;
|
break;
|
||||||
case TYPETRACK:
|
case TYPETRACK:
|
||||||
break;
|
break;
|
||||||
|
case TYPEZONE:
|
||||||
|
if( ! DisplayOpt.DisplayZones ) skip_item = true;
|
||||||
|
break;
|
||||||
case TYPETEXTE:
|
case TYPETEXTE:
|
||||||
break;
|
break;
|
||||||
case TYPEDRAWSEGMENT:
|
case TYPEDRAWSEGMENT:
|
||||||
|
@ -226,7 +234,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
|
||||||
{
|
{
|
||||||
if( item->HitTest( m_RefPos ) )
|
if( item->HitTest( m_RefPos ) )
|
||||||
{
|
{
|
||||||
Append( item );
|
if ( ! skip_item ) Append( item );
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,7 +261,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
|
||||||
{
|
{
|
||||||
if( item->HitTest( m_RefPos ) )
|
if( item->HitTest( m_RefPos ) )
|
||||||
{
|
{
|
||||||
Append2nd( item );
|
if ( ! skip_item ) Append2nd( item );
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,21 +9,14 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "pcbnew.h"
|
#include "pcbnew.h"
|
||||||
|
#include "protos.h"
|
||||||
|
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
#include "protos.h"
|
|
||||||
#include "collectors.h"
|
#include "collectors.h"
|
||||||
|
|
||||||
#include "bitmaps.h"
|
#include "bitmaps.h"
|
||||||
#include "add_cotation.xpm"
|
|
||||||
#include "Add_Mires.xpm"
|
|
||||||
#include "Add_Zone.xpm"
|
|
||||||
|
|
||||||
|
|
||||||
/* Routines Locales : */
|
|
||||||
|
|
||||||
/* Variables Locales */
|
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
void RemoteCommand( const char* cmdline )
|
void RemoteCommand( const char* cmdline )
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
@ -36,7 +29,7 @@ void RemoteCommand( const char* cmdline )
|
||||||
wxString msg;
|
wxString msg;
|
||||||
char* idcmd;
|
char* idcmd;
|
||||||
char* text;
|
char* text;
|
||||||
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
|
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
|
||||||
MODULE* module = 0;
|
MODULE* module = 0;
|
||||||
|
|
||||||
strncpy( line, cmdline, sizeof(line) - 1 );
|
strncpy( line, cmdline, sizeof(line) - 1 );
|
||||||
|
@ -49,13 +42,13 @@ void RemoteCommand( const char* cmdline )
|
||||||
|
|
||||||
if( strcmp( idcmd, "$PART:" ) == 0 )
|
if( strcmp( idcmd, "$PART:" ) == 0 )
|
||||||
{
|
{
|
||||||
msg = CONV_FROM_UTF8( text );
|
msg = CONV_FROM_UTF8( text );
|
||||||
|
|
||||||
module = ReturnModule( frame->m_Pcb, msg );
|
module = ReturnModule( frame->m_Pcb, msg );
|
||||||
|
|
||||||
msg.Printf( _( "Locate module %s %s" ), msg.GetData(),
|
msg.Printf( _( "Locate module %s %s" ), msg.GetData(),
|
||||||
module ? wxT( "Ok" ) : wxT( "not found" ) );
|
module ? wxT( "Ok" ) : wxT( "not found" ) );
|
||||||
|
|
||||||
frame->Affiche_Message( msg );
|
frame->Affiche_Message( msg );
|
||||||
if( module )
|
if( module )
|
||||||
{
|
{
|
||||||
|
@ -71,11 +64,11 @@ void RemoteCommand( const char* cmdline )
|
||||||
if( idcmd && strcmp( idcmd, "$PIN:" ) == 0 )
|
if( idcmd && strcmp( idcmd, "$PIN:" ) == 0 )
|
||||||
{
|
{
|
||||||
wxString pinName, modName;
|
wxString pinName, modName;
|
||||||
D_PAD* pad = NULL;
|
D_PAD* pad = NULL;
|
||||||
int netcode = -1;
|
int netcode = -1;
|
||||||
|
|
||||||
pinName = CONV_FROM_UTF8( text );
|
pinName = CONV_FROM_UTF8( text );
|
||||||
|
|
||||||
text = strtok( NULL, " \n\r" );
|
text = strtok( NULL, " \n\r" );
|
||||||
if( text && strcmp( text, "$PART:" ) == 0 )
|
if( text && strcmp( text, "$PART:" ) == 0 )
|
||||||
text = strtok( NULL, "\n\r" );
|
text = strtok( NULL, "\n\r" );
|
||||||
|
@ -88,18 +81,18 @@ void RemoteCommand( const char* cmdline )
|
||||||
module = ReturnModule( frame->m_Pcb, modName );
|
module = ReturnModule( frame->m_Pcb, modName );
|
||||||
if( module )
|
if( module )
|
||||||
pad = ReturnPad( module, pinName );
|
pad = ReturnPad( module, pinName );
|
||||||
|
|
||||||
if( pad )
|
if( pad )
|
||||||
netcode = pad->m_NetCode;
|
netcode = pad->m_NetCode;
|
||||||
|
|
||||||
if( netcode > 0 ) /* hightlighted the net selected net*/
|
if( netcode > 0 ) /* hightlighted the net selected net*/
|
||||||
{
|
{
|
||||||
if( g_HightLigt_Status ) /* erase the old hightlighted net */
|
if( g_HightLigt_Status ) /* erase the old hightlighted net */
|
||||||
frame->Hight_Light( &dc );
|
frame->Hight_Light( &dc );
|
||||||
|
|
||||||
g_HightLigth_NetCode = netcode;
|
g_HightLigth_NetCode = netcode;
|
||||||
frame->Hight_Light( &dc ); /* hightlighted the new one */
|
frame->Hight_Light( &dc ); /* hightlighted the new one */
|
||||||
|
|
||||||
frame->DrawPanel->CursorOff( &dc );
|
frame->DrawPanel->CursorOff( &dc );
|
||||||
frame->GetScreen()->m_Curseur = pad->m_Pos;
|
frame->GetScreen()->m_Curseur = pad->m_Pos;
|
||||||
frame->DrawPanel->CursorOn( &dc );
|
frame->DrawPanel->CursorOn( &dc );
|
||||||
|
@ -113,268 +106,66 @@ void RemoteCommand( const char* cmdline )
|
||||||
msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() );
|
msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() );
|
||||||
frame->Affiche_Message( msg );
|
frame->Affiche_Message( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( module ) // if found, center the module on screen.
|
if( module ) // if found, center the module on screen.
|
||||||
frame->Recadre_Trace( false );
|
frame->Recadre_Trace( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @todo: move this to proper source file.
|
|
||||||
wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
|
|
||||||
{
|
|
||||||
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 ")
|
|
||||||
// << GetParent()->MenuText( aPcb );
|
|
||||||
<< ((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( ".." );
|
|
||||||
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 ")
|
|
||||||
// << GetParent()->MenuText( aPcb );
|
|
||||||
<< ((MODULE*)GetParent())->GetReference();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: // wrap this one in quotes:
|
|
||||||
text << _( "Text" ) << wxT( " \"" ) << ((TEXTE_MODULE*)item)->m_Text << wxT("\"") << _(" of ")
|
|
||||||
// << GetParent()->MenuText( aPcb );
|
|
||||||
<< ((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 ")
|
|
||||||
// << GetParent()->MenuText( aPcb );
|
|
||||||
<< ((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"); // @todo: extend text
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @todo: move this to proper source file.
|
|
||||||
const char** BOARD_ITEM::MenuIcon() const
|
|
||||||
{
|
|
||||||
char** xpm;
|
|
||||||
const BOARD_ITEM* item = this;
|
|
||||||
|
|
||||||
switch( item->Type() )
|
|
||||||
{
|
|
||||||
case PCB_EQUIPOT_STRUCT_TYPE:
|
|
||||||
xpm = module_xpm; // @todo: use net icon
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEMODULE:
|
|
||||||
xpm = module_xpm;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEPAD:
|
|
||||||
xpm = pad_xpm;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TYPEDRAWSEGMENT:
|
|
||||||
xpm = module_xpm; // @todo: use draw segment icon & expand on text
|
|
||||||
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 = showtrack_xpm; // @todo: use via specific 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function AllAreModulesAndReturnSmallestIfSo
|
* Function AllAreModulesAndReturnSmallestIfSo
|
||||||
* tests that all items in the collection are MODULEs and if so, returns the
|
* tests that all items in the collection are MODULEs and if so, returns the
|
||||||
* smallest MODULE.
|
* smallest MODULE.
|
||||||
* @return BOARD_ITEM* - The smallest or NULL.
|
* @return BOARD_ITEM* - The smallest or NULL.
|
||||||
*/
|
*/
|
||||||
static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aCollector )
|
static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aCollector )
|
||||||
{
|
{
|
||||||
int count = aCollector->GetCount();
|
int count = aCollector->GetCount();
|
||||||
|
|
||||||
for( int i=0; i<count; ++i )
|
for( int i = 0; i<count; ++i )
|
||||||
{
|
{
|
||||||
if( (*aCollector)[i]->Type() != TYPEMODULE )
|
if( (*aCollector)[i]->Type() != TYPEMODULE )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// all are modules, now find smallest MODULE
|
// all are modules, now find smallest MODULE
|
||||||
|
|
||||||
int minDim = 0x7FFFFFFF;
|
int minDim = 0x7FFFFFFF;
|
||||||
int minNdx = 0;
|
int minNdx = 0;
|
||||||
|
|
||||||
for( int i=0; i<count; ++i )
|
for( int i = 0; i<count; ++i )
|
||||||
{
|
{
|
||||||
MODULE* module = (MODULE*) (*aCollector)[i];
|
MODULE* module = (MODULE*) (*aCollector)[i];
|
||||||
|
|
||||||
int lx = module->m_BoundaryBox.GetWidth();
|
int lx = module->m_BoundaryBox.GetWidth();
|
||||||
int ly = module->m_BoundaryBox.GetHeight();
|
int ly = module->m_BoundaryBox.GetHeight();
|
||||||
|
|
||||||
int lmin = MIN( lx, ly );
|
int lmin = MIN( lx, ly );
|
||||||
|
|
||||||
if( lmin <= minDim )
|
if( lmin <= minDim )
|
||||||
{
|
{
|
||||||
minDim = lmin;
|
minDim = lmin;
|
||||||
minNdx = i;
|
minNdx = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*aCollector)[minNdx];
|
return (*aCollector)[minNdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************/
|
||||||
/***********************************************************************/
|
|
||||||
BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
|
BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
|
||||||
/***********************************************************************/
|
/*************************************************************/
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item;
|
BOARD_ITEM* item;
|
||||||
|
|
||||||
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
|
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
|
||||||
|
|
||||||
// Assign to scanList the proper item types desired based on tool type.
|
// Assign to scanList the proper item types desired based on tool type.
|
||||||
// May need to pass a hot key code to this function to support hot keys too.
|
// May need to pass a hot key code to this function to support hot keys too.
|
||||||
|
|
||||||
const KICAD_T* scanList;
|
const KICAD_T* scanList;
|
||||||
|
|
||||||
if( m_ID_current_state == 0 )
|
if( m_ID_current_state == 0 )
|
||||||
{
|
{
|
||||||
switch( m_HTOOL_current_state )
|
switch( m_HTOOL_current_state )
|
||||||
|
@ -382,7 +173,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
|
||||||
case ID_TOOLBARH_PCB_AUTOPLACE:
|
case ID_TOOLBARH_PCB_AUTOPLACE:
|
||||||
scanList = GENERAL_COLLECTOR::ModuleItems;
|
scanList = GENERAL_COLLECTOR::ModuleItems;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
scanList = GENERAL_COLLECTOR::AllBoardItems;
|
scanList = GENERAL_COLLECTOR::AllBoardItems;
|
||||||
break;
|
break;
|
||||||
|
@ -394,93 +185,111 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
|
||||||
{
|
{
|
||||||
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
||||||
scanList = GENERAL_COLLECTOR::PadsOrModules;
|
scanList = GENERAL_COLLECTOR::PadsOrModules;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TRACK_BUTT:
|
case ID_TRACK_BUTT:
|
||||||
scanList = GENERAL_COLLECTOR::Tracks;
|
scanList = GENERAL_COLLECTOR::Tracks;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_COMPONENT_BUTT:
|
case ID_COMPONENT_BUTT:
|
||||||
scanList = GENERAL_COLLECTOR::ModuleItems;
|
scanList = GENERAL_COLLECTOR::ModuleItems;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
scanList = GENERAL_COLLECTOR::AllBoardItems;
|
scanList = GENERAL_COLLECTOR::AllBoardItems;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Collector->Collect( m_Pcb, scanList, GetScreen()->RefPos(true), guide );
|
m_Collector->Collect( m_Pcb, scanList, GetScreen()->RefPos( true ), guide );
|
||||||
|
|
||||||
/* debugging: print out the collected items, showing their priority order too.
|
/* debugging: print out the collected items, showing their priority order too.
|
||||||
for( unsigned i=0; i<m_Collector->GetCount(); ++i )
|
* for( unsigned i=0; i<m_Collector->GetCount(); ++i )
|
||||||
(*m_Collector)[i]->Show( 0, std::cout );
|
* (*m_Collector)[i]->Show( 0, std::cout );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( m_Collector->GetCount() <= 1 )
|
/* Remove redundancies: most of time, zones are found twice,
|
||||||
|
* because zones are filled twice ( once by by horizontal and once by vertical segments )
|
||||||
|
*/
|
||||||
|
unsigned long timestampzone = 0;
|
||||||
|
for( unsigned int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
||||||
|
{
|
||||||
|
item = (*m_Collector)[ii];
|
||||||
|
if( item->Type() != TYPEZONE )
|
||||||
|
continue;
|
||||||
|
/* Found a TYPE ZONE */
|
||||||
|
if( item->m_TimeStamp == timestampzone ) // Remove it, redundant, zone already found
|
||||||
|
{
|
||||||
|
m_Collector->Remove( ii );
|
||||||
|
ii--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
timestampzone = item->m_TimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_Collector->GetCount() <= 1 )
|
||||||
{
|
{
|
||||||
item = (*m_Collector)[0];
|
item = (*m_Collector)[0];
|
||||||
SetCurItem( item );
|
SetCurItem( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the count is 2, and first item is a pad or moduletext, and the 2nd item is its parent module:
|
// If the count is 2, and first item is a pad or moduletext, and the 2nd item is its parent module:
|
||||||
else if( m_Collector->GetCount() == 2 &&
|
else if( m_Collector->GetCount() == 2
|
||||||
( (*m_Collector)[0]->Type() == TYPEPAD || (*m_Collector)[0]->Type() == TYPETEXTEMODULE) &&
|
&& ( (*m_Collector)[0]->Type() == TYPEPAD || (*m_Collector)[0]->Type() ==
|
||||||
(*m_Collector)[1]->Type() == TYPEMODULE && (*m_Collector)[0]->GetParent()==(*m_Collector)[1] )
|
TYPETEXTEMODULE )
|
||||||
|
&& (*m_Collector)[1]->Type() == TYPEMODULE && (*m_Collector)[0]->GetParent()==
|
||||||
|
(*m_Collector)[1] )
|
||||||
{
|
{
|
||||||
item = (*m_Collector)[0];
|
item = (*m_Collector)[0];
|
||||||
SetCurItem( item );
|
SetCurItem( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
// if all are modules, find the smallest one amoung the primary choices
|
// if all are modules, find the smallest one amoung the primary choices
|
||||||
else if( (item = AllAreModulesAndReturnSmallestIfSo(m_Collector) ) != NULL )
|
else if( ( item = AllAreModulesAndReturnSmallestIfSo( m_Collector ) ) != NULL )
|
||||||
{
|
{
|
||||||
SetCurItem( item );
|
SetCurItem( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
else // show a popup menu
|
else // show a popup menu
|
||||||
{
|
{
|
||||||
wxMenu itemMenu;
|
wxMenu itemMenu;
|
||||||
|
|
||||||
|
itemMenu.SetTitle( _( "Selection Clarification" ) ); // does this work? not under Linux!
|
||||||
|
|
||||||
itemMenu.SetTitle( _("Selection Clarification") ); // does this work? not under Linux!
|
|
||||||
|
|
||||||
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
||||||
|
|
||||||
for( int i=0; i<limit; ++i )
|
for( int i = 0; i<limit; ++i )
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
const char** xpm;
|
const char** xpm;
|
||||||
|
|
||||||
item = (*m_Collector)[i];
|
item = (*m_Collector)[i];
|
||||||
|
|
||||||
text = item->MenuText( m_Pcb );
|
text = item->MenuText( m_Pcb );
|
||||||
xpm = item->MenuIcon();
|
xpm = item->MenuIcon();
|
||||||
|
|
||||||
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START+i, text, xpm );
|
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm );
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||||
|
|
||||||
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
|
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
|
||||||
// and it calls SetCurItem() which in turn calls Display_Infos() on the item.
|
// and it calls SetCurItem() which in turn calls Display_Infos() on the item.
|
||||||
PopupMenu( &itemMenu );
|
PopupMenu( &itemMenu );
|
||||||
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
|
||||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||||
|
|
||||||
// The function ProcessItemSelection() has set the current item, return it.
|
// The function ProcessItemSelection() has set the current item, return it.
|
||||||
item = GetCurItem();
|
item = GetCurItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
/* old way:
|
/* old way:
|
||||||
|
*
|
||||||
item = Locate( CURSEUR_OFF_GRILLE, GetScreen()->m_Active_Layer );
|
* item = Locate( CURSEUR_OFF_GRILLE, GetScreen()->m_Active_Layer );
|
||||||
if( item == NULL )
|
* if( item == NULL )
|
||||||
item = Locate( CURSEUR_OFF_GRILLE, -1 );
|
* item = Locate( CURSEUR_OFF_GRILLE, -1 );
|
||||||
return item;
|
* return item;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -498,7 +307,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
// Save the board after the time out :
|
// Save the board after the time out :
|
||||||
int CurrentTime = time( NULL );
|
int CurrentTime = time( NULL );
|
||||||
if( !GetScreen()->IsModify() || GetScreen()->IsSave() )
|
if( !GetScreen()->IsModify() || GetScreen()->IsSave() )
|
||||||
{
|
{
|
||||||
/* If no change, reset the time out */
|
/* If no change, reset the time out */
|
||||||
g_SaveTime = CurrentTime;
|
g_SaveTime = CurrentTime;
|
||||||
}
|
}
|
||||||
|
@ -552,17 +361,17 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
curpos = m_CurrentScreen->m_Curseur;
|
curpos = m_CurrentScreen->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDA_ZOOM_IN_FROM_MOUSE:
|
case EDA_ZOOM_IN_FROM_MOUSE:
|
||||||
OnZoom( ID_ZOOM_PLUS_KEY );
|
OnZoom( ID_ZOOM_PLUS_KEY );
|
||||||
oldpos = curpos = GetScreen()->m_Curseur;
|
oldpos = curpos = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDA_ZOOM_OUT_FROM_MOUSE:
|
case EDA_ZOOM_OUT_FROM_MOUSE:
|
||||||
OnZoom( ID_ZOOM_MOINS_KEY );
|
OnZoom( ID_ZOOM_MOINS_KEY );
|
||||||
oldpos = curpos = GetScreen()->m_Curseur;
|
oldpos = curpos = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDA_ZOOM_CENTER_FROM_MOUSE:
|
case EDA_ZOOM_CENTER_FROM_MOUSE:
|
||||||
OnZoom( ID_ZOOM_CENTER_KEY );
|
OnZoom( ID_ZOOM_CENTER_KEY );
|
||||||
oldpos = curpos = GetScreen()->m_Curseur;
|
oldpos = curpos = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
@ -607,11 +416,11 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
bool keep_on_grid = TRUE;
|
bool keep_on_grid = TRUE;
|
||||||
if( m_ID_current_state == ID_PCB_DELETE_ITEM_BUTT )
|
if( m_ID_current_state == ID_PCB_DELETE_ITEM_BUTT )
|
||||||
keep_on_grid = FALSE;
|
keep_on_grid = FALSE;
|
||||||
|
|
||||||
/* Cursor is left off grid if no block in progress and no moving object */
|
/* Cursor is left off grid if no block in progress and no moving object */
|
||||||
if( GetScreen()->BlockLocate.m_State != STATE_NO_BLOCK )
|
if( GetScreen()->BlockLocate.m_State != STATE_NO_BLOCK )
|
||||||
keep_on_grid = TRUE;
|
keep_on_grid = TRUE;
|
||||||
|
|
||||||
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
||||||
if( DrawStruct && DrawStruct->m_Flags )
|
if( DrawStruct && DrawStruct->m_Flags )
|
||||||
keep_on_grid = TRUE;
|
keep_on_grid = TRUE;
|
||||||
|
@ -626,7 +435,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
pad = NULL;
|
pad = NULL;
|
||||||
if( keep_on_grid )
|
if( keep_on_grid )
|
||||||
{
|
{
|
||||||
if( pad ) // Put cursor on the pad
|
if( pad ) // Put cursor on the pad
|
||||||
GetScreen()->m_Curseur = curpos = pad->m_Pos;
|
GetScreen()->m_Curseur = curpos = pad->m_Pos;
|
||||||
else
|
else
|
||||||
// Put cursor on grid
|
// Put cursor on grid
|
||||||
|
|
|
@ -31,6 +31,7 @@ OBJECTS= $(TARGET).o classpcb.o\
|
||||||
class_edge_mod.o \
|
class_edge_mod.o \
|
||||||
class_text_mod.o\
|
class_text_mod.o\
|
||||||
class_pcb_text.o\
|
class_pcb_text.o\
|
||||||
|
class_board_item.o\
|
||||||
class_board.o\
|
class_board.o\
|
||||||
drawframe.o\
|
drawframe.o\
|
||||||
drawpanel.o\
|
drawpanel.o\
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
#include "Mode_Track.xpm"
|
#include "Mode_Track.xpm"
|
||||||
#include "tool_ratsnet.xpm"
|
#include "tool_ratsnet.xpm"
|
||||||
#include "local_ratsnet.xpm"
|
#include "local_ratsnet.xpm"
|
||||||
#include "general_ratsnet.xpm"
|
|
||||||
#include "add_cotation.xpm"
|
#include "add_cotation.xpm"
|
||||||
|
|
||||||
#define SEL_LAYER_HELP _( \
|
#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.
|
/* Draw all tracks and zones.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
TRACK* track;
|
TRACK * track = Pcb->m_Track;
|
||||||
|
|
||||||
track = Pcb->m_Track;
|
|
||||||
for( ; track != NULL; track = track->Next() )
|
for( ; track != NULL; track = track->Next() )
|
||||||
{
|
{
|
||||||
track->Draw( panel, DC, drawmode );
|
track->Draw( panel, DC, drawmode );
|
||||||
}
|
}
|
||||||
|
|
||||||
track = Pcb->m_Zone;
|
SEGZONE * zone = Pcb->m_Zone;
|
||||||
for( ; track != NULL; track = track->Next() )
|
for( ; zone != NULL; zone = zone->Next() )
|
||||||
{
|
{
|
||||||
track->Draw( panel, DC, drawmode );
|
zone->Draw( panel, DC, drawmode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue