Commit 1f842ae1 authored by CHARRAS's avatar CHARRAS

bug in move pad fixed (could crash pcbnew).Other minor changes

parent 88ef06ef
......@@ -150,7 +150,7 @@ glEnable(GL_FOG);
glVertex3f( sx, -sy , zpos);
glEnd();
glBegin(GL_QUADS);
SetGLColor(g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CUIVRE_N]);
SetGLColor(g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[COPPER_LAYER_N]);
glNormal3f( 0.0, 0.0, -1.0); // Normal is -Z axis
glVertex3f( -sx, -sy , 0);
glVertex3f( -sx, sy , 0);
......@@ -213,7 +213,7 @@ double w;
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
SetGLColor(color);
glNormal3f( 0.0, 0.0, (layer == CUIVRE_N) ? -1.0 : 1.0);
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
w = track->m_Width * g_Parm_3D_Visu.m_BoardScale;
ox = track->m_Start.x * g_Parm_3D_Visu.m_BoardScale;
......@@ -250,7 +250,7 @@ int color;
else color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N];
if ( color & ITEM_NOT_SHOW ) continue;
SetGLColor(color);
glNormal3f( 0.0, 0.0, (layer == CUIVRE_N) ? -1.0 : 1.0);
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
Draw3D_FilledCircle(x, -y, r, hole, zpos);
if ( layer >= top_layer) break;
......@@ -284,7 +284,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
{
for ( layer = 0; layer < g_Parm_3D_Visu.m_Layers; layer++ )
{
glNormal3f( 0.0, 0.0, (layer == CUIVRE_N) ? -1.0 : 1.0);
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos);
}
......@@ -312,7 +312,7 @@ D_PAD * pad = m_Pads;
}
if( ! DisplayOpt.Show_Modules_Cu )
{
if(m_Layer == CUIVRE_N) return;
if(m_Layer == COPPER_LAYER_N) return;
}
#endif
......@@ -335,7 +335,7 @@ bool As3dShape = FALSE;
{
glRotatef( (double)m_Orient / 10, 0.0, 0.0, 1.0 );
}
if ( m_Layer == CUIVRE_N )
if ( m_Layer == COPPER_LAYER_N )
{
glRotatef( 180.0, 0.0, 1.0, 0.0 );
glRotatef( 180.0, 0.0, 0.0, 1.0 );
......@@ -384,7 +384,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
if ( color & ITEM_NOT_SHOW ) return;
SetGLColor(color);
glNormal3f( 0.0, 0.0, (m_Layer == CUIVRE_N) ? -1.0 : 1.0);
glNormal3f( 0.0, 0.0, (m_Layer == COPPER_LAYER_N) ? -1.0 : 1.0);
scale = g_Parm_3D_Visu.m_BoardScale;
ux0 = m_Start.x;
......@@ -477,16 +477,16 @@ int color;
x = xc * scale;
y = yc * scale;
r = (double)dx * scale;
for ( layer = CUIVRE_N; layer <= CMP_N; layer ++)
for ( layer = COPPER_LAYER_N; layer <= CMP_N; layer ++)
{
if (layer && (layer == nlmax) ) layer = CMP_N;
if ( (layer == CMP_N) && ! Oncmp ) continue;
if ( (layer == CUIVRE_N) && ! Oncu ) continue;
if ( (layer > CUIVRE_N) && (layer < CMP_N) && !Both) continue;
if ( (layer == COPPER_LAYER_N) && ! Oncu ) continue;
if ( (layer > COPPER_LAYER_N) && (layer < CMP_N) && !Both) continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
if ( color & ITEM_NOT_SHOW ) continue;
SetGLColor(color);
glNormal3f( 0.0, 0.0, (layer == CUIVRE_N) ? -1.0 : 1.0);
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
Draw3D_FilledCircle(x, -y, r, hole, zpos);
}
......@@ -513,14 +513,14 @@ int color;
oy = (double)(uy0 + delta_cy) * scale;
fx = (double)(ux0 - delta_cx) * scale;
fy = (double)(uy0 - delta_cy) * scale;
for ( layer = CUIVRE_N; layer <= CMP_N; layer ++)
for ( layer = COPPER_LAYER_N; layer <= CMP_N; layer ++)
{
if (layer && (layer == nlmax) ) layer = CMP_N;
if ( (layer == CMP_N) && ! Oncmp ) continue;
if ( (layer == CUIVRE_N) && ! Oncu ) continue;
if ( (layer > CUIVRE_N) && (layer < CMP_N) && !Both) continue;
if ( (layer == COPPER_LAYER_N) && ! Oncu ) continue;
if ( (layer > COPPER_LAYER_N) && (layer < CMP_N) && !Both) continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
glNormal3f( 0.0, 0.0, (layer == CUIVRE_N) ? -1.0 : 1.0);
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
if ( color & ITEM_NOT_SHOW ) continue;
SetGLColor(color);
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
......@@ -574,14 +574,14 @@ int color;
f_hole_coord[ii][1] += drilly;
}
for ( layer = CUIVRE_N; layer <= CMP_N; layer ++)
for ( layer = COPPER_LAYER_N; layer <= CMP_N; layer ++)
{
if (layer && (layer == nlmax) ) layer = CMP_N;
if ( (layer == CMP_N) && ! Oncmp ) continue;
if ( (layer == CUIVRE_N) && ! Oncu ) continue;
if ( (layer > CUIVRE_N) && (layer < CMP_N) && !Both) continue;
if ( (layer == COPPER_LAYER_N) && ! Oncu ) continue;
if ( (layer > COPPER_LAYER_N) && (layer < CMP_N) && !Both) continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
glNormal3f( 0.0, 0.0, (layer == CUIVRE_N) ? -1.0 : 1.0);
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
if ( color & ITEM_NOT_SHOW ) continue;
SetGLColor(color);
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
......
......@@ -4,6 +4,21 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Oct-7 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ eeschema
create new file cross-probing.cpp
move RemoteCommand() to cross-probing.cpp and create SendMessageToPCBNEW()
+ pcbnew
bug in move pad fixed (could crash pcbnew)
Small change in selection clarification (side effect removed):
- Escape or click on title does not show the next popup menu.
- the title is displayed under linux
- definition CUIVRE_N translated into COPPER_LAYER_N
2007-Oct-07 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ all
......
......@@ -192,7 +192,7 @@ public:
void RecreateMenuBar();
void OnLeftClick(wxDC * DC, const wxPoint& MousePos);
void OnLeftDClick(wxDC * DC, const wxPoint& MousePos);
void OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu);
bool OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu);
void SetToolbars();
void InstallOptionsDisplay(wxCommandEvent& event);
MODULE * Get_Module(const wxString & CmpName);
......
......@@ -144,18 +144,25 @@ void WinEDA_DisplayFrame::SetToolbars()
}
/*************************************************************************/
void WinEDA_DisplayFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/
{
}
/*************************************************************************/
void WinEDA_DisplayFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/
{
}
void WinEDA_DisplayFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
/*********************************************************************************/
bool WinEDA_DisplayFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
/*********************************************************************************/
{
return true;
}
......
......@@ -17,79 +17,6 @@
#include "protos.h"
/* Routines locales */
/* variables externes */
/***************************************************************/
void RemoteCommand( const char* cmdline )
/***************************************************************/
/** Read a remote command sent by pcbnew (via a socket connection) , so when user selects a module
* or pin in pcbnew, eeschema shows that same component or pin.
* The cursor is put on the item
* @param cmdline = received command from pcbnew
* commands are:
* $PART: "reference" put cursor on component
* $PART: "reference" $REF: "ref" put cursor on reference component
* $PART: "reference" $VAL: "value" put cursor on value component
* $PART: "reference" $PAD: "pin name" put cursor on the component pin
*/
{
char line[1024];
char* idcmd;
char* text;
WinEDA_SchematicFrame* frame = EDA_Appl->m_SchematicFrame;
wxString part_ref, msg;
strncpy( line, cmdline, sizeof(line) - 1 );
idcmd = strtok( line, " \n\r" );
text = strtok( NULL, "\"\n\r" );
if( (idcmd == NULL) || (text == NULL) )
return;
if( strcmp( idcmd, "$PART:" ) != 0 )
return;
part_ref = CONV_FROM_UTF8( text );
/* look for a complement */
idcmd = strtok( NULL, " \n\r" );
if( idcmd == NULL ) // component only
{
frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false );
return;
}
text = strtok( NULL, "\"\n\r" );
if( text == NULL )
return;
msg = CONV_FROM_UTF8( text );
if( strcmp( idcmd, "$REF:" ) == 0 )
{
frame->FindComponentAndItem( part_ref, true, 2, msg, false );
}
else if( strcmp( idcmd, "$VAL:" ) == 0 )
{
frame->FindComponentAndItem( part_ref, true, 3, msg, false );
}
else if( strcmp( idcmd, "$PAD:" ) == 0 )
{
frame->FindComponentAndItem( part_ref, true, 1, msg, false );
}
else
frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false );
}
/**************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::
SchematicGeneralLocateAndDisplay( bool IncludePin )
......@@ -114,7 +41,6 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
wxPoint mouse_position = GetScreen()->m_MousePosition;
LibDrawPin* Pin = NULL;
EDA_SchComponentStruct* LibItem = NULL;
char Line[1024];
DrawStruct = SchematicGeneralLocateAndDisplay( mouse_position, IncludePin );
if( !DrawStruct && ( mouse_position != GetScreen()->m_Curseur) )
......@@ -128,21 +54,14 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
switch( DrawStruct->Type() )
{
case COMPONENT_FIELD_DRAW_TYPE:
{
PartTextStruct* Field = (PartTextStruct*) DrawStruct;
LibItem = (EDA_SchComponentStruct*) Field->m_Parent;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) );
SendCommand( MSG_TO_PCB, Line );
}
SendMessageToPCBNEW( DrawStruct );
break;
case DRAW_LIB_ITEM_STRUCT_TYPE:
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, GetScreen()->m_Curseur, &LibItem );
if( Pin )
break; // Priority is probing a pin first
LibItem = (EDA_SchComponentStruct*) DrawStruct;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) );
SendCommand( MSG_TO_PCB, Line );
SendMessageToPCBNEW( DrawStruct );
break;
default:
......@@ -165,14 +84,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
CYAN );
// Cross probing:2 - pin found, and send a locate pin command to pcbnew (hightlight net)
if( Pin->m_PinNum )
{
wxString pinnum;
Pin->ReturnPinStringNum( pinnum );
sprintf( Line, "$PIN: %s $PART: %s", CONV_TO_UTF8( pinnum ),
CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) );
SendCommand( MSG_TO_PCB, Line );
}
SendMessageToPCBNEW( Pin );
}
return DrawStruct;
}
......
/*********************/
/* cross-probing.cpp */
/*********************/
#include "fctsys.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "eda_dde.h"
#include "id.h"
#include "protos.h"
/***************************************************************/
void RemoteCommand( const char* cmdline )
/***************************************************************/
/** Read a remote command sent by pcbnew (via a socket connection) ,
* so when user selects a module or pin in pcbnew,
* eeschema shows that same component or pin.
* The cursor is put on the item
* port KICAD_SCH_PORT_SERVICE_NUMBER (currently 4243)
* @param cmdline = received command from pcbnew
* commands are:
* $PART: "reference" put cursor on component
* $PART: "reference" $REF: "ref" put cursor on reference component
* $PART: "reference" $VAL: "value" put cursor on value component
* $PART: "reference" $PAD: "pin name" put cursor on the component pin
*/
{
char line[1024];
char* idcmd;
char* text;
WinEDA_SchematicFrame* frame = EDA_Appl->m_SchematicFrame;
wxString part_ref, msg;
strncpy( line, cmdline, sizeof(line) - 1 );
idcmd = strtok( line, " \n\r" );
text = strtok( NULL, "\"\n\r" );
if( (idcmd == NULL) || (text == NULL) )
return;
if( strcmp( idcmd, "$PART:" ) != 0 )
return;
part_ref = CONV_FROM_UTF8( text );
/* look for a complement */
idcmd = strtok( NULL, " \n\r" );
if( idcmd == NULL ) // component only
{
frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false );
return;
}
text = strtok( NULL, "\"\n\r" );
if( text == NULL )
return;
msg = CONV_FROM_UTF8( text );
if( strcmp( idcmd, "$REF:" ) == 0 )
{
frame->FindComponentAndItem( part_ref, true, 2, msg, false );
}
else if( strcmp( idcmd, "$VAL:" ) == 0 )
{
frame->FindComponentAndItem( part_ref, true, 3, msg, false );
}
else if( strcmp( idcmd, "$PAD:" ) == 0 )
{
frame->FindComponentAndItem( part_ref, true, 1, msg, false );
}
else
frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false );
}
/*****************************************************************************/
void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync )
/*****************************************************************************/
/** Send a remote command to eeschema via a socket,
* @param objectToSync = item to be located on board (footprint, pad or text)
* Commands are
* $PART: reference put cursor on footprint anchor
* $PIN: number $PART: reference put cursor on the footprint pad
*/
{
if ( objectToSync == NULL )return;
LibDrawPin* Pin = NULL;
EDA_SchComponentStruct* LibItem = NULL;
char Line[1024];
/* Cross probing to pcbnew if a pin or a component is found */
switch( objectToSync->Type() )
{
case COMPONENT_FIELD_DRAW_TYPE:
{
PartTextStruct* Field = (PartTextStruct*) objectToSync;
LibItem = (EDA_SchComponentStruct*) Field->m_Parent;
if( LibItem == NULL ) break;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) );
SendCommand( MSG_TO_PCB, Line );
}
break;
case DRAW_LIB_ITEM_STRUCT_TYPE:
LibItem = (EDA_SchComponentStruct*) objectToSync;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) );
SendCommand( MSG_TO_PCB, Line );
break;
case COMPONENT_PIN_DRAW_TYPE:
Pin = (LibDrawPin*) objectToSync;
LibItem = (EDA_SchComponentStruct *) Pin->m_Parent;
if( LibItem == NULL ) break;
if ( Pin->m_PinNum )
{
wxString pinnum;
Pin->ReturnPinStringNum( pinnum );
sprintf( Line, "$PIN: %s $PART: %s", CONV_TO_UTF8( pinnum ),
CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) );
}
else
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) );
SendCommand( MSG_TO_PCB, Line );
break;
default:
break;
}
}
......@@ -30,13 +30,13 @@ static void AddMenusForPin(wxMenu * PopMenu, LibDrawPin* Pin, WinEDA_LibeditFram
/********************************************************************************/
void WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu)
bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu)
/********************************************************************************/
{
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
if ( CurrentLibEntry == NULL ) return;
if ( CurrentLibEntry == NULL ) return true;
if ( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
{ // Simple localisation des elements
......@@ -86,7 +86,7 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
}
if ( DrawEntry ) DrawEntry->Display_Infos_DrawEntry(this);
else return;
else return true;
CurrentDrawItem = DrawEntry;
......@@ -208,6 +208,7 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
break;
}
PopMenu->AppendSeparator();
return true;
}
/**********************************************************************************/
......
......@@ -17,6 +17,7 @@ OBJECTS = eeschema.o\
libedit_onrightclick.o\
libedit_onleftclick.o\
dangling_ends.o\
cross-probing.o\
setpage.o\
cmpclass.o\
class_hierarchy_sheet.o\
......
......@@ -77,7 +77,7 @@ void WinEDA_SchematicFrame::ToolOnRightClick( wxCommandEvent& event )
/*****************************************************************/
void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
/*****************************************************************/
......@@ -96,7 +96,7 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
{
AddMenusForBlock( PopMenu, this );
PopMenu->AppendSeparator();
return;
return true;
}
// Simple localisation des elements si possible
......@@ -142,7 +142,7 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ), leave_sheet_xpm );
PopMenu->AppendSeparator();
}
return;
return true;
}
m_CurrentScreen->SetCurItem( DrawStruct );
......@@ -251,6 +251,7 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
}
PopMenu->AppendSeparator();
return true;
}
......
......@@ -99,9 +99,10 @@ void WinEDA_ViewlibFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos)
}
/********************************************************************************/
void WinEDA_ViewlibFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu)
bool WinEDA_ViewlibFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu)
/********************************************************************************/
{
return true;
}
......
......@@ -13,7 +13,7 @@
#include "protos.h"
/********************************************************************************/
void WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
/********************************************************************************/
/* Prepare le menu PullUp affich par un click sur le bouton droit
......@@ -62,12 +62,12 @@ void WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
}
if( BlockActive )
return;
return true;
PopMenu->Append( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, _( "Delete Dcode items" ) );
if( DrawStruct == NULL )
return;
return true;
GetScreen()->SetCurItem( DrawStruct );
......@@ -90,4 +90,5 @@ void WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
}
PopMenu->AppendSeparator();
return true;
}
......@@ -90,7 +90,7 @@ public:
wxSize GetGrid();
void AddMenuZoom( wxMenu* MasterMenu );
void OnRightClick( wxMouseEvent& event );
bool OnRightClick( wxMouseEvent& event );
void Process_Popup_Zoom( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
......
......@@ -34,10 +34,8 @@
#define CHAIN 0x01 /* segment marque */
/* Flags pour les couches cuivres */
/* numero des couches particulieres */
#define LAYER_CUIVRE_N 0
#define CUIVRE_N 0
/* Layer identification (layer number) */
#define COPPER_LAYER_N 0
#define LAYER_N_2 1 /* Numero layer 2 */
#define LAYER_N_3 2 /* Numero layer 3 */
#define LAYER_N_4 3 /* Numero layer 4 */
......@@ -79,7 +77,7 @@
/*************************************/
/* constantes de gestion des couches */
/*************************************/
#define CUIVRE_LAYER (1<<LAYER_CUIVRE_N) ///< bit mask for copper layer
#define CUIVRE_LAYER (1<<COPPER_LAYER_N) ///< bit mask for copper layer
#define LAYER_2 (1<<LAYER_N_2) ///< bit mask for layer 2
#define LAYER_3 (1<<LAYER_N_3) ///< bit mask for layer 3
#define LAYER_4 (1<<LAYER_N_4) ///< bit mask for layer 4
......
......@@ -300,7 +300,7 @@ public:
virtual void Process_Special_Functions( wxCommandEvent& event ) = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars();
void Affiche_Status_Box(); /* Affichage des coord curseur, zoom .. */
......@@ -363,7 +363,7 @@ public:
virtual void ReCreateVToolbar() = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ReCreateMenuBar();
PCB_SCREEN* GetScreen() { return (PCB_SCREEN*) m_CurrentScreen; }
......@@ -614,7 +614,7 @@ public:
* @param aMousePos The current mouse position
* @param aPopMenu The menu to add to.
*/
void OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu );
bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
......@@ -822,7 +822,7 @@ public:
void ReCreateMenuBar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); // Retourne le meilleur zoom
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
......@@ -928,7 +928,7 @@ public:
void ReCreateAuxiliaryToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars();
void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event );
......@@ -1033,7 +1033,7 @@ public:
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
int BestZoom(); // Retourne le meilleur zoom
......@@ -1043,13 +1043,16 @@ public:
EDA_BaseStruct* SchematicGeneralLocateAndDisplay(
const wxPoint& refpoint,
bool IncludePin );
EDA_BaseStruct* FindComponentAndItem(
EDA_BaseStruct* FindComponentAndItem(
const wxString& component_reference, bool Find_in_hierarchy,
int SearchType,
const wxString& text_to_find,
bool mouseWarp );
/* Cross probing with pcbnew */
void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync );
/* netlist generation */
void* BuildNetListBase();
......@@ -1223,7 +1226,7 @@ public:
void ReCreateHToolbar();
void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); // Retourne le meilleur zoom
void SetToolbars();
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
......@@ -1344,7 +1347,7 @@ private:
void SelectAndViewLibraryPart( int option );
void ExportToSchematicLibraryPart( wxCommandEvent& event );
void ViewOneLibraryContent( LibraryStruct* Lib, int Flag );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
DECLARE_EVENT_TABLE()
};
......
......@@ -441,7 +441,7 @@ int WinEDA_PcbFrame::GenPlaceBoard()
Route_Layer_BOTTOM = CMP_N;
if( Nb_Sides == TWO_SIDES )
Route_Layer_BOTTOM = CUIVRE_N;
Route_Layer_BOTTOM = COPPER_LAYER_N;
Route_Layer_TOP = CMP_N;
/* Place the edge layer segments */
......@@ -538,7 +538,7 @@ void WinEDA_PcbFrame::GenModuleOnBoard( MODULE* Module )
masque_layer = 0;
if( Module->GetLayer() == CMP_N )
masque_layer = CMP_LAYER;
if( Module->GetLayer() == CUIVRE_N )
if( Module->GetLayer() == COPPER_LAYER_N )
masque_layer = CUIVRE_LAYER;
TraceFilledRectangle( m_Pcb, ox, oy, fx, fy, masque_layer,
......@@ -615,7 +615,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
{
D_PAD* Pad; int masque_otherlayer;
masque_otherlayer = CUIVRE_LAYER;
if( Module->GetLayer() == CUIVRE_N )
if( Module->GetLayer() == COPPER_LAYER_N )
masque_otherlayer = CMP_LAYER;
for( Pad = Module->m_Pads; Pad != NULL; Pad = (D_PAD*) Pad->Pnext )
......@@ -823,7 +823,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide )
int error, Penalite, marge, side, otherside;
side = TOP; otherside = BOTTOM;
if( Module->GetLayer() == CUIVRE_N )
if( Module->GetLayer() == COPPER_LAYER_N )
{
side = BOTTOM; otherside = TOP;
}
......
......@@ -27,9 +27,16 @@ D_PAD * Pad = NULL;
int autoroute_net_code = -1;
wxString msg;
Route_Layer_TOP = GetScreen()->m_Route_Layer_TOP;
Route_Layer_BOTTOM = GetScreen()->m_Route_Layer_BOTTOM;
if ( g_DesignSettings.m_CopperLayerCount > 1 )
{
Route_Layer_TOP = GetScreen()->m_Route_Layer_TOP;
Route_Layer_BOTTOM = GetScreen()->m_Route_Layer_BOTTOM;
}
else
{
Route_Layer_TOP =
Route_Layer_BOTTOM = COPPER_LAYER_N;
}
switch ( mode )
{
......
......@@ -24,25 +24,23 @@
BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame )
COMMON_EVENTS_DRAWFRAME
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection )
END_EVENT_TABLE()
COMMON_EVENTS_DRAWFRAME EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection )
END_EVENT_TABLE()
/****************/
/* Constructeur */
/****************/
WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
WinEDA_App* parent,
int idtype,
WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
WinEDA_App* parent,
int idtype,
const wxString& title,
const wxPoint& pos,
const wxSize& size ) :
const wxPoint& pos,
const wxSize& size ) :
WinEDA_DrawFrame( father, idtype, parent, title, pos, size )
{
m_InternalUnits = 10000; // Internal unit = 1/10000 inch
......@@ -56,8 +54,8 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
m_DisplayModText = FILLED; // How to show module texts
m_DisplayPcbTrackFill = TRUE; /* FALSE = sketch , TRUE = filled */
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_Collector = new GENERAL_COLLECTOR();
m_Collector = new GENERAL_COLLECTOR();
}
......@@ -98,6 +96,7 @@ int WinEDA_BasePcbFrame::BestZoom( void )
/*************************************************/
void WinEDA_BasePcbFrame::ReCreateMenuBar( void )
/*************************************************/
// Virtual function
{
}
......@@ -154,18 +153,19 @@ void WinEDA_BasePcbFrame::GetComponentFromRedoList( void )
/****************************************************************/
void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
/*****************************************************************/
//Note: virtual, overridden in WinEDA_PcbFrame;
{
int preslayer = GetScreen()->m_Active_Layer;
//if there is only one layer, don't switch.
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 )
layer = LAYER_CUIVRE_N; // Of course we select the copper layer
layer = COPPER_LAYER_N; // Of course we select the copper layer
//otherwise, we select the requested layer only if it is possible
if( layer != LAYER_CMP_N && layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
return;
if( preslayer == layer )
return;
......@@ -176,23 +176,27 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
}
/**********************************************************************/
void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event )
/**********************************************************************/
{
int id = event.GetId();
int id = event.GetId();
// index into the collector list:
int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START;
BOARD_ITEM* item = (*m_Collector)[itemNdx];
int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START;
if( (id >= ID_POPUP_PCB_ITEM_SELECTION_START)
&& (id <= ID_POPUP_PCB_ITEM_SELECTION_END) )
{
BOARD_ITEM* item = (*m_Collector)[itemNdx];
DrawPanel->m_AbortRequest = false;
#if defined(DEBUG)
item->Show( 0, std::cout );
#if defined (DEBUG)
item->Show( 0, std::cout );
#endif
SetCurItem( item );
SetCurItem( item );
}
}
......@@ -202,12 +206,12 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem )
{
m_CurrentScreen->SetCurItem( aItem );
if( aItem )
aItem->Display_Infos(this);
aItem->Display_Infos( this );
else
{
// we can use either of these:
//MsgPanel->EraseMsgBox();
m_Pcb->Display_Infos(this);
m_Pcb->Display_Infos( this );
}
}
......@@ -215,8 +219,8 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem )
/*****************************************************************/
BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem()
/*****************************************************************/
{
return (BOARD_ITEM*) m_CurrentScreen->GetCurItem();
{
return (BOARD_ITEM*) m_CurrentScreen->GetCurItem();
}
......@@ -224,8 +228,8 @@ BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem()
GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
/****************************************************************/
{
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->m_BoardSettings->GetVisibleLayers(),
GetScreen()->m_Active_Layer );
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->m_BoardSettings->GetVisibleLayers(),
GetScreen()->m_Active_Layer );
// account for the globals
guide.SetIgnoreMTextsMarkedNoShow( g_ModuleTextNOVColor & ITEM_NOT_SHOW );
......
......@@ -940,7 +940,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
/* Redessin du Texte */
INVERT( STRUCT->m_Pos.y );
INVERT_ANGLE( STRUCT->m_Orient );
if( (STRUCT->GetLayer() == CUIVRE_N) || (STRUCT->GetLayer() == CMP_N) )
if( (STRUCT->GetLayer() == COPPER_LAYER_N) || (STRUCT->GetLayer() == CMP_N) )
{
STRUCT->m_Miroir ^= 1; /* inverse miroir */
}
......
......@@ -646,7 +646,7 @@ const char* BOARD::ShowLayer( int aLayer )
switch( aLayer )
{
case LAYER_CUIVRE_N: rs = "cu"; break;
case LAYER_COPPER_LAYER_N: rs = "cu"; break;
case LAYER_N_2: rs = "layer2"; break;
case LAYER_N_3: rs = "layer3"; break;
case LAYER_N_4: rs = "layer4"; break;
......
......@@ -750,7 +750,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
else
DrawText->m_NoShow = 0;
if( layer == CUIVRE_N )
if( layer == COPPER_LAYER_N )
layer = SILKSCREEN_N_CU;
else if( layer == CMP_N )
layer = SILKSCREEN_N_CMP;
......
......@@ -99,8 +99,8 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum )
{
sscanf( Line + 2, " %d %d %lX %d\n", &m_Layer, &m_Miroir,
&m_TimeStamp, &dummy );
if( m_Layer < LAYER_CUIVRE_N )
m_Layer = LAYER_CUIVRE_N;
if( m_Layer < COPPER_LAYER_N )
m_Layer = COPPER_LAYER_N;
if( m_Layer > LAST_NO_COPPER_LAYER )
m_Layer = LAST_NO_COPPER_LAYER;
......
......@@ -49,7 +49,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
int moduleLayer = Module->GetLayer();
if( moduleLayer == CUIVRE_N )
if( moduleLayer == COPPER_LAYER_N )
SetLayer( SILKSCREEN_N_CU );
else if( moduleLayer == CMP_N )
SetLayer( SILKSCREEN_N_CMP );
......@@ -58,7 +58,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) :
if( moduleLayer == SILKSCREEN_N_CU
|| moduleLayer == ADHESIVE_N_CU
|| moduleLayer == CUIVRE_N )
|| moduleLayer == COPPER_LAYER_N )
{
m_Miroir = 0;
}
......@@ -257,7 +257,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, wxPoint offset, int
color = g_DesignSettings.m_LayerColor[Module->GetLayer()];
if( Module && Module->GetLayer() == CUIVRE_N )
if( Module && Module->GetLayer() == COPPER_LAYER_N )
color = g_ModuleTextCUColor;
else if( Module && Module->GetLayer() == CMP_N )
......@@ -381,7 +381,7 @@ bool TEXTE_MODULE::IsOnLayer( int aLayer ) const
if( aLayer == GetParent()->GetLayer() )
return true;
if( aLayer == CUIVRE_N )
if( aLayer == COPPER_LAYER_N )
{
if( m_Layer==ADHESIVE_N_CU || m_Layer==SILKSCREEN_N_CU )
return true;
......
......@@ -253,7 +253,7 @@ void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
if( via_type == VIA_NORMALE )
{
top_layer = LAYER_CMP_N;
bottom_layer = LAYER_CUIVRE_N;
bottom_layer = COPPER_LAYER_N;
}
if( bottom_layer > top_layer )
......@@ -263,9 +263,9 @@ void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
}
/***************************************************************/
/*********************************************************************/
void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const
/***************************************************************/
/*********************************************************************/
/* Retourne les 2 couches limitant la via
* les pointeurs top_layer et bottom_layer peuvent etre NULLs
......
......@@ -360,9 +360,9 @@ void PCB_SCREEN::Init()
/*************************/
{
InitDatas();
m_Active_Layer = CUIVRE_N; /* ref couche active 0.. 31 */
m_Active_Layer = COPPER_LAYER_N; /* ref couche active 0.. 31 */
m_Route_Layer_TOP = CMP_N; /* ref couches par defaut pour vias (Cu.. Cmp) */
m_Route_Layer_BOTTOM = CUIVRE_N;
m_Route_Layer_BOTTOM = COPPER_LAYER_N;
m_Zoom = 128; /* valeur */
m_Grid = wxSize( 500, 500 ); /* pas de la grille en 1/10000 "*/
}
......
......@@ -82,7 +82,7 @@ void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
if( via_type == VIA_NORMALE )
{
top_layer = LAYER_CMP_N; bottom_layer = LAYER_CUIVRE_N;
top_layer = LAYER_CMP_N; bottom_layer = LAYER_COPPER_LAYER_N;
}
if( bottom_layer > top_layer )
......
......@@ -205,7 +205,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
if( module )
{
if( m_Guide->IgnoreMTextsOnCopper() && module->GetLayer()==LAYER_CUIVRE_N )
if( m_Guide->IgnoreMTextsOnCopper() && module->GetLayer()==COPPER_LAYER_N )
goto exit;
if( m_Guide->IgnoreMTextsOnCmp() && module->GetLayer()==LAYER_CMP_N )
......@@ -225,7 +225,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
if( module ) // true from case TYPEPAD, TYPETEXTEMODULE, or TYPEMODULE
{
if( m_Guide->IgnoreModulesOnCu() && module->GetLayer()==LAYER_CUIVRE_N )
if( m_Guide->IgnoreModulesOnCu() && module->GetLayer()==COPPER_LAYER_N )
goto exit;
if( m_Guide->IgnoreModulesOnCmp() && module->GetLayer()==LAYER_CMP_N )
......
......@@ -70,7 +70,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
// Assign to scanList the proper item types desired based on tool type
// or hotkey that is in play.
const KICAD_T* scanList;
const KICAD_T* scanList = NULL;
if( aHotKeyCode )
{
......@@ -170,7 +170,16 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
{
wxMenu itemMenu;
itemMenu.SetTitle( _( "Selection Clarification" ) ); // does this work? not under Linux!
/* Give a title to the selection menu. This is also a cancel menu item */
wxMenuItem * item_title = new wxMenuItem(&itemMenu, -1, _( "Selection Clarification" ) );
#ifdef __WINDOWS__
wxFont bold_font(*wxNORMAL_FONT);
bold_font.SetWeight(wxFONTWEIGHT_BOLD);
bold_font.SetStyle( wxFONTSTYLE_ITALIC);
item_title->SetFont(bold_font);
#endif
itemMenu.Append(item_title);
itemMenu.AppendSeparator();
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
......@@ -197,7 +206,8 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
// and it calls SetCurItem() which in turn calls Display_Infos() on the item.
PopupMenu( &itemMenu );
DrawPanel->m_AbortRequest = true; // changed in false if an item
PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected
DrawPanel->MouseToCursorSchema();
......
......@@ -25,7 +25,7 @@ void RemoteCommand( const char* cmdline )
* @param cmdline = received command from eeschema
* Commands are
* $PART: "reference" put cursor on component
* $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
* $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
*/
{
char line[1024];
......@@ -119,11 +119,12 @@ void RemoteCommand( const char* cmdline )
/**************************************************************************/
void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
/**************************************************************************/
/** Send a remote command to eeschema via a socket,
* @param objectToSync = item to be located on schematic (module, pin or text)
* Commands are
* $PART: "reference" put cursor on component anchor
* $PART: "reference" $PAD: "pad number" put cursor on the component pin
* $PART: "reference" $PAD: "pad number" put cursor on the component pin
* $PART: "reference" $REF: "reference" put cursor on the component ref
* $PART: "reference" $VAL: "value" put cursor on the component value
*/
......@@ -182,4 +183,3 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
SendCommand( MSG_TO_SCH, cmd );
}
}
......@@ -233,7 +233,7 @@ void WinEDA_ModulePropertiesFrame::BuildPanelModuleProperties( bool FullOptions
wxString layer_list[2] = { _( "Component" ), _( "Copper" ) };
m_LayerCtrl = new wxRadioBox( m_PanelProperties, -1, _( "Layer" ), wxDefaultPosition,
wxSize( -1, -1 ), 2, layer_list, 1 );
m_LayerCtrl->SetSelection( (m_CurrentModule->GetLayer() == CUIVRE_N) ? 1 : 0 );
m_LayerCtrl->SetSelection( (m_CurrentModule->GetLayer() == COPPER_LAYER_N) ? 1 : 0 );
PropLeftSizer->Add( m_LayerCtrl, 0, wxGROW | wxALL, 5 );
bool select = FALSE;
......@@ -515,7 +515,7 @@ void WinEDA_ModulePropertiesFrame::OnOkClick( wxCommandEvent& event )
{
if( m_LayerCtrl->GetSelection() == 0 ) // layer req = COMPONENT
{
if( m_CurrentModule->GetLayer() == CUIVRE_N )
if( m_CurrentModule->GetLayer() == COPPER_LAYER_N )
change_layer = TRUE;
}
else if( m_CurrentModule->GetLayer() == CMP_N )
......
......@@ -194,11 +194,11 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC )
/* Ask for the new layer */
new_layer = SelectLayer( new_layer, LAYER_CUIVRE_N, LAST_NO_COPPER_LAYER );
new_layer = SelectLayer( new_layer, COPPER_LAYER_N, LAST_NO_COPPER_LAYER );
if( new_layer < 0 )
return;
if ( new_layer >= LAYER_CUIVRE_N && new_layer <= LAYER_CMP_N )
if ( new_layer >= COPPER_LAYER_N && new_layer <= LAYER_CMP_N )
/* an edge is put on a copper layer, and it is very dangerous. a confirmation is requested */
{
if ( ! IsOK(this, _("The graphic item will be on a copper layer.It is very dangerous. Are you sure") ) )
......@@ -364,7 +364,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge->SetLayer( Module->GetLayer() );
if( Module->GetLayer() == CMP_N )
Edge->SetLayer( SILKSCREEN_N_CMP );
if( Module->GetLayer() == CUIVRE_N )
if( Module->GetLayer() == COPPER_LAYER_N )
Edge->SetLayer( SILKSCREEN_N_CU );
/* Initialise the starting point of the new segment or arc */
Edge->m_Start = GetScreen()->m_Curseur;
......
......@@ -551,8 +551,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DRAG_PAD_REQUEST:
g_Drag_Pistes_On = TRUE;
DrawPanel->MouseToCursorSchema();
StartMovePad( (D_PAD*) GetCurItem(), &dc );
break;
case ID_POPUP_PCB_MOVE_PAD_REQUEST:
g_Drag_Pistes_On = false;
DrawPanel->MouseToCursorSchema();
StartMovePad( (D_PAD*) GetCurItem(), &dc );
break;
......@@ -982,8 +986,8 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 )
return;
//otherwise, must be at least 2 layers..see if it is possible.
if( layer == LAYER_CUIVRE_N || layer == LAYER_CMP_N
//otherwise, must be at least 2 layers. see if it is possible.
if( layer == COPPER_LAYER_N || layer == LAYER_CMP_N
|| layer < m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
{
if( preslayer == layer )
......
......@@ -246,7 +246,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
else
{
// Usual via is from copper to component; layer pair is 0 and 0x0F.
Via->SetLayerPair( LAYER_CUIVRE_N, LAYER_CMP_N );
Via->SetLayerPair( COPPER_LAYER_N, LAYER_CMP_N );
}
if( Drc_On &&( Drc( this, DC, Via, m_Pcb->m_Track, 1 ) == BAD_DRC ) )
......
......@@ -101,7 +101,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
for( module = m_Pcb->m_Modules; module != NULL; module = module->Next() )
{
module->flag = 0;
if( module->GetLayer() == CUIVRE_N )
if( module->GetLayer() == COPPER_LAYER_N )
{
Change_Side_Module( module, NULL );
module->flag = 1;
......
......@@ -66,7 +66,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
continue;
if( (Module->m_Attributs & MOD_CMS) == 0 )
continue;
if( Module->GetLayer() == CUIVRE_N )
if( Module->GetLayer() == COPPER_LAYER_N )
GenCu = TRUE;
NbMod++;
}
......@@ -193,7 +193,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
strcat( Line, "Cmp.\n" );
fputs( Line, LayerCmp );
}
else if( Liste[ii].m_Module->GetLayer() == CUIVRE_N )
else if( Liste[ii].m_Module->GetLayer() == COPPER_LAYER_N )
{
strcat( Line, "Cu\n" );
fputs( Line, LayerCu );
......@@ -317,7 +317,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
sprintf( Line, "orientation %.2f\n", (float) Module->m_Orient / 10 );
if( Module->GetLayer() == CMP_N )
strcat( Line, "layer component\n" );
else if( Module->GetLayer() == CUIVRE_N )
else if( Module->GetLayer() == COPPER_LAYER_N )
strcat( Line, "layer copper\n" );
else
strcat( Line, "layer other\n" );
......
......@@ -204,13 +204,13 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
ll = GetScreen()->m_Active_Layer;
if( ll > CMP_N )
break;
if( ll <= CUIVRE_N )
if( ll <= COPPER_LAYER_N )
break;
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 ) // Single layer
ll = CUIVRE_N;
ll = COPPER_LAYER_N;
if( ll == CMP_N )
ll = MAX( CUIVRE_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
else if( ll > CUIVRE_N )
ll = MAX( COPPER_LAYER_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
else if( ll > COPPER_LAYER_N )
ll--;
SwitchLayer( DC, ll );
break;
......@@ -223,7 +223,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
ll = CMP_N;
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 ) // Single layer
ll = CUIVRE_N;
ll = COPPER_LAYER_N;
SwitchLayer( DC, ll );
break;
......@@ -232,7 +232,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_SWITCH_LAYER_TO_COPPER:
SwitchLayer( DC, CUIVRE_N );
SwitchLayer( DC, COPPER_LAYER_N );
break;
case HK_SWITCH_LAYER_TO_INNER1:
......
......@@ -176,7 +176,7 @@ static void Plot_Module( WinEDA_DrawPanel* panel, wxDC* DC,
/* draw footprint graphic shapes */
PtStruct = Module->m_Drawings;
mlayer = g_TabOneLayerMask[Module->GetLayer()];
if( Module->GetLayer() == CUIVRE_N )
if( Module->GetLayer() == COPPER_LAYER_N )
mlayer = SILKSCREEN_LAYER_CU;
else if( Module->GetLayer() == CMP_N )
mlayer = SILKSCREEN_LAYER_CMP;
......
......@@ -164,7 +164,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
// Priority to the active layer (component or copper).
// This is useful for small smd components when 2 texts overlap but are not
// on the same layer
if( LayerSearch == LAYER_CUIVRE_N || LayerSearch == CMP_N )
if( LayerSearch == COPPER_LAYER_N || LayerSearch == LAYER_CMP_N )
{
MODULE* module = m_Pcb->m_Modules;
for( ; module != NULL; module = (MODULE*) module->Pnext )
......@@ -525,7 +525,7 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
layer = pt_module->GetLayer();
if( layer==ADHESIVE_N_CU || layer==SILKSCREEN_N_CU )
layer = CUIVRE_N;
layer = COPPER_LAYER_N;
else if( layer==ADHESIVE_N_CMP || layer==SILKSCREEN_N_CMP )
layer = CMP_N;
......@@ -605,7 +605,7 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
{
int layer = module->GetLayer();
if( layer==ADHESIVE_N_CU || layer==SILKSCREEN_N_CU )
layer = CUIVRE_N;
layer = COPPER_LAYER_N;
else if( layer==ADHESIVE_N_CMP || layer==SILKSCREEN_N_CMP )
layer = CMP_N;
......
......@@ -173,7 +173,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/*********************************************************************/
void WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
/*********************************************************************/
......@@ -238,7 +238,7 @@ void WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
}
if( DrawStruct == NULL )
return;
return true;
int flags = DrawStruct->m_Flags;
......@@ -367,6 +367,8 @@ void WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
_( "Set Width" ), width_segment_xpm );
PopMenu->AppendSeparator();
}
return true;
}
......
......@@ -337,7 +337,7 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
if( Module == NULL )
return;
if( (Module->GetLayer() != CMP_N) && (Module->GetLayer() != CUIVRE_N) )
if( (Module->GetLayer() != CMP_N) && (Module->GetLayer() != COPPER_LAYER_N) )
return;
m_CurrentScreen->SetModify();
......@@ -400,14 +400,14 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->SetLayer( Module->GetLayer() );
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
if( Module->GetLayer() == CUIVRE_N )
if( Module->GetLayer() == COPPER_LAYER_N )
pt_texte->SetLayer( SILKSCREEN_N_CU );
if( Module->GetLayer() == CMP_N )
pt_texte->SetLayer( SILKSCREEN_N_CMP );
if( (Module->GetLayer() == SILKSCREEN_N_CU)
|| (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == CUIVRE_N) )
|| (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == COPPER_LAYER_N) )
pt_texte->m_Miroir = 0;
/* Inversion miroir de la Valeur et mise en miroir : */
......@@ -421,14 +421,14 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->SetLayer( Module->GetLayer() );
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
if( Module->GetLayer() == CUIVRE_N )
if( Module->GetLayer() == COPPER_LAYER_N )
pt_texte->SetLayer( SILKSCREEN_N_CU );
if( Module->GetLayer() == CMP_N )
pt_texte->SetLayer( SILKSCREEN_N_CMP );
if( (Module->GetLayer() == SILKSCREEN_N_CU)
|| (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == CUIVRE_N) )
|| (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == COPPER_LAYER_N) )
pt_texte->m_Miroir = 0;
/* Inversion miroir des dessins de l'empreinte : */
......@@ -469,7 +469,7 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
pt_texte->SetLayer( Module->GetLayer() );
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
if( Module->GetLayer() == CUIVRE_N )
if( Module->GetLayer() == COPPER_LAYER_N )
pt_texte->SetLayer( SILKSCREEN_N_CU );
if( Module->GetLayer() == CMP_N )
......@@ -477,7 +477,7 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
if( Module->GetLayer() == SILKSCREEN_N_CU
|| Module->GetLayer() == ADHESIVE_N_CU
|| Module->GetLayer() == CUIVRE_N )
|| Module->GetLayer() == COPPER_LAYER_N )
{
pt_texte->m_Miroir = 0;
}
......@@ -580,11 +580,11 @@ int ChangeSideNumLayer( int oldlayer )
switch( oldlayer )
{
case CUIVRE_N:
case COPPER_LAYER_N:
newlayer = CMP_N; break;
case CMP_N:
newlayer = CUIVRE_N; break;
newlayer = COPPER_LAYER_N; break;
case SILKSCREEN_N_CU:
newlayer = SILKSCREEN_N_CMP; break;
......
......@@ -287,8 +287,11 @@ MODULE * Module;
Pad->m_Flags |= IS_MOVED;
Pad->Draw(DrawPanel, DC, wxPoint(0,0),GR_XOR);
/* Build the list of track segments to drag */
Build_1_Pad_SegmentsToDrag(DrawPanel, DC, Pad);
/* Build the list of track segments to drag if the command is a drag pad*/
if ( g_Drag_Pistes_On )
Build_1_Pad_SegmentsToDrag(DrawPanel, DC, Pad);
else EraseDragListe();
}
......
......@@ -108,13 +108,13 @@ static wxMenu* Append_Track_Width_List()
/******************************************************************************/
void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
/******************************************************************************/
{
wxString msg;
int flags = 0;
bool locate_track = FALSE;
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
wxString msg;
int flags = 0;
bool locate_track = FALSE;
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
wxClientDC dc( DrawPanel );
......@@ -122,15 +122,16 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu
// If command or block in progress: Put the Cancel command (if needed) and the End command
if( BlockActive )
{
createPopUpBlockMenu( aPopMenu );
// If a command or a block is in progress:
// Put the Cancel command (if needed) and the End command
if( BlockActive )
{
createPopUpBlockMenu( aPopMenu );
aPopMenu->AppendSeparator();
return;
}
return true;
}
DrawPanel->CursorOff( &dc );
......@@ -152,8 +153,8 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
{
if( item && item->m_Flags )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm );
aPopMenu->AppendSeparator();
}
}
......@@ -162,7 +163,14 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
/* Select a proper item */
if( !item || !item->m_Flags )
{
DrawPanel->m_AbortRequest = false;
item = PcbGeneralLocateAndDisplay();
if( DrawPanel->m_AbortRequest )
{
DrawPanel->CursorOn( &dc );
return false;
}
SetCurItem( item );
}
......@@ -182,20 +190,24 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE )
{
aPopMenu->AppendSeparator();
if( !((MODULE*)item)->IsLocked() )
if( !( (MODULE*) item )->IsLocked() )
{
msg = AddHotkeyName( _( "Lock Module" ), s_Board_Editor_Hokeys_Descr, HK_LOCK_UNLOCK_FOOTPRINT );
msg = AddHotkeyName( _(
"Lock Module" ), s_Board_Editor_Hokeys_Descr,
HK_LOCK_UNLOCK_FOOTPRINT );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, msg,
Locked_xpm );
}
else
{
msg = AddHotkeyName( _( "Unlock Module" ), s_Board_Editor_Hokeys_Descr, HK_LOCK_UNLOCK_FOOTPRINT );
msg = AddHotkeyName( _(
"Unlock Module" ), s_Board_Editor_Hokeys_Descr,
HK_LOCK_UNLOCK_FOOTPRINT );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, msg,
Unlocked_xpm );
}
if( !flags )
aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE,
_( "Auto place Module" ) );
......@@ -430,6 +442,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
}
DrawPanel->CursorOn( &dc );
return true;
}
......
......@@ -147,7 +147,7 @@ bool inline IsModuleLayerVisible( int layer )
if( layer==CMP_N )
return DisplayOpt.Show_Modules_Cmp;
else if( layer==CUIVRE_N )
else if( layer==COPPER_LAYER_N )
return DisplayOpt.Show_Modules_Cu;
else
......
......@@ -351,7 +351,7 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
TextePcb->m_Flags = IS_NEW;
TextePcb->SetLayer( GetScreen()->m_Active_Layer );
TextePcb->m_Miroir = 1;
if( TextePcb->GetLayer() == CUIVRE_N )
if( TextePcb->GetLayer() == COPPER_LAYER_N )
TextePcb->m_Miroir = 0;
TextePcb->m_Size = g_DesignSettings.m_PcbTextSize;
......
......@@ -94,7 +94,7 @@ int tracevia = 1;
switch(Layer)
{
case CUIVRE_N :
case COPPER_LAYER_N :
case LAYER_N_2 :
case LAYER_N_3 :
case LAYER_N_4 :
......
......@@ -136,7 +136,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
switch( Layer )
{
case CUIVRE_N:
case COPPER_LAYER_N:
case LAYER_N_2:
case LAYER_N_3:
case LAYER_N_4:
......
......@@ -178,7 +178,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer )
Plot_Layer_PS( dest, layer_mask, 0, 1, modetrace );
break;
case CUIVRE_N:
case COPPER_LAYER_N:
case LAYER_N_2:
case LAYER_N_3:
case LAYER_N_4:
......
......@@ -392,7 +392,7 @@ static void GenExistantTracks( BOARD* Pcb, FILE* outfile,
else
via_max_layer++;
if( via_min_layer == CUIVRE_N )
if( via_min_layer == COPPER_LAYER_N )
via_min_layer = min_layer;
else
via_min_layer++;
......@@ -615,7 +615,7 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC )
case 'T': // Track list start: fmt = T image layer t_count
sscanf( Line + 2, "%d %d %d", &image, &track_layer, &track_count );
track_layer--;
if( (track_layer != CUIVRE_N) && (track_layer == max_layer - 1) )
if( (track_layer != COPPER_LAYER_N) && (track_layer == max_layer - 1) )
track_layer = CMP_N;
// Read corners: fmt = C x_pos y_pos
......
......@@ -53,8 +53,8 @@ static ColorButton Msg_Layers_Cu =
static ColorButton Layer_1_Butt =
{
wxEmptyString,
CUIVRE_N, /* Title */
ADR( CUIVRE_N ), /* adr du parametre optionnel */
COPPER_LAYER_N, /* Title */
ADR( COPPER_LAYER_N ), /* adr du parametre optionnel */
TRUE // toggle bit ITEM_NOT_SHOW of the color variable
};
......
......@@ -129,7 +129,7 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
}
if( !DisplayOpt.Show_Modules_Cu )
{
if( Module->GetLayer() == CUIVRE_N )
if( Module->GetLayer() == COPPER_LAYER_N )
display = FALSE;
MaskLay &= ~CUIVRE_LAYER;
}
......
......@@ -688,10 +688,11 @@ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode )
/*******************************************************/
void WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
/*******************************************************/
/* Build and display a Popup menu on a right mouse button click
/** Build and display a Popup menu on a right mouse button click
* @return true if a popup menu is shown, or false
*/
{
wxPoint pos;
......@@ -700,7 +701,8 @@ void WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
pos.x = event.GetX();
pos.y = event.GetY();
m_Parent->OnRightClick( pos, &MasterMenu );
if ( ! m_Parent->OnRightClick( pos, &MasterMenu ) )
return false;
AddMenuZoom( &MasterMenu );
......@@ -708,6 +710,8 @@ void WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
PopupMenu( &MasterMenu, pos );
MouseToCursorSchema();
m_IgnoreMouseEvents = FALSE;
return true;
}
......
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