see change_log.txt 2007-Sep-14 UPDATE

This commit is contained in:
dickelbeck 2007-09-15 04:25:54 +00:00
parent cd81e546e4
commit ef3d04912d
18 changed files with 989 additions and 931 deletions

View File

@ -10,7 +10,15 @@ email address.
+ pcbnew
* controle.cpp, added Function AllAreModulesAndReturnSmallestIfSo() which is
called from PcbGeneralLocateAndDisplay()
* onrightclick.cpp changed to calls to BOARD_ITEM::MenuText()
* onrightclick.cpp changed to calls to BOARD_ITEM::MenuText(), and switched
to member functions for createPopupMenus() so we can get all the state
information we need for the proper menus.
* BOARD_ITEM::MenuText() got new argument BOARD*, and elaboration for
TRACKs and VIAs and Pcb Graphics.
* Fixed a problem in GENERAL_COLLECTOR::Inspect() so it now knows that MODULEs
have their own visibility controls (same for pads and pcb texts). This
interpretation must always match the drawing code's interpretation.
* Made TRACK::TRACK( const TRACK& ) protected to enforce use of TRACK::Copy()
2007-Sep-13 UPDATE Dick Hollenbeck <dick@softplc.com>

View File

@ -53,7 +53,8 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
{
WinEDA_ComponentPropertiesFrame* frame =
new WinEDA_ComponentPropertiesFrame( parent, cmp );
frame->ShowModal(); frame->Destroy();
frame->ShowModal();
frame->Destroy();
}
parent->DrawPanel->MouseToCursorSchema();

View File

@ -125,7 +125,8 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
{
WinEDA_ComponentPropertiesFrame* frame =
new WinEDA_ComponentPropertiesFrame( parent, pos, cmp );
frame->ShowModal(); frame->Destroy();
frame->ShowModal();
frame->Destroy();
}
parent->DrawPanel->m_IgnoreMouseEvents = FALSE;
}

View File

