From 1f842ae14c2ceb5368b52f550f650aa13251538f Mon Sep 17 00:00:00 2001 From: CHARRAS Date: Sun, 7 Oct 2007 18:24:15 +0000 Subject: [PATCH] bug in move pad fixed (could crash pcbnew).Other minor changes --- 3d-viewer/3d_draw.cpp | 38 ++++---- change_log.txt | 15 ++++ cvpcb/cvstruct.h | 2 +- cvpcb/displayframe.cpp | 9 +- eeschema/controle.cpp | 94 +------------------- eeschema/cross-probing.cpp | 142 ++++++++++++++++++++++++++++++ eeschema/libedit_onrightclick.cpp | 7 +- eeschema/makefile.include | 1 + eeschema/onrightclick.cpp | 7 +- eeschema/viewlibs.cpp | 3 +- gerbview/onrightclick.cpp | 7 +- include/drawpanel_wxstruct.h | 2 +- include/pcbstruct.h | 8 +- include/wxstruct.h | 23 ++--- pcbnew/autoplac.cpp | 8 +- pcbnew/autorout.cpp | 13 ++- pcbnew/basepcbframe.cpp | 70 ++++++++------- pcbnew/block.cpp | 2 +- pcbnew/class_board.cpp | 2 +- pcbnew/class_module.cpp | 2 +- pcbnew/class_pcb_text.cpp | 4 +- pcbnew/class_text_mod.cpp | 8 +- pcbnew/class_track.cpp | 6 +- pcbnew/classpcb.cpp | 4 +- pcbnew/classtrc.cpp.notused | 2 +- pcbnew/collectors.cpp | 4 +- pcbnew/controle.cpp | 16 +++- pcbnew/cross-probing.cpp | 6 +- pcbnew/dialog_edit_module.cpp | 4 +- pcbnew/edgemod.cpp | 6 +- pcbnew/edit.cpp | 8 +- pcbnew/editrack-part2.cpp | 2 +- pcbnew/export_gencad.cpp | 2 +- pcbnew/gen_modules_placefile.cpp | 6 +- pcbnew/hotkeys.cpp | 12 +-- pcbnew/lay2plot.cpp | 2 +- pcbnew/locate.cpp | 6 +- pcbnew/modedit_onclick.cpp | 6 +- pcbnew/modules.cpp | 18 ++-- pcbnew/move-drag_pads.cpp | 7 +- pcbnew/onrightclick.cpp | 51 +++++++---- pcbnew/pcbnew.h | 2 +- pcbnew/pcbtexte.cpp | 2 +- pcbnew/plotgerb.cpp | 2 +- pcbnew/plothpgl.cpp | 2 +- pcbnew/plotps.cpp | 2 +- pcbnew/router.cpp | 4 +- pcbnew/set_color.cpp | 4 +- pcbnew/tracepcb.cpp | 2 +- share/drawpanel.cpp | 10 ++- 50 files changed, 397 insertions(+), 268 deletions(-) create mode 100644 eeschema/cross-probing.cpp diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 774d999f9a..8536410b10 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -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]; diff --git a/change_log.txt b/change_log.txt index 409e98c536..bcdfc2cc3d 100644 --- a/change_log.txt +++ b/change_log.txt @@ -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 +================================================================================ ++ 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 ================================================================================ + all diff --git a/cvpcb/cvstruct.h b/cvpcb/cvstruct.h index de16b61312..8f331f992d 100644 --- a/cvpcb/cvstruct.h +++ b/cvpcb/cvstruct.h @@ -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); diff --git a/cvpcb/displayframe.cpp b/cvpcb/displayframe.cpp index 541c74ba2e..50b67902cb 100644 --- a/cvpcb/displayframe.cpp +++ b/cvpcb/displayframe.cpp @@ -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; } diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 6c7790fa53..69da69e477 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -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; } diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp new file mode 100644 index 0000000000..565c49bbb3 --- /dev/null +++ b/eeschema/cross-probing.cpp @@ -0,0 +1,142 @@ +/*********************/ +/* 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; + } +} diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp index 30ab8610eb..d5f0354611 100644 --- a/eeschema/libedit_onrightclick.cpp +++ b/eeschema/libedit_onrightclick.cpp @@ -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; } /**********************************************************************************/ diff --git a/eeschema/makefile.include b/eeschema/makefile.include index 306713307c..afab664f3e 100644 --- a/eeschema/makefile.include +++ b/eeschema/makefile.include @@ -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\ diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 0945ce6c48..ecaacfbc00 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -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; } diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp index de4a3fa3dd..8833cd39fe 100644 --- a/eeschema/viewlibs.cpp +++ b/eeschema/viewlibs.cpp @@ -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; } diff --git a/gerbview/onrightclick.cpp b/gerbview/onrightclick.cpp index 3f841c19eb..fe55ef47ac 100644 --- a/gerbview/onrightclick.cpp +++ b/gerbview/onrightclick.cpp @@ -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; } diff --git a/include/drawpanel_wxstruct.h b/include/drawpanel_wxstruct.h index 5b822565cb..588489178f 100644 --- a/include/drawpanel_wxstruct.h +++ b/include/drawpanel_wxstruct.h @@ -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 ); diff --git a/include/pcbstruct.h b/include/pcbstruct.h index ee0f050b6d..8d4b231918 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -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<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; } diff --git a/pcbnew/autorout.cpp b/pcbnew/autorout.cpp index dfe83101da..3b34960089 100644 --- a/pcbnew/autorout.cpp +++ b/pcbnew/autorout.cpp @@ -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 ) { diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index c255015974..9c19160c9c 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -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(); - - // index into the collector list: - int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START; - - BOARD_ITEM* item = (*m_Collector)[itemNdx]; + int id = event.GetId(); -#if defined(DEBUG) - item->Show( 0, std::cout ); + // index into the collector list: + 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 ); #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 ); diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index dfa17fd8c0..68ca7a8c7f 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -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 */ } diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 059c37d737..582a208e86 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -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; diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 473e380ca1..32c0f22072 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -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; diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 1c86e2a02d..7165a554c1 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -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; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index ce6b6dbc2a..097bea5cf8 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -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; diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 93834a4068..3f3481faf3 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -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 diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp index 8c6006340a..f2610e86a1 100644 --- a/pcbnew/classpcb.cpp +++ b/pcbnew/classpcb.cpp @@ -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 "*/ } diff --git a/pcbnew/classtrc.cpp.notused b/pcbnew/classtrc.cpp.notused index 7e1a901929..784b540d58 100644 --- a/pcbnew/classtrc.cpp.notused +++ b/pcbnew/classtrc.cpp.notused @@ -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 ) diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index 45006d42e2..b88e926711 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -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 ) diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index 279eeb0428..07dad843de 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -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(); diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 208c865cff..fe56a5c08f 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -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 ); } } - diff --git a/pcbnew/dialog_edit_module.cpp b/pcbnew/dialog_edit_module.cpp index 2d7907157a..a56009f32d 100644 --- a/pcbnew/dialog_edit_module.cpp +++ b/pcbnew/dialog_edit_module.cpp @@ -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 ) diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index fbd9d3e682..aba263a7a7 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -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; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 11c9977abe..7d1d1f41e2 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -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 ) diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index b3f7e890ef..5171130793 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -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 ) ) diff --git a/pcbnew/export_gencad.cpp b/pcbnew/export_gencad.cpp index 88419b7406..87fb82f13f 100644 --- a/pcbnew/export_gencad.cpp +++ b/pcbnew/export_gencad.cpp @@ -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; diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index 745f4e05e7..ca6793dc56 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -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" ); diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index f7ba518aba..648dd4c52e 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -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: diff --git a/pcbnew/lay2plot.cpp b/pcbnew/lay2plot.cpp index bf759208d4..6c21a55e35 100644 --- a/pcbnew/lay2plot.cpp +++ b/pcbnew/lay2plot.cpp @@ -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; diff --git a/pcbnew/locate.cpp b/pcbnew/locate.cpp index 492a4dfd8b..413a0fdd18 100644 --- a/pcbnew/locate.cpp +++ b/pcbnew/locate.cpp @@ -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; diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index e12f10652b..aa84095f9e 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -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; } diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 6a2813546c..06f62c3cad 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -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; diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp index ceeea0f577..5b5bd428d0 100644 --- a/pcbnew/move-drag_pads.cpp +++ b/pcbnew/move-drag_pads.cpp @@ -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(); + } diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 5506994148..71a3ad8552 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -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; } diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index 8b8145d97b..e1b68f984c 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -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 diff --git a/pcbnew/pcbtexte.cpp b/pcbnew/pcbtexte.cpp index b6dea71e91..d897f1a5ba 100644 --- a/pcbnew/pcbtexte.cpp +++ b/pcbnew/pcbtexte.cpp @@ -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; diff --git a/pcbnew/plotgerb.cpp b/pcbnew/plotgerb.cpp index 007bad0f55..abf391bafc 100644 --- a/pcbnew/plotgerb.cpp +++ b/pcbnew/plotgerb.cpp @@ -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 : diff --git a/pcbnew/plothpgl.cpp b/pcbnew/plothpgl.cpp index 9dc2dbc2d0..6c979ae39b 100644 --- a/pcbnew/plothpgl.cpp +++ b/pcbnew/plothpgl.cpp @@ -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: diff --git a/pcbnew/plotps.cpp b/pcbnew/plotps.cpp index 1cb8827265..97cb1b0337 100644 --- a/pcbnew/plotps.cpp +++ b/pcbnew/plotps.cpp @@ -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: diff --git a/pcbnew/router.cpp b/pcbnew/router.cpp index cfb02ba11e..ea55bf220a 100644 --- a/pcbnew/router.cpp +++ b/pcbnew/router.cpp @@ -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 diff --git a/pcbnew/set_color.cpp b/pcbnew/set_color.cpp index a0f74b33f2..df3bc93cb7 100644 --- a/pcbnew/set_color.cpp +++ b/pcbnew/set_color.cpp @@ -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 }; diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index a53d332365..7b054c1480 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -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; } diff --git a/share/drawpanel.cpp b/share/drawpanel.cpp index 36e3edf713..43a08762a1 100644 --- a/share/drawpanel.cpp +++ b/share/drawpanel.cpp @@ -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; }