@ -341,7 +341,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
}
/* If the struct found is a DRAW_LIB_ITEM_STRUCT_TYPE type,
* coordinates must be computed according to its orientation matrix
* coordinates must be computed according to its orientation matrix
*/
if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{
@ -519,7 +519,8 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
while( GetLine( file, Line, &LineNum, sizeof(Line) ) )
{
if( strnicmp( Line, "DEF", 3 ) == 0 )
{ /* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */
{
/* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */
strtok( Line, " \t\r\n" );
name = strtok( NULL, " \t\r\n" );
wxString st_name = CONV_FROM_UTF8( name );
@ -533,7 +534,8 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
}
}
else if( strnicmp( Line, "ALIAS", 5 ) == 0 )
{ /* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */
{
/* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */
strtok( Line, " \t\r\n" );
while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL )
{

View File

@ -1,9 +1,9 @@
/*****************************************/
/* EESchema - libedit_onleftclick.cpp */
/*****************************************/
/*****************************************/
/* EESchema - libedit_onleftclick.cpp */
/*****************************************/
/* Library editor commands created by a mouse left button simple or double click
*/
*/
#include "fctsys.h"
#include "gr_basic.h"
@ -20,273 +20,284 @@
/************************************************************************/
void WinEDA_LibeditFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos)
void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/************************************************************************/
{
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
if( CurrentLibEntry == NULL) return;
if( CurrentLibEntry == NULL )
return;
if ( m_ID_current_state == 0 )
{
if ( DrawEntry && DrawEntry->m_Flags )
{
SaveCopyInUndoList(CurrentLibEntry);
switch (DrawEntry->Type() )
{
case COMPONENT_PIN_DRAW_TYPE:
PlacePin(DC);
break;
if( m_ID_current_state == 0 )
{
if( DrawEntry && DrawEntry->m_Flags )
{
SaveCopyInUndoList( CurrentLibEntry );
case COMPONENT_FIELD_DRAW_TYPE:
PlaceField(DC, (LibDrawField *) DrawEntry);
DrawEntry = NULL;
break;
switch( DrawEntry->Type() )
{
case COMPONENT_PIN_DRAW_TYPE:
PlacePin( DC );
break;
default:
EndDrawGraphicItem(DC);
break;
}
}
else
{
DrawEntry = LocatePin(m_CurrentScreen->m_MousePosition, CurrentLibEntry,
CurrentUnit, CurrentConvert);
if (DrawEntry == NULL )
{
DrawEntry = LocateDrawItem(GetScreen(), GetScreen()->m_MousePosition,
CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
}
case COMPONENT_FIELD_DRAW_TYPE:
PlaceField( DC, (LibDrawField*) DrawEntry );
DrawEntry = NULL;
break;
if (DrawEntry == NULL )
DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry,
CurrentUnit, CurrentConvert);
if (DrawEntry == NULL )
{
DrawEntry = LocateDrawItem(GetScreen(), GetScreen()->m_Curseur,
CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
}
default:
EndDrawGraphicItem( DC );
break;
}
}
else
{
DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry,
CurrentUnit, CurrentConvert );
if( DrawEntry == NULL )
{
DrawEntry = LocateDrawItem( GetScreen(), GetScreen()->m_MousePosition,
CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
}
if ( DrawEntry ) DrawEntry->Display_Infos_DrawEntry(this);
if( DrawEntry == NULL )
DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry,
CurrentUnit, CurrentConvert );
if( DrawEntry == NULL )
{
DrawEntry = LocateDrawItem( GetScreen(), GetScreen()->m_Curseur,
CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
}
else
{
EraseMsgBox();
AfficheDoc(this, CurrentLibEntry->m_Doc.GetData(),
CurrentLibEntry->m_KeyWord.GetData());
}
}
}
if( DrawEntry )
DrawEntry->Display_Infos_DrawEntry( this );
if ( m_ID_current_state )
{
switch ( m_ID_current_state )
{
case ID_NO_SELECT_BUTT:
break;
else
{
EraseMsgBox();
AfficheDoc( this, CurrentLibEntry->m_Doc.GetData(),
CurrentLibEntry->m_KeyWord.GetData() );
}
}
}
case ID_LIBEDIT_PIN_BUTT :
if( CurrentDrawItem == NULL )
{
CreatePin(DC);
}
else
{
SaveCopyInUndoList(CurrentLibEntry);
PlacePin(DC);
}
break;
if( m_ID_current_state )
{
switch( m_ID_current_state )
{
case ID_NO_SELECT_BUTT:
break;
case ID_LIBEDIT_BODY_LINE_BUTT :
case ID_LIBEDIT_BODY_ARC_BUTT :
case ID_LIBEDIT_BODY_CIRCLE_BUTT :
case ID_LIBEDIT_BODY_RECT_BUTT :
case ID_LIBEDIT_BODY_TEXT_BUTT :
if ( CurrentDrawItem == NULL)
{
CurrentDrawItem = CreateGraphicItem(DC);
}
else
{
if ( CurrentDrawItem->m_Flags & IS_NEW )
GraphicItemBeginDraw(DC);
else
{
SaveCopyInUndoList(CurrentLibEntry);
EndDrawGraphicItem(DC);
}
}
break;
case ID_LIBEDIT_PIN_BUTT:
if( CurrentDrawItem == NULL )
{
CreatePin( DC );
}
else
{
SaveCopyInUndoList( CurrentLibEntry );
PlacePin( DC );
}
break;
case ID_LIBEDIT_DELETE_ITEM_BUTT :
DrawEntry = LocatePin(m_CurrentScreen->m_MousePosition, CurrentLibEntry,
CurrentUnit, CurrentConvert);
if (DrawEntry == NULL )
{
DrawEntry = LocateDrawItem(GetScreen(), m_CurrentScreen->m_MousePosition,
CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
}
case ID_LIBEDIT_BODY_LINE_BUTT:
case ID_LIBEDIT_BODY_ARC_BUTT:
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
case ID_LIBEDIT_BODY_RECT_BUTT:
case ID_LIBEDIT_BODY_TEXT_BUTT:
if( CurrentDrawItem == NULL )
{
CurrentDrawItem = CreateGraphicItem( DC );
}
else
{
if( CurrentDrawItem->m_Flags & IS_NEW )
GraphicItemBeginDraw( DC );
else
{
SaveCopyInUndoList( CurrentLibEntry );
EndDrawGraphicItem( DC );
}
}
break;
if (DrawEntry == NULL )
DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry,
CurrentUnit, CurrentConvert);
if (DrawEntry == NULL )
{
DrawEntry = LocateDrawItem(GetScreen(), m_CurrentScreen->m_Curseur,
CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
}
if ( DrawEntry == NULL )
{
AfficheDoc(this, CurrentLibEntry->m_Doc.GetData(),
CurrentLibEntry->m_KeyWord.GetData());
break;
}
SaveCopyInUndoList(CurrentLibEntry);
if ( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE )
DeletePin(DC, CurrentLibEntry, (LibDrawPin*)DrawEntry);
else
DeleteOneLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry,DrawEntry, TRUE);
DrawEntry = NULL;
m_CurrentScreen->SetModify();
break;
case ID_LIBEDIT_DELETE_ITEM_BUTT:
DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry,
CurrentUnit, CurrentConvert );
if( DrawEntry == NULL )
{
DrawEntry = LocateDrawItem( GetScreen(), m_CurrentScreen->m_MousePosition,
CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
}
case ID_LIBEDIT_ANCHOR_ITEM_BUTT :
SaveCopyInUndoList(CurrentLibEntry);
PlaceAncre();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString);
break;
if( DrawEntry == NULL )
DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry,
CurrentUnit, CurrentConvert );
if( DrawEntry == NULL )
{
DrawEntry = LocateDrawItem( GetScreen(), m_CurrentScreen->m_Curseur,
CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
}
if( DrawEntry == NULL )
{
AfficheDoc( this, CurrentLibEntry->m_Doc.GetData(),
CurrentLibEntry->m_KeyWord.GetData() );
break;
}
SaveCopyInUndoList( CurrentLibEntry );
if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE )
DeletePin( DC, CurrentLibEntry, (LibDrawPin*) DrawEntry );
else
DeleteOneLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, DrawEntry, TRUE );
DrawEntry = NULL;
m_CurrentScreen->SetModify();
break;
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SaveCopyInUndoList( CurrentLibEntry );
PlaceAncre();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
default :
DisplayError(this, wxT("WinEDA_LibeditFrame::OnLeftClick error") );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString);
break;
}
}
default:
DisplayError( this, wxT( "WinEDA_LibeditFrame::OnLeftClick error" ) );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
}
}
}
/*************************************************************************/
void WinEDA_LibeditFrame::OnLeftDClick(wxDC * DC, const wxPoint& MousePos)
void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/
/* Appelé sur un double click:
pour un élément editable (textes, composant):
appel de l'editeur correspondant.
pour une connexion en cours:
termine la connexion
*/
* pour un élément editable (textes, composant):
* appel de l'editeur correspondant.
* pour une connexion en cours:
* termine la connexion
*/
{
wxPoint pos = GetPosition();
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
wxPoint pos = GetPosition();
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
if ( CurrentLibEntry == NULL ) return;
if( CurrentLibEntry == NULL )
return;
if ( !m_ID_current_state || // Simple localisation des elements
(DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
{
DrawEntry = LocatePin(m_CurrentScreen->m_MousePosition, CurrentLibEntry,
CurrentUnit, CurrentConvert);
if ( DrawEntry == NULL )
DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry,
CurrentUnit, CurrentConvert);
if ( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)m_CurrentScreen,
m_CurrentScreen->m_MousePosition,CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
}
if ( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)m_CurrentScreen,
m_CurrentScreen->m_Curseur, CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
}
if ( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*)
LocateField(CurrentLibEntry);
}
if ( DrawEntry == NULL )
{
wxPoint mpos;
wxGetMousePosition(&mpos.x, &mpos.y);
InstallLibeditFrame(mpos);
}
}
if( !m_ID_current_state // Simple localisation des elements
|| (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
{
DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry,
CurrentUnit, CurrentConvert );
if( DrawEntry == NULL )
DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry,
CurrentUnit, CurrentConvert );
if( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) m_CurrentScreen,
m_CurrentScreen->m_MousePosition,
CurrentLibEntry, CurrentUnit,
CurrentConvert,
LOCATE_ALL_DRAW_ITEM );
}
if( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) m_CurrentScreen,
m_CurrentScreen->m_Curseur,
CurrentLibEntry, CurrentUnit,
CurrentConvert,
LOCATE_ALL_DRAW_ITEM );
}
if( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*)
LocateField( CurrentLibEntry );
}
if( DrawEntry == NULL )
{
wxPoint mpos;
wxGetMousePosition( &mpos.x, &mpos.y );
InstallLibeditFrame( mpos );
}
}
// Si Commande en cours: affichage commande d'annulation
if ( m_ID_current_state )
{
}
// Si Commande en cours: affichage commande d'annulation
if( m_ID_current_state )
{
}
else
{
}
else
{
}
if( DrawEntry )
DrawEntry->Display_Infos_DrawEntry( this );
else
return;
if ( DrawEntry ) DrawEntry->Display_Infos_DrawEntry(this);
else return;
CurrentDrawItem = DrawEntry;
CurrentDrawItem = DrawEntry;
DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->m_IgnoreMouseEvents = TRUE;
switch ( DrawEntry->Type() )
{
case COMPONENT_PIN_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 ) // Item localisé et non en edition: placement commande move
{
InstallPineditFrame(this, DC, pos);
}
break;
switch( DrawEntry->Type() )
{
case COMPONENT_PIN_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 ) // Item localisé et non en edition: placement commande move
{
InstallPineditFrame( this, DC, pos );
}
break;
case COMPONENT_ARC_DRAW_TYPE:
case COMPONENT_CIRCLE_DRAW_TYPE:
case COMPONENT_RECT_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
EditGraphicSymbol(DC, DrawEntry);
}
break;
case COMPONENT_ARC_DRAW_TYPE:
case COMPONENT_CIRCLE_DRAW_TYPE:
case COMPONENT_RECT_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
EditGraphicSymbol( DC, DrawEntry );
}
break;
case COMPONENT_LINE_DRAW_TYPE:
case COMPONENT_POLYLINE_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
EditGraphicSymbol(DC, DrawEntry);
}
else if( DrawEntry->m_Flags & IS_NEW )
{
EndDrawGraphicItem(DC);
}
break;
case COMPONENT_LINE_DRAW_TYPE:
case COMPONENT_POLYLINE_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
EditGraphicSymbol( DC, DrawEntry );
}
else if( DrawEntry->m_Flags & IS_NEW )
{
EndDrawGraphicItem( DC );
}
break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
EditSymbolText(DC, DrawEntry);
}
break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
EditSymbolText( DC, DrawEntry );
}
break;
case COMPONENT_FIELD_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
EditField(DC, (LibDrawField *)DrawEntry);
}
break;
case COMPONENT_FIELD_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
EditField( DC, (LibDrawField*) DrawEntry );
}
break;
default:
wxString msg;
msg.Printf(
wxT("WinEDA_LibeditFrame::OnLeftDClick Error: unknown StructType %d"),
DrawEntry->Type());
DisplayError(this, msg );
break;
}
DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE;
default:
wxString msg;
msg.Printf(
wxT( "WinEDA_LibeditFrame::OnLeftDClick Error: unknown StructType %d" ),
DrawEntry->Type() );
DisplayError( this, msg );
break;
}
DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE;
}

File diff suppressed because it is too large Load Diff

View File

@ -177,7 +177,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File,
}
else // a true TRACK
{
newtrack = new TRACK( *track );
newtrack = track->Copy();
newtrack->SetLayer( pcb_layer_number );
}

View File

@ -85,6 +85,7 @@ enum SEARCH_RESULT {
class EDA_BaseStruct;
class WinEDA_DrawFrame;
class BOARD;
/**
* Class INSPECTOR
@ -433,20 +434,6 @@ public:
}
/**
* Function IsOnOneOfTheseLayers
* returns true if this object is on one of the given layers. Is virtual so
* objects like D_PAD, which reside on multiple layers, can do their own
* form of testing.
* @param aLayerMask The bit-mapped set of layers to test for.
* @return bool - true if on one of the given layers, else false.
*/
virtual bool IsOnOneOfTheseLayers( int aLayerMask ) const
{
return ( (1<<m_Layer) & aLayerMask ) != 0;
}
/**
* Function IsLocked
* @return bool - true if the object is locked, else false
@ -456,13 +443,17 @@ public:
return false; // only MODULEs can be locked at this time.
}
/**
* Function MenuText
* @return wxString - The text to use in any menu type UI control which
* must identify this item.
* @todo: make this virtual and split into each derived class
* returns the text to use in any menu type UI control which must uniquely
* identify this item.
* @param aBoard The PCB in which this item resides, needed for Net lookup.
* @return wxString
* @todo: maybe: make this virtual and split into each derived class
*/
wxString MenuText() const;
wxString MenuText( const BOARD* aBoard ) const;
/**
* Function MenuIcon

View File

@ -38,7 +38,7 @@ public:
bool m_AutoPAN_Enable; // TRUE pour autoriser auto pan (autorisation g<><67>ale)
bool m_AutoPAN_Request; // TRUE pour auto pan (lorsque auto pan n<>essaire)
bool m_IgnoreMouseEvents; // TRUE pour ne par traiter les evenements souris
int m_IgnoreMouseEvents; ///< when non-zero, then ignore mouse events
bool m_Block_Enable; // TRUE pour autoriser Bloc Commandes (autorisation g<><67>ale)
int m_CanStartBlock; // >= 0 (ou >= n) si un bloc peut demarrer

View File

@ -287,7 +287,7 @@ public:
* @param aNetcode A netcode to search for.
* @return EQUIPOT* - the net or NULL if not found.
*/
EQUIPOT* FindNet( int aNetcode );
EQUIPOT* FindNet( int aNetcode ) const;
/**

View File

@ -557,27 +557,13 @@ private:
bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu;
#if 0 && defined(DEBUG)
/**
* Function onRightClickBuilder
* is a helper function for private use by OnRightClick(). It helps build
* the hierarchical menu.
* @param collectorNdx The index into the COLLECTOR that \a aItem represents.
* @param aItem The BOARD_ITEM to provide menu support for, or NULL if
* nothing was under the mouse.
* @param pPopMenu What to populate with choices.
*/
void onRightClickBuilder( int collectorNdx, BOARD_ITEM* aItem, wxMenu* aPopMenu );
void popUpMenuForFootprints( int collectorNdx, MODULE* aModule, wxMenu* aPopMenu );
void popUpMenuForFpTexts( int collectorNdx, TEXTE_MODULE* aText, wxMenu* aPopMenu );
void popUpMenuForFpPads( int collectorNdx, D_PAD* aPad, wxMenu* aPopMenu );
void popupMenuForTracks( int collectorNdx, TRACK* aTrack, wxMenu* aPopMenu );
#endif
// we'll use lower case function names for private member functions.
void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu );
void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
void createPopUpBlockMenu( wxMenu* menu );
public:
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,

View File

@ -450,7 +450,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
}
/*
/* now using PcbGeneralLocateAndDisplay()
// see pcbstruct.h
BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
{
@ -534,7 +534,7 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
* @param anetcode The netcode to search for.
* @return EQUIPOT* - the net or NULL if not found.
*/
EQUIPOT* BOARD::FindNet( int anetcode )
EQUIPOT* BOARD::FindNet( int anetcode ) const
{
if( anetcode <= 0 )
return NULL;

View File

@ -39,16 +39,18 @@ public:
// chain = 0 indique une connexion non encore traitee
int m_Param; // Auxiliary variable ( used in some computations )
protected:
TRACK( const TRACK& track ); // protected so Copy() is used instead.
public:
TRACK( BOARD_ITEM* StructFather, KICAD_T idtype = TYPETRACK );
TRACK( const TRACK& track );
/**
* Function Copy
* will copy this object whether it is a TRACK or a SEGVIA returning
* the corresponding type.
* @return - TRACK* or SEGVIA*, typed as the least common demoninator: TRACK
* @return - TRACK*, SEGVIA*, or SEGZONE*, declared as the least common
* demoninator: TRACK
*/
TRACK* Copy() const;

View File

@ -191,7 +191,6 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
default:
break;
}
// common tests:
@ -202,13 +201,15 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
if( m_Guide->IgnoreModulesOnCmp() && module->GetLayer()==LAYER_CMP_N )
goto exit;
}
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() )
{
int layer = item->GetLayer();
if( m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() )
// Modules and their subcomponents: text and pads are not sensitive to the layer
// visibility controls. They all have their own separate visibility controls
if( module || m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() )
{
if( !m_Guide->IsLayerLocked(layer) || !m_Guide->IgnoreLockedLayers() )
{
@ -233,7 +234,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
int layer = item->GetLayer();
if( m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() )
// Modules and their subcomponents: text and pads are not sensitive to the layer
// visibility controls. They all have their own separate visibility controls
if( module || m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() )
{
if( !m_Guide->IsLayerLocked(layer) || !m_Guide->IgnoreLockedLayers() )
{

View File

@ -124,10 +124,11 @@ void RemoteCommand( const char* cmdline )
// @todo: move this to proper source file.
wxString BOARD_ITEM::MenuText() const
wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
{
wxString text;
const BOARD_ITEM* item = this;
EQUIPOT* net;
switch( item->Type() )
{
@ -140,11 +141,13 @@ wxString BOARD_ITEM::MenuText() const
break;
case TYPEPAD:
text << _("Pad") << wxT(" ") << ((D_PAD*)item)->ReturnStringPadName() << _(" of ") << GetParent()->MenuText();
text << _("Pad") << wxT(" ") << ((D_PAD*)item)->ReturnStringPadName() << _(" of ")
// << GetParent()->MenuText( aPcb );
<< ((MODULE*)GetParent())->GetReference();
break;
case TYPEDRAWSEGMENT:
text << _("PGraphic");
text << _("Pcb Graphic") << _(" on ") << ReturnPcbLayerName( item->GetLayer() ); // @todo: extend text
break;
case TYPETEXTE:
@ -163,29 +166,63 @@ wxString BOARD_ITEM::MenuText() const
break;
case TEXT_is_VALUE:
text << _( "Value" ) << wxT( " " ) << ((TEXTE_MODULE*)item)->m_Text << _(" of ") << GetParent()->MenuText();
text << _( "Value" ) << wxT( " " ) << ((TEXTE_MODULE*)item)->m_Text << _(" of ")
// << GetParent()->MenuText( aPcb );
<< ((MODULE*)GetParent())->GetReference();
break;
default:
text << _( "Text" ) << wxT( " " ) << ((TEXTE_MODULE*)item)->m_Text << _(" of ") << GetParent()->MenuText();
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 << _("MGraphic"); // @todo: expand on the text
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?
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"); // @todo: expand on the text
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"); // @todo: expand on the text
text << _("Zone") << _(" on ") << ReturnPcbLayerName( item->GetLayer() );
break;
case TYPEVIA:
text << _("Via"); // @todo: expand on text
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:
@ -201,7 +238,7 @@ wxString BOARD_ITEM::MenuText() const
break;
case TYPEEDGEZONE:
text << _("Graphic"); // @todo: extend text
text << _("Edge Zone") << _(" on ") << ReturnPcbLayerName( item->GetLayer() ); // @todo: extend text
break;
default:
@ -418,7 +455,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
item = (*m_Collector)[i];
text = item->MenuText();
text = item->MenuText( m_Pcb );
xpm = item->MenuIcon();
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START+i, text, xpm );

View File

@ -147,7 +147,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
if( g_TwoSegmentTrackBuild )
{
// Create 2 segments
g_CurrentTrackSegment = new TRACK( *g_CurrentTrackSegment );
g_CurrentTrackSegment = g_CurrentTrackSegment->Copy();
g_TrackSegmentCount++;
g_CurrentTrackSegment->Pback = g_FirstTrackSegment;
g_FirstTrackSegment->Pnext = g_CurrentTrackSegment;
@ -797,7 +797,7 @@ void EnsureEndTrackOnPad( D_PAD* Pad )
if( !g_CurrentTrackSegment->IsNull() )
{
/* Must create a new segment, from track end to pad center */
g_CurrentTrackSegment = new TRACK( *lasttrack );
g_CurrentTrackSegment = lasttrack->Copy();
g_TrackSegmentCount++;
lasttrack->Pnext = g_CurrentTrackSegment;
g_CurrentTrackSegment->Pback = lasttrack;

View File

@ -55,19 +55,6 @@
#include "Flag.xpm"
/* local functions */
static void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition,
wxMenu* PopMenu );
static void CreatePopUpMenuForFootprints( MODULE* Footprint, wxMenu* menu, bool full_menu );
static void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu );
static void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu );
static void CreatePopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
static void CreatePopUpBlockMenu( wxMenu* menu );
/*****/
/********************************************/
static wxMenu* Append_Track_Width_List()
/********************************************/
@ -168,7 +155,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if( (item && item->m_Flags) || BlockActive )
{
if( BlockActive )
CreatePopUpBlockMenu( aPopMenu );
createPopUpBlockMenu( aPopMenu );
else
{
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
@ -194,10 +181,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
switch( item->Type() )
{
case TYPEMODULE:
if( !flags )
CreatePopUpMenuForFootprints( (MODULE*) item, aPopMenu, TRUE );
else
CreatePopUpMenuForFootprints( (MODULE*) item, aPopMenu, FALSE );
createPopUpMenuForFootprints( (MODULE*) item, aPopMenu );
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE )
{
@ -219,37 +203,11 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
break;
case TYPEPAD:
CreatePopUpMenuForPads( (D_PAD*) item, aPopMenu );
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
{
if( !flags )
{
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) );
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) );
}
}
if( !flags )
{
MODULE* module = (MODULE*) item->m_Parent;
if( module )
{
aPopMenu->AppendSeparator();
CreatePopUpMenuForFootprints( module, aPopMenu, TRUE );
}
}
createPopUpMenuForFpPads( (D_PAD*) item, aPopMenu );
break;
case TYPETEXTEMODULE:
CreatePopUpMenuForFpTexts( (TEXTE_MODULE*) item, aPopMenu );
if( !flags )
{
MODULE* module = (MODULE*) item->m_Parent;
if( module )
{
aPopMenu->AppendSeparator();
CreatePopUpMenuForFootprints( module, aPopMenu, TRUE );
}
}
createPopUpMenuForFpTexts( (TEXTE_MODULE*) item, aPopMenu );
break;
case TYPEDRAWSEGMENT:
@ -278,14 +236,13 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
break;
case TYPETEXTE:
CreatePopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu );
createPopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu );
break;
case TYPETRACK:
case TYPEVIA:
locate_track = TRUE;
CreatePopupMenuForTracks( (TRACK*) item, GetScreen()->m_Curseur,
aPopMenu );
createPopupMenuForTracks( (TRACK*) item, aPopMenu );
break;
case TYPEZONE:
@ -469,7 +426,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
/****************************************/
void CreatePopUpBlockMenu( wxMenu* menu )
void WinEDA_PcbFrame::createPopUpBlockMenu( wxMenu* menu )
/****************************************/
/* Create Pop sub menu for block commands
@ -494,13 +451,14 @@ void CreatePopUpBlockMenu( wxMenu* menu )
/********************************************************************/
void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition,
wxMenu* PopMenu )
void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
/*******************************************************************/
/* Create command lines for a popup menu, for track editing
*/
{
wxPoint cursorPosition = GetScreen()->m_Curseur;
int flags = Track->m_Flags;
if( flags == 0 )
@ -532,7 +490,7 @@ void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition,
}
else
{
if( Track->IsPointOnEnds( CursorPosition, -1 ) != 0 )
if( Track->IsPointOnEnds( cursorPosition, -1 ) != 0 )
{
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE,
_( "Move Node" ), move_xpm );
@ -623,7 +581,7 @@ void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition,
/*********************************************************************************/
void CreatePopUpMenuForFootprints( MODULE* aModule, wxMenu* menu, bool full_menu )
void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu )
/*********************************************************************************/
/* Create the wxMenuitem list for footprint editing
@ -632,12 +590,12 @@ void CreatePopUpMenuForFootprints( MODULE* aModule, wxMenu* menu, bool full_menu
wxMenu* sub_menu_footprint;
int flags = aModule->m_Flags;
wxString msg = aModule->MenuText();
wxString msg = aModule->MenuText( m_Pcb );
sub_menu_footprint = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm );
if( full_menu )
if( !flags )
{
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST,
_( "Move (M)" ), Move_Module_xpm );
@ -663,7 +621,7 @@ void CreatePopUpMenuForFootprints( MODULE* aModule, wxMenu* menu, bool full_menu
/********************************************************************/
void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu )
void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu )
/********************************************************************/
/* Create the wxMenuitem list for editing texts on footprints
@ -672,7 +630,7 @@ void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu )
wxMenu* sub_menu_Fp_text;
int flags = FpText->m_Flags;
wxString msg = FpText->MenuText();
wxString msg = FpText->MenuText( m_Pcb );
sub_menu_Fp_text = new wxMenu;
@ -690,18 +648,28 @@ void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu )
if( FpText->m_Type == TEXT_is_DIVERS )
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE,
_( "Delete" ), delete_xpm );
if( !flags )
{
MODULE* module = (MODULE*) FpText->GetParent();
if( module )
{
menu->AppendSeparator();
createPopUpMenuForFootprints( module, menu );
}
}
}
/***************************************************************/
void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu )
void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
/***************************************************************/
/* Create pop menu for pads */
{
wxMenu* sub_menu_Pad;
int flags = Pad->m_Flags;
wxString msg = Pad->MenuText();
wxString msg = Pad->MenuText( m_Pcb );
sub_menu_Pad = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm );
@ -729,18 +697,36 @@ void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu )
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD,
_( "delete" ), Delete_Pad_xpm );
}
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
{
if( !flags )
{
menu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) );
menu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) );
}
}
if( !flags )
{
MODULE* module = (MODULE*) Pad->GetParent();
if( module )
{
menu->AppendSeparator();
createPopUpMenuForFootprints( module, menu );
}
}
}
/*************************************************************/
void CreatePopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
/*************************************************************/
/* Create pop menu for pcb texts */
{
wxMenu* sub_menu_Text;
int flags = Text->m_Flags;
wxString msg = Text->MenuText();
wxString msg = Text->MenuText( m_Pcb );
sub_menu_Text = new wxMenu;

View File

@ -57,7 +57,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
m_CanStartBlock = -1; // Command block can start if >= 0
m_AbortEnable = m_AbortRequest = FALSE;
m_AutoPAN_Enable = TRUE;
m_IgnoreMouseEvents = FALSE;
m_IgnoreMouseEvents = 0;
ManageCurseur = NULL;
ForceCloseManageCurseur = NULL;