Commit ef3d0491 authored by dickelbeck's avatar dickelbeck

see change_log.txt 2007-Sep-14 UPDATE

parent cd81e546
...@@ -10,7 +10,15 @@ email address. ...@@ -10,7 +10,15 @@ email address.
+ pcbnew + pcbnew
* controle.cpp, added Function AllAreModulesAndReturnSmallestIfSo() which is * controle.cpp, added Function AllAreModulesAndReturnSmallestIfSo() which is
called from PcbGeneralLocateAndDisplay() called from PcbGeneralLocateAndDisplay()
* onrightclick.cpp changed to calls to BOARD_ITEM::MenuText() * onrightclick.cpp changed to calls to BOARD_ITEM::MenuText(), and switched
to member functions for createPopupMenus() so we can get all the state
information we need for the proper menus.
* BOARD_ITEM::MenuText() got new argument BOARD*, and elaboration for
TRACKs and VIAs and Pcb Graphics.
* Fixed a problem in GENERAL_COLLECTOR::Inspect() so it now knows that MODULEs
have their own visibility controls (same for pads and pcb texts). This
interpretation must always match the drawing code's interpretation.
* Made TRACK::TRACK( const TRACK& ) protected to enforce use of TRACK::Copy()
2007-Sep-13 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Sep-13 UPDATE Dick Hollenbeck <dick@softplc.com>
......
...@@ -53,7 +53,8 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, ...@@ -53,7 +53,8 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
{ {
WinEDA_ComponentPropertiesFrame* frame = WinEDA_ComponentPropertiesFrame* frame =
new WinEDA_ComponentPropertiesFrame( parent, cmp ); new WinEDA_ComponentPropertiesFrame( parent, cmp );
frame->ShowModal(); frame->Destroy(); frame->ShowModal();
frame->Destroy();
} }
parent->DrawPanel->MouseToCursorSchema(); parent->DrawPanel->MouseToCursorSchema();
......
...@@ -125,7 +125,8 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, ...@@ -125,7 +125,8 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
{ {
WinEDA_ComponentPropertiesFrame* frame = WinEDA_ComponentPropertiesFrame* frame =
new WinEDA_ComponentPropertiesFrame( parent, pos, cmp ); new WinEDA_ComponentPropertiesFrame( parent, pos, cmp );
frame->ShowModal(); frame->Destroy(); frame->ShowModal();
frame->Destroy();
} }
parent->DrawPanel->m_IgnoreMouseEvents = FALSE; parent->DrawPanel->m_IgnoreMouseEvents = FALSE;
} }
......
...@@ -341,7 +341,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -341,7 +341,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
} }
/* If the struct found is a DRAW_LIB_ITEM_STRUCT_TYPE type, /* If the struct found is a DRAW_LIB_ITEM_STRUCT_TYPE type,
* coordinates must be computed according to its orientation matrix * coordinates must be computed according to its orientation matrix
*/ */
if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
...@@ -519,7 +519,8 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F ...@@ -519,7 +519,8 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
while( GetLine( file, Line, &LineNum, sizeof(Line) ) ) while( GetLine( file, Line, &LineNum, sizeof(Line) ) )
{ {
if( strnicmp( Line, "DEF", 3 ) == 0 ) if( strnicmp( Line, "DEF", 3 ) == 0 )
{ /* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */ {
/* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */
strtok( Line, " \t\r\n" ); strtok( Line, " \t\r\n" );
name = strtok( NULL, " \t\r\n" ); name = strtok( NULL, " \t\r\n" );
wxString st_name = CONV_FROM_UTF8( name ); wxString st_name = CONV_FROM_UTF8( name );
...@@ -533,7 +534,8 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F ...@@ -533,7 +534,8 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
} }
} }
else if( strnicmp( Line, "ALIAS", 5 ) == 0 ) else if( strnicmp( Line, "ALIAS", 5 ) == 0 )
{ /* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */ {
/* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */
strtok( Line, " \t\r\n" ); strtok( Line, " \t\r\n" );
while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL ) while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL )
{ {
......
/*****************************************/ /*****************************************/
/* EESchema - libedit_onleftclick.cpp */ /* EESchema - libedit_onleftclick.cpp */
/*****************************************/ /*****************************************/
/* Library editor commands created by a mouse left button simple or double click /* Library editor commands created by a mouse left button simple or double click
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -20,273 +20,284 @@ ...@@ -20,273 +20,284 @@
/************************************************************************/ /************************************************************************/
void WinEDA_LibeditFrame::OnLeftClick(wxDC * DC, const wxPoint& MousePos) void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/************************************************************************/ /************************************************************************/
{ {
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
if( CurrentLibEntry == NULL) return; if( CurrentLibEntry == NULL )
return;
if ( m_ID_current_state == 0 )
{ if( m_ID_current_state == 0 )
if ( DrawEntry && DrawEntry->m_Flags ) {
{ if( DrawEntry && DrawEntry->m_Flags )
SaveCopyInUndoList(CurrentLibEntry); {
switch (DrawEntry->Type() ) SaveCopyInUndoList( CurrentLibEntry );
{
case COMPONENT_PIN_DRAW_TYPE: switch( DrawEntry->Type() )
PlacePin(DC); {
break; case COMPONENT_PIN_DRAW_TYPE:
PlacePin( DC );
case COMPONENT_FIELD_DRAW_TYPE: break;
PlaceField(DC, (LibDrawField *) DrawEntry);
DrawEntry = NULL; case COMPONENT_FIELD_DRAW_TYPE:
break; PlaceField( DC, (LibDrawField*) DrawEntry );
DrawEntry = NULL;
default: break;
EndDrawGraphicItem(DC);
break; default:
} EndDrawGraphicItem( DC );
} break;
else }
{ }
DrawEntry = LocatePin(m_CurrentScreen->m_MousePosition, CurrentLibEntry, else
CurrentUnit, CurrentConvert); {
if (DrawEntry == NULL ) DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry,
{ CurrentUnit, CurrentConvert );
DrawEntry = LocateDrawItem(GetScreen(), GetScreen()->m_MousePosition, if( DrawEntry == NULL )
CurrentLibEntry,CurrentUnit, {
CurrentConvert,LOCATE_ALL_DRAW_ITEM); DrawEntry = LocateDrawItem( GetScreen(), GetScreen()->m_MousePosition,
} CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
if (DrawEntry == NULL ) }
DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry,
CurrentUnit, CurrentConvert); if( DrawEntry == NULL )
if (DrawEntry == NULL ) DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry,
{ CurrentUnit, CurrentConvert );
DrawEntry = LocateDrawItem(GetScreen(), GetScreen()->m_Curseur, if( DrawEntry == NULL )
CurrentLibEntry,CurrentUnit, {
CurrentConvert,LOCATE_ALL_DRAW_ITEM); DrawEntry = LocateDrawItem( GetScreen(), GetScreen()->m_Curseur,
} CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
if ( DrawEntry ) DrawEntry->Display_Infos_DrawEntry(this); }
else if( DrawEntry )
{ DrawEntry->Display_Infos_DrawEntry( this );
EraseMsgBox();
AfficheDoc(this, CurrentLibEntry->m_Doc.GetData(), else
CurrentLibEntry->m_KeyWord.GetData()); {
} EraseMsgBox();
} AfficheDoc( this, CurrentLibEntry->m_Doc.GetData(),
} CurrentLibEntry->m_KeyWord.GetData() );
}
if ( m_ID_current_state ) }
{ }
switch ( m_ID_current_state )
{ if( m_ID_current_state )
case ID_NO_SELECT_BUTT: {
break; switch( m_ID_current_state )
{
case ID_LIBEDIT_PIN_BUTT : case ID_NO_SELECT_BUTT:
if( CurrentDrawItem == NULL ) break;
{
CreatePin(DC); case ID_LIBEDIT_PIN_BUTT:
} if( CurrentDrawItem == NULL )
else {
{ CreatePin( DC );
SaveCopyInUndoList(CurrentLibEntry); }
PlacePin(DC); else
} {
break; SaveCopyInUndoList( CurrentLibEntry );
PlacePin( DC );
case ID_LIBEDIT_BODY_LINE_BUTT : }
case ID_LIBEDIT_BODY_ARC_BUTT : break;
case ID_LIBEDIT_BODY_CIRCLE_BUTT :
case ID_LIBEDIT_BODY_RECT_BUTT : case ID_LIBEDIT_BODY_LINE_BUTT:
case ID_LIBEDIT_BODY_TEXT_BUTT : case ID_LIBEDIT_BODY_ARC_BUTT:
if ( CurrentDrawItem == NULL) case ID_LIBEDIT_BODY_CIRCLE_BUTT:
{ case ID_LIBEDIT_BODY_RECT_BUTT:
CurrentDrawItem = CreateGraphicItem(DC); case ID_LIBEDIT_BODY_TEXT_BUTT:
} if( CurrentDrawItem == NULL )
else {
{ CurrentDrawItem = CreateGraphicItem( DC );
if ( CurrentDrawItem->m_Flags & IS_NEW ) }
GraphicItemBeginDraw(DC); else
else {
{ if( CurrentDrawItem->m_Flags & IS_NEW )
SaveCopyInUndoList(CurrentLibEntry); GraphicItemBeginDraw( DC );
EndDrawGraphicItem(DC); else
} {
} SaveCopyInUndoList( CurrentLibEntry );
break; EndDrawGraphicItem( DC );
}
case ID_LIBEDIT_DELETE_ITEM_BUTT : }
DrawEntry = LocatePin(m_CurrentScreen->m_MousePosition, CurrentLibEntry, break;
CurrentUnit, CurrentConvert);
if (DrawEntry == NULL ) case ID_LIBEDIT_DELETE_ITEM_BUTT:
{ DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry,
DrawEntry = LocateDrawItem(GetScreen(), m_CurrentScreen->m_MousePosition, CurrentUnit, CurrentConvert );
CurrentLibEntry,CurrentUnit, if( DrawEntry == NULL )
CurrentConvert,LOCATE_ALL_DRAW_ITEM); {
} DrawEntry = LocateDrawItem( GetScreen(), m_CurrentScreen->m_MousePosition,
CurrentLibEntry, CurrentUnit,
if (DrawEntry == NULL ) CurrentConvert, LOCATE_ALL_DRAW_ITEM );
DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, }
CurrentUnit, CurrentConvert);
if (DrawEntry == NULL ) if( DrawEntry == NULL )
{ DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry,
DrawEntry = LocateDrawItem(GetScreen(), m_CurrentScreen->m_Curseur, CurrentUnit, CurrentConvert );
CurrentLibEntry,CurrentUnit, if( DrawEntry == NULL )
CurrentConvert,LOCATE_ALL_DRAW_ITEM); {
} DrawEntry = LocateDrawItem( GetScreen(), m_CurrentScreen->m_Curseur,
if ( DrawEntry == NULL ) CurrentLibEntry, CurrentUnit,
{ CurrentConvert, LOCATE_ALL_DRAW_ITEM );
AfficheDoc(this, CurrentLibEntry->m_Doc.GetData(), }
CurrentLibEntry->m_KeyWord.GetData()); if( DrawEntry == NULL )
break; {
} AfficheDoc( this, CurrentLibEntry->m_Doc.GetData(),
SaveCopyInUndoList(CurrentLibEntry); CurrentLibEntry->m_KeyWord.GetData() );
if ( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE ) break;
DeletePin(DC, CurrentLibEntry, (LibDrawPin*)DrawEntry); }
else SaveCopyInUndoList( CurrentLibEntry );
DeleteOneLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry,DrawEntry, TRUE); if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE )
DrawEntry = NULL; DeletePin( DC, CurrentLibEntry, (LibDrawPin*) DrawEntry );
m_CurrentScreen->SetModify(); else
break; DeleteOneLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, DrawEntry, TRUE );
DrawEntry = NULL;
case ID_LIBEDIT_ANCHOR_ITEM_BUTT : m_CurrentScreen->SetModify();
SaveCopyInUndoList(CurrentLibEntry); break;
PlaceAncre();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString); case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
break; SaveCopyInUndoList( CurrentLibEntry );
PlaceAncre();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
default : break;
DisplayError(this, wxT("WinEDA_LibeditFrame::OnLeftClick error") );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString);
break; default:
} DisplayError( this, wxT( "WinEDA_LibeditFrame::OnLeftClick error" ) );
} SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
}
}
} }
/*************************************************************************/ /*************************************************************************/
void WinEDA_LibeditFrame::OnLeftDClick(wxDC * DC, const wxPoint& MousePos) void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/ /*************************************************************************/
/* Appel sur un double click: /* Appel sur un double click:
pour un lment editable (textes, composant): * pour un lment editable (textes, composant):
appel de l'editeur correspondant. * appel de l'editeur correspondant.
pour une connexion en cours: * pour une connexion en cours:
termine la connexion * termine la connexion
*/ */
{ {
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
if ( CurrentLibEntry == NULL ) return; if( CurrentLibEntry == NULL )
return;
if ( !m_ID_current_state || // Simple localisation des elements
(DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) if( !m_ID_current_state // Simple localisation des elements
{ || (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
DrawEntry = LocatePin(m_CurrentScreen->m_MousePosition, CurrentLibEntry, {
CurrentUnit, CurrentConvert); DrawEntry = LocatePin( m_CurrentScreen->m_MousePosition, CurrentLibEntry,
if ( DrawEntry == NULL ) CurrentUnit, CurrentConvert );
DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, if( DrawEntry == NULL )
CurrentUnit, CurrentConvert); DrawEntry = LocatePin( m_CurrentScreen->m_Curseur, CurrentLibEntry,
if ( DrawEntry == NULL ) CurrentUnit, CurrentConvert );
{ if( DrawEntry == NULL )
DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)m_CurrentScreen, {
m_CurrentScreen->m_MousePosition,CurrentLibEntry,CurrentUnit, DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) m_CurrentScreen,
CurrentConvert,LOCATE_ALL_DRAW_ITEM); m_CurrentScreen->m_MousePosition,
} CurrentLibEntry, CurrentUnit,
if ( DrawEntry == NULL ) CurrentConvert,
{ LOCATE_ALL_DRAW_ITEM );
DrawEntry = CurrentDrawItem = LocateDrawItem((SCH_SCREEN*)m_CurrentScreen, }
m_CurrentScreen->m_Curseur, CurrentLibEntry,CurrentUnit, if( DrawEntry == NULL )
CurrentConvert,LOCATE_ALL_DRAW_ITEM); {
} DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) m_CurrentScreen,
if ( DrawEntry == NULL ) m_CurrentScreen->m_Curseur,
{ CurrentLibEntry, CurrentUnit,
DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*) CurrentConvert,
LocateField(CurrentLibEntry); LOCATE_ALL_DRAW_ITEM );
} }
if ( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
wxPoint mpos; DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*)
wxGetMousePosition(&mpos.x, &mpos.y); LocateField( CurrentLibEntry );
InstallLibeditFrame(mpos); }
} if( DrawEntry == NULL )
} {
wxPoint mpos;
// Si Commande en cours: affichage commande d'annulation wxGetMousePosition( &mpos.x, &mpos.y );
if ( m_ID_current_state ) InstallLibeditFrame( mpos );
{ }
} }
else // Si Commande en cours: affichage commande d'annulation
{ if( m_ID_current_state )
} {
}
if ( DrawEntry ) DrawEntry->Display_Infos_DrawEntry(this); else
else return; {
}
CurrentDrawItem = DrawEntry;
if( DrawEntry )
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawEntry->Display_Infos_DrawEntry( this );
switch ( DrawEntry->Type() ) else
{ return;
case COMPONENT_PIN_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 ) // Item localis et non en edition: placement commande move CurrentDrawItem = DrawEntry;
{
InstallPineditFrame(this, DC, pos); DrawPanel->m_IgnoreMouseEvents = TRUE;
}
break; switch( DrawEntry->Type() )
{
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
case COMPONENT_CIRCLE_DRAW_TYPE: if( DrawEntry->m_Flags == 0 ) // Item localis et non en edition: placement commande move
case COMPONENT_RECT_DRAW_TYPE: {
if( DrawEntry->m_Flags == 0 ) InstallPineditFrame( this, DC, pos );
{ }
EditGraphicSymbol(DC, DrawEntry); break;
}
break; case COMPONENT_ARC_DRAW_TYPE:
case COMPONENT_CIRCLE_DRAW_TYPE:
case COMPONENT_LINE_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
case COMPONENT_POLYLINE_DRAW_TYPE: if( DrawEntry->m_Flags == 0 )
if( DrawEntry->m_Flags == 0 ) {
{ EditGraphicSymbol( DC, DrawEntry );
EditGraphicSymbol(DC, DrawEntry); }
} break;
else if( DrawEntry->m_Flags & IS_NEW )
{ case COMPONENT_LINE_DRAW_TYPE:
EndDrawGraphicItem(DC); case COMPONENT_POLYLINE_DRAW_TYPE:
} if( DrawEntry->m_Flags == 0 )
break; {
EditGraphicSymbol( DC, DrawEntry );
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: }
if( DrawEntry->m_Flags == 0 ) else if( DrawEntry->m_Flags & IS_NEW )
{ {
EditSymbolText(DC, DrawEntry); EndDrawGraphicItem( DC );
} }
break; break;
case COMPONENT_FIELD_DRAW_TYPE: case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
EditField(DC, (LibDrawField *)DrawEntry); EditSymbolText( DC, DrawEntry );
} }
break; break;
case COMPONENT_FIELD_DRAW_TYPE:
default: if( DrawEntry->m_Flags == 0 )
wxString msg; {
msg.Printf( EditField( DC, (LibDrawField*) DrawEntry );
wxT("WinEDA_LibeditFrame::OnLeftDClick Error: unknown StructType %d"), }
DrawEntry->Type()); break;
DisplayError(this, msg );
break;
} default:
DrawPanel->MouseToCursorSchema(); wxString msg;
DrawPanel->m_IgnoreMouseEvents = FALSE; msg.Printf(
wxT( "WinEDA_LibeditFrame::OnLeftDClick Error: unknown StructType %d" ),
DrawEntry->Type() );
DisplayError( this, msg );
break;
}
DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE;
} }
/****************************/ /****************************/
/* EESchema - libframe.cpp */ /* EESchema - libframe.cpp */
/****************************/ /****************************/
/* Gestion de la frame d'edition des composants en librairie /* Gestion de la frame d'edition des composants en librairie
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -20,682 +20,712 @@ ...@@ -20,682 +20,712 @@
#include "libedit.xpm" #include "libedit.xpm"
/*****************************/ /*****************************/
/* class WinEDA_LibeditFrame */ /* class WinEDA_LibeditFrame */
/*****************************/ /*****************************/
BEGIN_EVENT_TABLE(WinEDA_LibeditFrame, wxFrame) BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_LibeditFrame::OnSize )
EVT_CLOSE(WinEDA_LibeditFrame::OnCloseWindow) EVT_TOOL_RANGE( ID_ZOOM_PLUS_BUTT, ID_ZOOM_PAGE_BUTT,
EVT_SIZE(WinEDA_LibeditFrame::OnSize) WinEDA_LibeditFrame::Process_Zoom )
EVT_TOOL_RANGE(ID_ZOOM_PLUS_BUTT, ID_ZOOM_PAGE_BUTT, // Tools et boutons de Libedit:
WinEDA_LibeditFrame::Process_Zoom)
// Tools et boutons de Libedit: /* Main horizontal toolbar */
EVT_TOOL_RANGE( ID_LIBEDIT_START_H_TOOL, ID_LIBEDIT_END_H_TOOL,
WinEDA_LibeditFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_PART_NUMBER,
WinEDA_LibeditFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS,
WinEDA_LibeditFrame::Process_Special_Functions )
/* Main horizontal toolbar */ /* Right Vertical toolbar */
EVT_TOOL_RANGE( ID_LIBEDIT_START_H_TOOL, ID_LIBEDIT_END_H_TOOL, EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_LibeditFrame::Process_Special_Functions )
WinEDA_LibeditFrame::Process_Special_Functions) EVT_TOOL_RANGE( ID_LIBEDIT_START_V_TOOL, ID_LIBEDIT_END_V_TOOL,
EVT_KICAD_CHOICEBOX(ID_LIBEDIT_SELECT_PART_NUMBER, WinEDA_LibeditFrame::Process_Special_Functions )
WinEDA_LibeditFrame::Process_Special_Functions)
EVT_KICAD_CHOICEBOX(ID_LIBEDIT_SELECT_ALIAS,
WinEDA_LibeditFrame::Process_Special_Functions)
/* Right Vertical toolbar */ /* PopUp events and commands: */
EVT_TOOL( ID_NO_SELECT_BUTT,WinEDA_LibeditFrame::Process_Special_Functions) EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
EVT_TOOL_RANGE( ID_LIBEDIT_START_V_TOOL, ID_LIBEDIT_END_V_TOOL, WinEDA_LibeditFrame::Process_Special_Functions )
WinEDA_LibeditFrame::Process_Special_Functions)
/* PopUp events and commands: */ // Annulation de commande en cours
EVT_MENU_RANGE(ID_POPUP_START_RANGE, ID_POPUP_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_LibeditFrame::Process_Special_Functions ) WinEDA_LibeditFrame::Process_Special_Functions )
// Annulation de commande en cours // PopUp Menus pour Zooms traits dans drawpanel.cpp
EVT_MENU_RANGE(ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_LibeditFrame::Process_Special_Functions )
// PopUp Menus pour Zooms traits dans drawpanel.cpp
END_EVENT_TABLE() END_EVENT_TABLE()
WinEDA_LibeditFrame::WinEDA_LibeditFrame(wxWindow * father, WinEDA_App *parent, WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
const wxString & title, const wxPoint& pos, const wxSize& size): WinEDA_App* parent,
WinEDA_DrawFrame(father, LIBEDITOR_FRAME, parent, title, pos, size) const wxString& title,
const wxPoint& pos,
const wxSize& size ) :
WinEDA_DrawFrame( father, LIBEDITOR_FRAME, parent, title, pos, size )
{ {
m_FrameName = wxT("LibeditFrame"); m_FrameName = wxT( "LibeditFrame" );
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
// Give an icon // Give an icon
SetIcon(wxIcon(libedit_xpm)); SetIcon( wxIcon( libedit_xpm ) );
m_CurrentScreen = ScreenLib; m_CurrentScreen = ScreenLib;
GetSettings(); GetSettings();
SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
if ( DrawPanel ) DrawPanel-> m_Block_Enable = TRUE; if( DrawPanel )
ReCreateHToolbar(); DrawPanel->m_Block_Enable = TRUE;
ReCreateVToolbar(); ReCreateHToolbar();
DisplayLibInfos(); ReCreateVToolbar();
Show(TRUE); DisplayLibInfos();
Show( TRUE );
} }
/**********************************************/ /**********************************************/
WinEDA_LibeditFrame::~WinEDA_LibeditFrame() WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
/**********************************************/ /**********************************************/
{ {
m_Parent->LibeditFrame = NULL; m_Parent->LibeditFrame = NULL;
m_CurrentScreen = ScreenSch; m_CurrentScreen = ScreenSch;
} }
/***********************************************************/ /***********************************************************/
void WinEDA_LibeditFrame::OnCloseWindow(wxCloseEvent & Event) void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
/***********************************************************/ /***********************************************************/
{ {
LibraryStruct *Lib; LibraryStruct* Lib;
if( m_CurrentScreen->IsModify() ) if( m_CurrentScreen->IsModify() )
{ {
if( ! IsOK(this, _("LibEdit: Part modified!, Continue ?") ) ) if( !IsOK( this, _( "LibEdit: Part modified!, Continue ?" ) ) )
{ {
Event.Veto(); return; Event.Veto(); return;
} }
else m_CurrentScreen->ClrModify(); else
} m_CurrentScreen->ClrModify();
}
for (Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext)
{ for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
if( Lib->m_Modified ) {
{ if( Lib->m_Modified )
wxString msg; {
msg.Printf( _("Library %s modified!, Continue ?"), Lib->m_Name.GetData()); wxString msg;
if( ! IsOK(this, msg) ) msg.Printf( _( "Library %s modified!, Continue ?" ), Lib->m_Name.GetData() );
{ if( !IsOK( this, msg ) )
Event.Veto(); return; {
} Event.Veto(); return;
} }
} }
}
SaveSettings();
Destroy(); SaveSettings();
Destroy();
} }
/******************************************/ /******************************************/
void WinEDA_LibeditFrame::SetToolbars() void WinEDA_LibeditFrame::SetToolbars()
/******************************************/ /******************************************/
/* Enable or disable tools of the differents toolbars, /* Enable or disable tools of the differents toolbars,
according to the current conditions or options * according to the current conditions or options
*/ */
{ {
if( m_HToolBar == NULL )
if( m_HToolBar == NULL ) return; return;
if ( CurrentLib == NULL ) if( CurrentLib == NULL )
{ {
if ( m_HToolBar ) m_HToolBar->EnableTool(ID_LIBEDIT_SAVE_CURRENT_LIB,FALSE); if( m_HToolBar )
} m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_LIB, FALSE );
else }
{ else
if ( m_HToolBar ) m_HToolBar->EnableTool(ID_LIBEDIT_SAVE_CURRENT_LIB,TRUE); {
} if( m_HToolBar )
m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_LIB, TRUE );
if ( CurrentLibEntry == NULL ) }
{
if ( m_HToolBar ) if( CurrentLibEntry == NULL )
{ {
m_HToolBar->EnableTool(ID_LIBEDIT_IMPORT_PART,TRUE); if( m_HToolBar )
m_HToolBar->EnableTool(ID_LIBEDIT_EXPORT_PART,FALSE); {
m_HToolBar->EnableTool(ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,FALSE); m_HToolBar->EnableTool( ID_LIBEDIT_IMPORT_PART, TRUE );
m_HToolBar->EnableTool(ID_LIBEDIT_SAVE_CURRENT_PART,FALSE); m_HToolBar->EnableTool( ID_LIBEDIT_EXPORT_PART, FALSE );
m_HToolBar->EnableTool(ID_DE_MORGAN_CONVERT_BUTT, FALSE); m_HToolBar->EnableTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, FALSE );
m_HToolBar->EnableTool(ID_DE_MORGAN_NORMAL_BUTT, FALSE); m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_PART, FALSE );
m_HToolBar->EnableTool(ID_LIBEDIT_EDIT_PIN_BY_PIN, FALSE); m_HToolBar->EnableTool( ID_DE_MORGAN_CONVERT_BUTT, FALSE );
m_HToolBar->EnableTool(ID_LIBEDIT_VIEW_DOC, FALSE); m_HToolBar->EnableTool( ID_DE_MORGAN_NORMAL_BUTT, FALSE );
m_HToolBar->EnableTool(ID_LIBEDIT_CHECK_PART, FALSE); m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, FALSE );
m_SelpartBox->Enable( FALSE); m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE );
m_HToolBar->EnableTool(ID_LIBEDIT_UNDO,FALSE); m_HToolBar->EnableTool( ID_LIBEDIT_CHECK_PART, FALSE );
m_HToolBar->EnableTool(ID_LIBEDIT_REDO,FALSE); m_SelpartBox->Enable( FALSE );
} m_HToolBar->EnableTool( ID_LIBEDIT_UNDO, FALSE );
g_EditPinByPinIsOn = FALSE; m_HToolBar->EnableTool( ID_LIBEDIT_REDO, FALSE );
m_HToolBar->ToggleTool(ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn); }
g_EditPinByPinIsOn = FALSE;
if ( m_VToolBar ) m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
{
m_VToolBar->EnableTool(ID_LIBEDIT_BODY_TEXT_BUTT, FALSE); if( m_VToolBar )
m_VToolBar->EnableTool(ID_LIBEDIT_BODY_LINE_BUTT, FALSE); {
m_VToolBar->EnableTool(ID_LIBEDIT_BODY_RECT_BUTT, FALSE); m_VToolBar->EnableTool( ID_LIBEDIT_BODY_TEXT_BUTT, FALSE );
m_VToolBar->EnableTool(ID_LIBEDIT_BODY_CIRCLE_BUTT, FALSE); m_VToolBar->EnableTool( ID_LIBEDIT_BODY_LINE_BUTT, FALSE );
m_VToolBar->EnableTool(ID_LIBEDIT_BODY_ARC_BUTT, FALSE); m_VToolBar->EnableTool( ID_LIBEDIT_BODY_RECT_BUTT, FALSE );
m_VToolBar->EnableTool(ID_LIBEDIT_DELETE_ITEM_BUTT, FALSE); m_VToolBar->EnableTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, FALSE );
m_VToolBar->EnableTool(ID_LIBEDIT_ANCHOR_ITEM_BUTT, FALSE); m_VToolBar->EnableTool( ID_LIBEDIT_BODY_ARC_BUTT, FALSE );
m_VToolBar->EnableTool(ID_LIBEDIT_IMPORT_BODY_BUTT, FALSE); m_VToolBar->EnableTool( ID_LIBEDIT_DELETE_ITEM_BUTT, FALSE );
m_VToolBar->EnableTool(ID_LIBEDIT_EXPORT_BODY_BUTT, FALSE); m_VToolBar->EnableTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, FALSE );
} m_VToolBar->EnableTool( ID_LIBEDIT_IMPORT_BODY_BUTT, FALSE );
} m_VToolBar->EnableTool( ID_LIBEDIT_EXPORT_BODY_BUTT, FALSE );
}
else }
{ else
if ( m_HToolBar ) {
{ if( m_HToolBar )
m_HToolBar->EnableTool(ID_LIBEDIT_IMPORT_PART,TRUE); {
m_HToolBar->EnableTool(ID_LIBEDIT_EXPORT_PART,TRUE); m_HToolBar->EnableTool( ID_LIBEDIT_IMPORT_PART, TRUE );
m_HToolBar->EnableTool(ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,TRUE); m_HToolBar->EnableTool( ID_LIBEDIT_EXPORT_PART, TRUE );
m_HToolBar->EnableTool(ID_LIBEDIT_SAVE_CURRENT_PART,TRUE); m_HToolBar->EnableTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, TRUE );
if ( (CurrentLibEntry->m_UnitCount > 1) || g_AsDeMorgan ) m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_PART, TRUE );
m_HToolBar->EnableTool(ID_LIBEDIT_EDIT_PIN_BY_PIN, TRUE); if( (CurrentLibEntry->m_UnitCount > 1) || g_AsDeMorgan )
else m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, TRUE );
m_HToolBar->EnableTool(ID_LIBEDIT_EDIT_PIN_BY_PIN, FALSE); else
m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, FALSE );
m_HToolBar->ToggleTool(ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn);
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
m_HToolBar->EnableTool(ID_DE_MORGAN_CONVERT_BUTT, g_AsDeMorgan);
m_HToolBar->EnableTool(ID_DE_MORGAN_NORMAL_BUTT, g_AsDeMorgan); m_HToolBar->EnableTool( ID_DE_MORGAN_CONVERT_BUTT, g_AsDeMorgan );
/* Enable the "get doc" tool */ m_HToolBar->EnableTool( ID_DE_MORGAN_NORMAL_BUTT, g_AsDeMorgan );
bool enable_dtool = FALSE; /* Enable the "get doc" tool */
if ( ! CurrentAliasName.IsEmpty() ) bool enable_dtool = FALSE;
{ if( !CurrentAliasName.IsEmpty() )
int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName); {
if ( AliasLocation >= 0 ) int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName );
if ( ! CurrentLibEntry->m_AliasList[AliasLocation+ALIAS_DOC_FILENAME].IsEmpty() ) if( AliasLocation >= 0 )
enable_dtool = TRUE; if( !CurrentLibEntry->m_AliasList[AliasLocation + ALIAS_DOC_FILENAME].IsEmpty() )
} enable_dtool = TRUE;
else if ( ! CurrentLibEntry->m_DocFile.IsEmpty() ) enable_dtool = TRUE; }
if ( enable_dtool ) m_HToolBar->EnableTool(ID_LIBEDIT_VIEW_DOC, TRUE); else if( !CurrentLibEntry->m_DocFile.IsEmpty() )
else m_HToolBar->EnableTool(ID_LIBEDIT_VIEW_DOC, FALSE); enable_dtool = TRUE;
m_HToolBar->EnableTool(ID_LIBEDIT_CHECK_PART, TRUE); if( enable_dtool )
m_SelpartBox->Enable( (CurrentLibEntry->m_UnitCount > 1 ) ? TRUE : FALSE); m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, TRUE );
else
if ( GetScreen() ) m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE );
{ m_HToolBar->EnableTool( ID_LIBEDIT_CHECK_PART, TRUE );
m_HToolBar->EnableTool(ID_LIBEDIT_UNDO,GetScreen()->m_UndoList); m_SelpartBox->Enable( (CurrentLibEntry->m_UnitCount > 1 ) ? TRUE : FALSE );
m_HToolBar->EnableTool(ID_LIBEDIT_REDO,GetScreen()->m_RedoList);
} if( GetScreen() )
} {
m_HToolBar->EnableTool( ID_LIBEDIT_UNDO, GetScreen()->m_UndoList );
if ( m_VToolBar ) m_HToolBar->EnableTool( ID_LIBEDIT_REDO, GetScreen()->m_RedoList );
{ }
m_VToolBar->EnableTool(ID_LIBEDIT_BODY_TEXT_BUTT, TRUE); }
m_VToolBar->EnableTool(ID_LIBEDIT_BODY_LINE_BUTT, TRUE);
m_VToolBar->EnableTool(ID_LIBEDIT_BODY_RECT_BUTT, TRUE); if( m_VToolBar )
m_VToolBar->EnableTool(ID_LIBEDIT_BODY_CIRCLE_BUTT, TRUE); {
m_VToolBar->EnableTool(ID_LIBEDIT_BODY_ARC_BUTT, TRUE); m_VToolBar->EnableTool( ID_LIBEDIT_BODY_TEXT_BUTT, TRUE );
m_VToolBar->EnableTool(ID_LIBEDIT_DELETE_ITEM_BUTT, TRUE); m_VToolBar->EnableTool( ID_LIBEDIT_BODY_LINE_BUTT, TRUE );
m_VToolBar->EnableTool(ID_LIBEDIT_ANCHOR_ITEM_BUTT, TRUE); m_VToolBar->EnableTool( ID_LIBEDIT_BODY_RECT_BUTT, TRUE );
m_VToolBar->EnableTool(ID_LIBEDIT_IMPORT_BODY_BUTT, TRUE); m_VToolBar->EnableTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, TRUE );
m_VToolBar->EnableTool(ID_LIBEDIT_EXPORT_BODY_BUTT, TRUE); m_VToolBar->EnableTool( ID_LIBEDIT_BODY_ARC_BUTT, TRUE );
} m_VToolBar->EnableTool( ID_LIBEDIT_DELETE_ITEM_BUTT, TRUE );
} m_VToolBar->EnableTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, TRUE );
m_VToolBar->EnableTool( ID_LIBEDIT_IMPORT_BODY_BUTT, TRUE );
DisplayUnitsMsg(); m_VToolBar->EnableTool( ID_LIBEDIT_EXPORT_BODY_BUTT, TRUE );
}
}
DisplayUnitsMsg();
} }
/**************************************/ /**************************************/
int WinEDA_LibeditFrame::BestZoom() int WinEDA_LibeditFrame::BestZoom()
/**************************************/ /**************************************/
{ {
int dx, dy, ii,jj ; int dx, dy, ii, jj;
int bestzoom; int bestzoom;
wxSize size; wxSize size;
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox;
if ( CurrentLibEntry ) if( CurrentLibEntry )
{ {
BoundaryBox = CurrentLibEntry->GetBoundaryBox(CurrentUnit, CurrentConvert); BoundaryBox = CurrentLibEntry->GetBoundaryBox( CurrentUnit, CurrentConvert );
dx = BoundaryBox.GetWidth(); dx = BoundaryBox.GetWidth();
dy = BoundaryBox.GetHeight(); dy = BoundaryBox.GetHeight();
} }
else
else {
{ dx = m_CurrentScreen->m_CurrentSheet->m_Size.x;
dx = m_CurrentScreen->m_CurrentSheet->m_Size.x; dy = m_CurrentScreen->m_CurrentSheet->m_Size.y;
dy = m_CurrentScreen->m_CurrentSheet->m_Size.y; }
}
size = DrawPanel->GetClientSize();
size = DrawPanel->GetClientSize(); size.x -= 60; // Pour marges haut et bas
size.x -= 60; // Pour marges haut et bas ii = abs( dx / size.x );
ii = abs (dx / size.x); jj = abs( dy / size.y );
jj = abs (dy / size.y);
/* determination du zoom existant le plus proche */
/* determination du zoom existant le plus proche */ bestzoom = MAX( ii, jj ) + 1;
bestzoom = MAX(ii, jj) + 1;
if( CurrentLibEntry )
if ( CurrentLibEntry ) {
{ m_CurrentScreen->m_Curseur = BoundaryBox.Centre();
m_CurrentScreen->m_Curseur = BoundaryBox.Centre(); }
} else
else {
{ m_CurrentScreen->m_Curseur.x = 0;
m_CurrentScreen->m_Curseur.x = 0; m_CurrentScreen->m_Curseur.y = 0;
m_CurrentScreen->m_Curseur.y = 0; }
}
return bestzoom;
return(bestzoom);
} }
/*************************************************************************/ /*************************************************************************/
void WinEDA_LibeditFrame::Process_Special_Functions(wxCommandEvent& event) void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
/*************************************************************************/ /*************************************************************************/
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
wxClientDC dc(DrawPanel);
wxClientDC dc( DrawPanel );
DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->PrepareGraphicContext(&dc);
DrawPanel->PrepareGraphicContext( &dc );
wxGetMousePosition(&pos.x, &pos.y);
pos.y += 20; wxGetMousePosition( &pos.x, &pos.y );
pos.y += 20;
switch ( id ) // Arret de la commande de dplacement en cours
{ switch( id ) // Arret de la commande de dplacement en cours
case ID_POPUP_LIBEDIT_END_CREATE_ITEM: {
case ID_POPUP_LIBEDIT_PIN_EDIT: case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM: case ID_POPUP_LIBEDIT_PIN_EDIT:
case ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM: case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM:
case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM: case ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM: case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
case ID_POPUP_LIBEDIT_CANCEL_EDITING : case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_LIBEDIT_CANCEL_EDITING:
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_COPY_BLOCK: case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_SELECT_ITEMS_BLOCK: case ID_POPUP_COPY_BLOCK:
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_SELECT_ITEMS_BLOCK:
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_INVERT_BLOCK:
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT: case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT: case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
break; case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT:
break;
case ID_POPUP_LIBEDIT_DELETE_ITEM:
if ( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) case ID_POPUP_LIBEDIT_DELETE_ITEM:
DrawPanel->ForceCloseManageCurseur(DrawPanel, &dc); if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
break; DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
break;
default:
if ( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) default:
DrawPanel->ForceCloseManageCurseur(DrawPanel, &dc); if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
break; SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
} break;
}
switch ( id )
{ switch( id )
case ID_LIBEDIT_SAVE_CURRENT_LIB: {
if( m_CurrentScreen->IsModify() ) case ID_LIBEDIT_SAVE_CURRENT_LIB:
{ if( m_CurrentScreen->IsModify() )
if( IsOK(this, _("Include last component changes") ) ) {
SaveOnePartInMemory(); if( IsOK( this, _( "Include last component changes" ) ) )
} SaveOnePartInMemory();
SaveActiveLibrary(); }
break; SaveActiveLibrary();
break;
case ID_LIBEDIT_NEW_PART:
{ case ID_LIBEDIT_NEW_PART:
g_EditPinByPinIsOn = FALSE; {
LibItemToRepeat = NULL; g_EditPinByPinIsOn = FALSE;
CreateNewLibraryPart(); LibItemToRepeat = NULL;
GetScreen()->ClearUndoRedoList(); CreateNewLibraryPart();
ReDrawPanel(); GetScreen()->ClearUndoRedoList();
SetToolbars(); ReDrawPanel();
break; SetToolbars();
} break;
}
case ID_LIBEDIT_SELECT_CURRENT_LIB:
SelectActiveLibrary(); case ID_LIBEDIT_SELECT_CURRENT_LIB:
break; SelectActiveLibrary();
break;
case ID_LIBEDIT_SELECT_PART:
LibItemToRepeat = NULL; case ID_LIBEDIT_SELECT_PART:
if ( LoadOneLibraryPart() ) LibItemToRepeat = NULL;
{ if( LoadOneLibraryPart() )
g_EditPinByPinIsOn = FALSE; {
GetScreen()->ClearUndoRedoList(); g_EditPinByPinIsOn = FALSE;
SetToolbars(); GetScreen()->ClearUndoRedoList();
} SetToolbars();
ReDrawPanel(); }
break; ReDrawPanel();
break;
case ID_LIBEDIT_SAVE_CURRENT_PART:
SaveOnePartInMemory(); case ID_LIBEDIT_SAVE_CURRENT_PART:
break; SaveOnePartInMemory();
break;
case ID_LIBEDIT_GET_FRAME_EDIT_PART:
InstallLibeditFrame(pos); case ID_LIBEDIT_GET_FRAME_EDIT_PART:
break; InstallLibeditFrame( pos );
break;
case ID_LIBEDIT_DELETE_PART:
LibItemToRepeat = NULL; case ID_LIBEDIT_DELETE_PART:
DeleteOnePart(); LibItemToRepeat = NULL;
break; DeleteOnePart();
break;
case ID_LIBEDIT_IMPORT_PART:
LibItemToRepeat = NULL; case ID_LIBEDIT_IMPORT_PART:
ImportOnePart(); LibItemToRepeat = NULL;
GetScreen()->ClearUndoRedoList(); ImportOnePart();
ReDrawPanel(); GetScreen()->ClearUndoRedoList();
break; ReDrawPanel();
break;
case ID_LIBEDIT_EXPORT_PART:
ExportOnePart(FALSE); case ID_LIBEDIT_EXPORT_PART:
break; ExportOnePart( FALSE );
break;
case ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART:
ExportOnePart(TRUE); case ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART:
break; ExportOnePart( TRUE );
break;
case ID_LIBEDIT_CHECK_PART :
if ( CurrentLibEntry ) case ID_LIBEDIT_CHECK_PART:
if ( TestPins(CurrentLibEntry) == FALSE ) if( CurrentLibEntry )
DisplayInfo(this, _(" Tst Pins OK!") ); if( TestPins( CurrentLibEntry ) == FALSE )
break; DisplayInfo( this, _( " Tst Pins OK!" ) );
break;
case ID_DE_MORGAN_NORMAL_BUTT:
m_HToolBar->ToggleTool(ID_DE_MORGAN_NORMAL_BUTT, TRUE); case ID_DE_MORGAN_NORMAL_BUTT:
m_HToolBar->ToggleTool(ID_DE_MORGAN_CONVERT_BUTT, FALSE); m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT, TRUE );
LibItemToRepeat = NULL; m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT, FALSE );
CurrentConvert = 1; LibItemToRepeat = NULL;
ReDrawPanel(); CurrentConvert = 1;
break; ReDrawPanel();
break;
case ID_DE_MORGAN_CONVERT_BUTT:
m_HToolBar->ToggleTool(ID_DE_MORGAN_NORMAL_BUTT, FALSE); case ID_DE_MORGAN_CONVERT_BUTT:
m_HToolBar->ToggleTool(ID_DE_MORGAN_CONVERT_BUTT, TRUE); m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT, FALSE );
LibItemToRepeat = NULL; m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT, TRUE );
CurrentConvert = 2; LibItemToRepeat = NULL;
ReDrawPanel(); CurrentConvert = 2;
break; ReDrawPanel();
break;
case ID_LIBEDIT_VIEW_DOC:
if ( CurrentLibEntry ) case ID_LIBEDIT_VIEW_DOC:
{ if( CurrentLibEntry )
wxString docfilename; {
if ( ! CurrentAliasName.IsEmpty() ) wxString docfilename;
{ if( !CurrentAliasName.IsEmpty() )
int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName); {
if ( AliasLocation >= 0 ) int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName );
docfilename = CurrentLibEntry->m_AliasList[AliasLocation+ALIAS_DOC_FILENAME]; if( AliasLocation >= 0 )
} docfilename = CurrentLibEntry->m_AliasList[AliasLocation + ALIAS_DOC_FILENAME];
else docfilename = CurrentLibEntry->m_DocFile; }
else
if ( ! docfilename.IsEmpty() ) docfilename = CurrentLibEntry->m_DocFile;
GetAssociatedDocument(this, g_RealLibDirBuffer, docfilename);
} if( !docfilename.IsEmpty() )
break; GetAssociatedDocument( this, g_RealLibDirBuffer, docfilename );
}
case ID_LIBEDIT_EDIT_PIN_BY_PIN: break;
g_EditPinByPinIsOn = g_EditPinByPinIsOn ? FALSE : TRUE;
m_HToolBar->ToggleTool(ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn); case ID_LIBEDIT_EDIT_PIN_BY_PIN:
break; g_EditPinByPinIsOn = g_EditPinByPinIsOn ? FALSE : TRUE;
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
case ID_LIBEDIT_SELECT_PART_NUMBER: break;
{
int ii = m_SelpartBox->GetChoice(); case ID_LIBEDIT_SELECT_PART_NUMBER:
if ( ii < 0 ) return; {
LibItemToRepeat = NULL; int ii = m_SelpartBox->GetChoice();
CurrentUnit = ii + 1; if( ii < 0 )
ReDrawPanel(); return;
} LibItemToRepeat = NULL;
break; CurrentUnit = ii + 1;
ReDrawPanel();
case ID_LIBEDIT_SELECT_ALIAS: }
{ break;
int ii = m_SelAliasBox->GetChoice();
if ( ii < 0 ) return; case ID_LIBEDIT_SELECT_ALIAS:
LibItemToRepeat = NULL; {
if ( ii > 0 ) CurrentAliasName = m_SelAliasBox->GetValue(); int ii = m_SelAliasBox->GetChoice();
else CurrentAliasName.Empty(); if( ii < 0 )
ReDrawPanel(); return;
} LibItemToRepeat = NULL;
break; if( ii > 0 )
CurrentAliasName = m_SelAliasBox->GetValue();
case ID_POPUP_LIBEDIT_PIN_EDIT: else
InstallPineditFrame(this, &dc, pos); CurrentAliasName.Empty();
break; ReDrawPanel();
}
case ID_LIBEDIT_PIN_BUTT: break;
if ( CurrentLibEntry )
{ case ID_POPUP_LIBEDIT_PIN_EDIT:
SetToolID( id, wxCURSOR_PENCIL, _("Add Pin")); InstallPineditFrame( this, &dc, pos );
} break;
else
{ case ID_LIBEDIT_PIN_BUTT:
SetToolID( id, wxCURSOR_ARROW, _("Set Pin Opt")); if( CurrentLibEntry )
InstallPineditFrame(this, &dc, pos); {
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString); SetToolID( id, wxCURSOR_PENCIL, _( "Add Pin" ) );
} }
break; else
{
case ID_POPUP_LIBEDIT_CANCEL_EDITING : SetToolID( id, wxCURSOR_ARROW, _( "Set Pin Opt" ) );
if ( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) InstallPineditFrame( this, &dc, pos );
DrawPanel->ForceCloseManageCurseur(DrawPanel, &dc); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
else }
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString); break;
break;
case ID_POPUP_LIBEDIT_CANCEL_EDITING:
case ID_NO_SELECT_BUTT: if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
break; else
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
case ID_LIBEDIT_BODY_TEXT_BUTT: break;
SetToolID( id, wxCURSOR_PENCIL, _("Add Text"));
break; case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
case ID_LIBEDIT_BODY_RECT_BUTT: break;
SetToolID( id, wxCURSOR_PENCIL, _("Add Rectangle"));
break; case ID_LIBEDIT_BODY_TEXT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Text" ) );
case ID_LIBEDIT_BODY_CIRCLE_BUTT: break;
SetToolID( id, wxCURSOR_PENCIL, _("Add Circle"));
break; case ID_LIBEDIT_BODY_RECT_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Rectangle" ) );
case ID_LIBEDIT_BODY_ARC_BUTT: break;
SetToolID( id, wxCURSOR_PENCIL, _("Add Arc"));
break; case ID_LIBEDIT_BODY_CIRCLE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Circle" ) );
case ID_LIBEDIT_BODY_LINE_BUTT: break;
SetToolID( id, wxCURSOR_PENCIL, _("Add Line"));
break; case ID_LIBEDIT_BODY_ARC_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Arc" ) );
case ID_LIBEDIT_ANCHOR_ITEM_BUTT : break;
SetToolID( id, wxCURSOR_HAND, _("Anchor"));
break; case ID_LIBEDIT_BODY_LINE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Line" ) );
case ID_LIBEDIT_IMPORT_BODY_BUTT : break;
SetToolID( id, wxCURSOR_ARROW, _("Import"));
LoadOneSymbol(&dc); case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString); SetToolID( id, wxCURSOR_HAND, _( "Anchor" ) );
break; break;
case ID_LIBEDIT_EXPORT_BODY_BUTT : case ID_LIBEDIT_IMPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _("Export")); SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
SaveOneSymbol(); LoadOneSymbol( &dc );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
case ID_POPUP_LIBEDIT_END_CREATE_ITEM: case ID_LIBEDIT_EXPORT_BODY_BUTT:
DrawPanel->MouseToCursorSchema(); SetToolID( id, wxCURSOR_ARROW, _( "Export" ) );
if ( CurrentDrawItem ) SaveOneSymbol();
{ SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
EndDrawGraphicItem(&dc); break;
}
break; case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
DrawPanel->MouseToCursorSchema();
case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM: if( CurrentDrawItem )
if ( CurrentDrawItem ) {
{ EndDrawGraphicItem( &dc );
DrawPanel->CursorOff(&dc); }
switch ( CurrentDrawItem->Type() ) break;
{
case COMPONENT_ARC_DRAW_TYPE: case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM:
case COMPONENT_CIRCLE_DRAW_TYPE: if( CurrentDrawItem )
case COMPONENT_RECT_DRAW_TYPE: {
case COMPONENT_POLYLINE_DRAW_TYPE: DrawPanel->CursorOff( &dc );
case COMPONENT_LINE_DRAW_TYPE:
EditGraphicSymbol(&dc, CurrentDrawItem); switch( CurrentDrawItem->Type() )
break; {
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
EditSymbolText(&dc, CurrentDrawItem); case COMPONENT_CIRCLE_DRAW_TYPE:
break; case COMPONENT_RECT_DRAW_TYPE:
default:; case COMPONENT_POLYLINE_DRAW_TYPE:
} case COMPONENT_LINE_DRAW_TYPE:
DrawPanel->CursorOn(&dc); EditGraphicSymbol( &dc, CurrentDrawItem );
} break;
break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
EditSymbolText( &dc, CurrentDrawItem );
case ID_LIBEDIT_DELETE_ITEM_BUTT: break;
if ( CurrentLibEntry == NULL) { wxBell(); break; }
SetToolID( id, wxCURSOR_BULLSEYE, _("Delete item")); default:
break; ;
}
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT: DrawPanel->CursorOn( &dc );
// Delete the last created segment, while creating a polyline draw item }
if ( CurrentDrawItem == NULL) break; break;
DrawPanel->MouseToCursorSchema();
DeleteDrawPoly(&dc);
break; case ID_LIBEDIT_DELETE_ITEM_BUTT:
if( CurrentLibEntry == NULL )
case ID_POPUP_LIBEDIT_DELETE_ITEM: {
if ( CurrentDrawItem == NULL) break; wxBell(); break;
DrawPanel->MouseToCursorSchema(); }
DrawPanel->CursorOff(&dc); SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
SaveCopyInUndoList(CurrentLibEntry); break;
if ( CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE )
{
DeletePin(&dc, CurrentLibEntry, (LibDrawPin*)CurrentDrawItem); case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
}
// Delete the last created segment, while creating a polyline draw item
else if( CurrentDrawItem == NULL )
{ break;
if ( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur) DrawPanel->MouseToCursorSchema();
DrawPanel->ForceCloseManageCurseur(DrawPanel, &dc); DeleteDrawPoly( &dc );
else DeleteOneLibraryDrawStruct(DrawPanel, &dc, CurrentLibEntry,CurrentDrawItem, TRUE); break;
}
case ID_POPUP_LIBEDIT_DELETE_ITEM:
CurrentDrawItem = NULL; if( CurrentDrawItem == NULL )
m_CurrentScreen->SetModify(); break;
DrawPanel->CursorOn(&dc); DrawPanel->MouseToCursorSchema();
break; DrawPanel->CursorOff( &dc );
SaveCopyInUndoList( CurrentLibEntry );
case ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST: if( CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE )
if ( CurrentDrawItem == NULL) break; {
DrawPanel->MouseToCursorSchema(); DeletePin( &dc, CurrentLibEntry, (LibDrawPin*) CurrentDrawItem );
if ( CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) }
StartMovePin(&dc); else
else if ( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) {
StartMoveField(&dc, (LibDrawField *) CurrentDrawItem); if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
else StartMoveDrawSymbol(&dc); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
break; else
DeleteOneLibraryDrawStruct( DrawPanel, &dc, CurrentLibEntry, CurrentDrawItem, TRUE );
case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT: }
if ( CurrentDrawItem == NULL) break;
DrawPanel->CursorOff(&dc); CurrentDrawItem = NULL;
DrawPanel->MouseToCursorSchema(); m_CurrentScreen->SetModify();
if ( (CurrentDrawItem->m_Flags & IS_NEW) == 0 ) DrawPanel->CursorOn( &dc );
SaveCopyInUndoList(CurrentLibEntry); break;
RotateSymbolText(&dc);
DrawPanel->CursorOn(&dc); case ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST:
break; if( CurrentDrawItem == NULL )
break;
case ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM: DrawPanel->MouseToCursorSchema();
if ( CurrentDrawItem == NULL) break; if( CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE )
DrawPanel->CursorOff(&dc); StartMovePin( &dc );
DrawPanel->MouseToCursorSchema(); else if( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE )
if ( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) StartMoveField( &dc, (LibDrawField*) CurrentDrawItem );
{ else
SaveCopyInUndoList(CurrentLibEntry); StartMoveDrawSymbol( &dc );
RotateField(&dc, (LibDrawField *) CurrentDrawItem); break;
}
DrawPanel->CursorOn(&dc); case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT:
break; if( CurrentDrawItem == NULL )
break;
case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM: DrawPanel->CursorOff( &dc );
if ( CurrentDrawItem == NULL) break; DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOff(&dc); if( (CurrentDrawItem->m_Flags & IS_NEW) == 0 )
if ( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) SaveCopyInUndoList( CurrentLibEntry );
{ RotateSymbolText( &dc );
EditField(&dc, (LibDrawField *) CurrentDrawItem); DrawPanel->CursorOn( &dc );
} break;
DrawPanel->CursorOn(&dc);
break; case ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM:
if( CurrentDrawItem == NULL )
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM: break;
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: DrawPanel->CursorOff( &dc );
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: DrawPanel->MouseToCursorSchema();
if ( (CurrentDrawItem == NULL) || if( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE )
(CurrentDrawItem->Type() != COMPONENT_PIN_DRAW_TYPE) ) {
break; SaveCopyInUndoList( CurrentLibEntry );
SaveCopyInUndoList(CurrentLibEntry); RotateField( &dc, (LibDrawField*) CurrentDrawItem );
GlobalSetPins(&dc, (LibDrawPin *) CurrentDrawItem, id); }
DrawPanel->MouseToCursorSchema(); DrawPanel->CursorOn( &dc );
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM:
DrawPanel->m_AutoPAN_Request = FALSE; if( CurrentDrawItem == NULL )
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; break;
HandleBlockEnd(&dc); DrawPanel->CursorOff( &dc );
break; if( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE )
{
case ID_POPUP_DELETE_BLOCK: EditField( &dc, (LibDrawField*) CurrentDrawItem );
DrawPanel->m_AutoPAN_Request = FALSE; }
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; DrawPanel->CursorOn( &dc );
DrawPanel->MouseToCursorSchema(); break;
HandleBlockEnd(&dc);
break; case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
case ID_POPUP_COPY_BLOCK: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
DrawPanel->m_AutoPAN_Request = FALSE; if( (CurrentDrawItem == NULL)
GetScreen()->BlockLocate.m_Command = BLOCK_COPY; || (CurrentDrawItem->Type() != COMPONENT_PIN_DRAW_TYPE) )
DrawPanel->MouseToCursorSchema(); break;
HandleBlockPlace(&dc); SaveCopyInUndoList( CurrentLibEntry );
break; GlobalSetPins( &dc, (LibDrawPin*) CurrentDrawItem, id );
DrawPanel->MouseToCursorSchema();
case ID_POPUP_SELECT_ITEMS_BLOCK: break;
DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY; case ID_POPUP_ZOOM_BLOCK:
DrawPanel->MouseToCursorSchema(); DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockEnd(&dc); GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
break; HandleBlockEnd( &dc );
break;
case ID_POPUP_INVERT_BLOCK:
DrawPanel->m_AutoPAN_Request = FALSE; case ID_POPUP_DELETE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->MouseToCursorSchema(); GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
HandleBlockPlace(&dc); DrawPanel->MouseToCursorSchema();
break; HandleBlockEnd( &dc );
break;
case ID_POPUP_PLACE_BLOCK:
DrawPanel->m_AutoPAN_Request = FALSE; case ID_POPUP_COPY_BLOCK:
DrawPanel->MouseToCursorSchema(); DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockPlace(&dc); GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
break; DrawPanel->MouseToCursorSchema();
HandleBlockPlace( &dc );
case ID_LIBEDIT_UNDO: break;
GetComponentFromUndoList();
DrawPanel->Refresh(TRUE); case ID_POPUP_SELECT_ITEMS_BLOCK:
break; DrawPanel->m_AutoPAN_Request = FALSE;
GetScreen()->BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY;
case ID_LIBEDIT_REDO: DrawPanel->MouseToCursorSchema();
GetComponentFromRedoList(); HandleBlockEnd( &dc );
DrawPanel->Refresh(TRUE); break;
break;
case ID_POPUP_INVERT_BLOCK:
default: DrawPanel->m_AutoPAN_Request = FALSE;
DisplayError(this, wxT("WinEDA_LibeditFrame::Process_Special_Functions error")); GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
break; DrawPanel->MouseToCursorSchema();
} HandleBlockPlace( &dc );
DrawPanel->MouseToCursorSchema(); break;
DrawPanel->m_IgnoreMouseEvents = FALSE;
case ID_POPUP_PLACE_BLOCK:
if ( m_ID_current_state == 0 ) LibItemToRepeat = NULL; DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->MouseToCursorSchema();
HandleBlockPlace( &dc );
break;
case ID_LIBEDIT_UNDO:
GetComponentFromUndoList();
DrawPanel->Refresh( TRUE );
break;
case ID_LIBEDIT_REDO:
GetComponentFromRedoList();
DrawPanel->Refresh( TRUE );
break;
default:
DisplayError( this, wxT( "WinEDA_LibeditFrame::Process_Special_Functions error" ) );
break;
}
DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE;
if( m_ID_current_state == 0 )
LibItemToRepeat = NULL;
} }
...@@ -177,7 +177,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File, ...@@ -177,7 +177,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File,
} }
else // a true TRACK else // a true TRACK
{ {
newtrack = new TRACK( *track ); newtrack = track->Copy();
newtrack->SetLayer( pcb_layer_number ); newtrack->SetLayer( pcb_layer_number );
} }
......
...@@ -85,6 +85,7 @@ enum SEARCH_RESULT { ...@@ -85,6 +85,7 @@ enum SEARCH_RESULT {
class EDA_BaseStruct; class EDA_BaseStruct;
class WinEDA_DrawFrame; class WinEDA_DrawFrame;
class BOARD;
/** /**
* Class INSPECTOR * Class INSPECTOR
...@@ -433,20 +434,6 @@ public: ...@@ -433,20 +434,6 @@ public:
} }
/**
* Function IsOnOneOfTheseLayers
* returns true if this object is on one of the given layers. Is virtual so
* objects like D_PAD, which reside on multiple layers, can do their own
* form of testing.
* @param aLayerMask The bit-mapped set of layers to test for.
* @return bool - true if on one of the given layers, else false.
*/
virtual bool IsOnOneOfTheseLayers( int aLayerMask ) const
{
return ( (1<<m_Layer) & aLayerMask ) != 0;
}
/** /**
* Function IsLocked * Function IsLocked
* @return bool - true if the object is locked, else false * @return bool - true if the object is locked, else false
...@@ -456,13 +443,17 @@ public: ...@@ -456,13 +443,17 @@ public:
return false; // only MODULEs can be locked at this time. return false; // only MODULEs can be locked at this time.
} }
/** /**
* Function MenuText * Function MenuText
* @return wxString - The text to use in any menu type UI control which * returns the text to use in any menu type UI control which must uniquely
* must identify this item. * identify this item.
* @todo: make this virtual and split into each derived class * @param aBoard The PCB in which this item resides, needed for Net lookup.
* @return wxString
* @todo: maybe: make this virtual and split into each derived class
*/ */
wxString MenuText() const; wxString MenuText( const BOARD* aBoard ) const;
/** /**
* Function MenuIcon * Function MenuIcon
......
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
bool m_AutoPAN_Enable; // TRUE pour autoriser auto pan (autorisation g��ale) bool m_AutoPAN_Enable; // TRUE pour autoriser auto pan (autorisation g��ale)
bool m_AutoPAN_Request; // TRUE pour auto pan (lorsque auto pan n�essaire) bool m_AutoPAN_Request; // TRUE pour auto pan (lorsque auto pan n�essaire)
bool m_IgnoreMouseEvents; // TRUE pour ne par traiter les evenements souris int m_IgnoreMouseEvents; ///< when non-zero, then ignore mouse events
bool m_Block_Enable; // TRUE pour autoriser Bloc Commandes (autorisation g��ale) bool m_Block_Enable; // TRUE pour autoriser Bloc Commandes (autorisation g��ale)
int m_CanStartBlock; // >= 0 (ou >= n) si un bloc peut demarrer int m_CanStartBlock; // >= 0 (ou >= n) si un bloc peut demarrer
......
...@@ -287,7 +287,7 @@ public: ...@@ -287,7 +287,7 @@ public:
* @param aNetcode A netcode to search for. * @param aNetcode A netcode to search for.
* @return EQUIPOT* - the net or NULL if not found. * @return EQUIPOT* - the net or NULL if not found.
*/ */
EQUIPOT* FindNet( int aNetcode ); EQUIPOT* FindNet( int aNetcode ) const;
/** /**
......
...@@ -557,27 +557,13 @@ private: ...@@ -557,27 +557,13 @@ private:
bool m_SelViaSizeBox_Changed; bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu; wxMenu* m_FilesMenu;
#if 0 && defined(DEBUG) // we'll use lower case function names for private member functions.
/** void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
* Function onRightClickBuilder void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
* is a helper function for private use by OnRightClick(). It helps build void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu );
* the hierarchical menu. void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
* @param collectorNdx The index into the COLLECTOR that \a aItem represents. void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
* @param aItem The BOARD_ITEM to provide menu support for, or NULL if void createPopUpBlockMenu( wxMenu* menu );
* nothing was under the mouse.
* @param pPopMenu What to populate with choices.
*/
void onRightClickBuilder( int collectorNdx, BOARD_ITEM* aItem, wxMenu* aPopMenu );
void popUpMenuForFootprints( int collectorNdx, MODULE* aModule, wxMenu* aPopMenu );
void popUpMenuForFpTexts( int collectorNdx, TEXTE_MODULE* aText, wxMenu* aPopMenu );
void popUpMenuForFpPads( int collectorNdx, D_PAD* aPad, wxMenu* aPopMenu );
void popupMenuForTracks( int collectorNdx, TRACK* aTrack, wxMenu* aPopMenu );
#endif
public: public:
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
......
...@@ -450,7 +450,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, ...@@ -450,7 +450,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
} }
/* /* now using PcbGeneralLocateAndDisplay()
// see pcbstruct.h // see pcbstruct.h
BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer ) BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
{ {
...@@ -534,7 +534,7 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer ) ...@@ -534,7 +534,7 @@ BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer )
* @param anetcode The netcode to search for. * @param anetcode The netcode to search for.
* @return EQUIPOT* - the net or NULL if not found. * @return EQUIPOT* - the net or NULL if not found.
*/ */
EQUIPOT* BOARD::FindNet( int anetcode ) EQUIPOT* BOARD::FindNet( int anetcode ) const
{ {
if( anetcode <= 0 ) if( anetcode <= 0 )
return NULL; return NULL;
......
...@@ -39,16 +39,18 @@ public: ...@@ -39,16 +39,18 @@ public:
// chain = 0 indique une connexion non encore traitee // chain = 0 indique une connexion non encore traitee
int m_Param; // Auxiliary variable ( used in some computations ) int m_Param; // Auxiliary variable ( used in some computations )
protected:
TRACK( const TRACK& track ); // protected so Copy() is used instead.
public: public:
TRACK( BOARD_ITEM* StructFather, KICAD_T idtype = TYPETRACK ); TRACK( BOARD_ITEM* StructFather, KICAD_T idtype = TYPETRACK );
TRACK( const TRACK& track );
/** /**
* Function Copy * Function Copy
* will copy this object whether it is a TRACK or a SEGVIA returning * will copy this object whether it is a TRACK or a SEGVIA returning
* the corresponding type. * the corresponding type.
* @return - TRACK* or SEGVIA*, typed as the least common demoninator: TRACK * @return - TRACK*, SEGVIA*, or SEGZONE*, declared as the least common
* demoninator: TRACK
*/ */
TRACK* Copy() const; TRACK* Copy() const;
......
...@@ -191,7 +191,6 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* ...@@ -191,7 +191,6 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
default: default:
break; break;
} }
// common tests: // common tests:
...@@ -202,13 +201,15 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* ...@@ -202,13 +201,15 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
if( m_Guide->IgnoreModulesOnCmp() && module->GetLayer()==LAYER_CMP_N ) if( m_Guide->IgnoreModulesOnCmp() && module->GetLayer()==LAYER_CMP_N )
goto exit; goto exit;
} }
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() ) if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() )
{ {
int layer = item->GetLayer(); int layer = item->GetLayer();
if( m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() ) // Modules and their subcomponents: text and pads are not sensitive to the layer
// visibility controls. They all have their own separate visibility controls
if( module || m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() )
{ {
if( !m_Guide->IsLayerLocked(layer) || !m_Guide->IgnoreLockedLayers() ) if( !m_Guide->IsLayerLocked(layer) || !m_Guide->IgnoreLockedLayers() )
{ {
...@@ -233,7 +234,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* ...@@ -233,7 +234,9 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
int layer = item->GetLayer(); int layer = item->GetLayer();
if( m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() ) // Modules and their subcomponents: text and pads are not sensitive to the layer
// visibility controls. They all have their own separate visibility controls
if( module || m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() )
{ {
if( !m_Guide->IsLayerLocked(layer) || !m_Guide->IgnoreLockedLayers() ) if( !m_Guide->IsLayerLocked(layer) || !m_Guide->IgnoreLockedLayers() )
{ {
......
...@@ -124,10 +124,11 @@ void RemoteCommand( const char* cmdline ) ...@@ -124,10 +124,11 @@ void RemoteCommand( const char* cmdline )
// @todo: move this to proper source file. // @todo: move this to proper source file.
wxString BOARD_ITEM::MenuText() const wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
{ {
wxString text; wxString text;
const BOARD_ITEM* item = this; const BOARD_ITEM* item = this;
EQUIPOT* net;
switch( item->Type() ) switch( item->Type() )
{ {
...@@ -140,11 +141,13 @@ wxString BOARD_ITEM::MenuText() const ...@@ -140,11 +141,13 @@ wxString BOARD_ITEM::MenuText() const
break; break;
case TYPEPAD: case TYPEPAD:
text << _("Pad") << wxT(" ") << ((D_PAD*)item)->ReturnStringPadName() << _(" of ") << GetParent()->MenuText(); text << _("Pad") << wxT(" ") << ((D_PAD*)item)->ReturnStringPadName() << _(" of ")
// << GetParent()->MenuText( aPcb );
<< ((MODULE*)GetParent())->GetReference();
break; break;
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
text << _("PGraphic"); text << _("Pcb Graphic") << _(" on ") << ReturnPcbLayerName( item->GetLayer() ); // @todo: extend text
break; break;
case TYPETEXTE: case TYPETEXTE:
...@@ -163,29 +166,63 @@ wxString BOARD_ITEM::MenuText() const ...@@ -163,29 +166,63 @@ wxString BOARD_ITEM::MenuText() const
break; break;
case TEXT_is_VALUE: case TEXT_is_VALUE:
text << _( "Value" ) << wxT( " " ) << ((TEXTE_MODULE*)item)->m_Text << _(" of ") << GetParent()->MenuText(); text << _( "Value" ) << wxT( " " ) << ((TEXTE_MODULE*)item)->m_Text << _(" of ")
// << GetParent()->MenuText( aPcb );
<< ((MODULE*)GetParent())->GetReference();
break; break;
default: default: // wrap this one in quotes:
text << _( "Text" ) << wxT( " " ) << ((TEXTE_MODULE*)item)->m_Text << _(" of ") << GetParent()->MenuText(); text << _( "Text" ) << wxT( " \"" ) << ((TEXTE_MODULE*)item)->m_Text << wxT("\"") << _(" of ")
// << GetParent()->MenuText( aPcb );
<< ((MODULE*)GetParent())->GetReference();
break; break;
} }
break; break;
case TYPEEDGEMODULE: case TYPEEDGEMODULE:
text << _("MGraphic"); // @todo: expand on the text text << _("Graphic") << wxT( " " );
const wxChar* cp;
switch( ((EDGE_MODULE*)item)->m_Shape )
{
case S_SEGMENT: cp = _("Line"); break;
case S_RECT: cp = _("Rect"); break;
case S_ARC: cp = _("Arc"); break;
case S_CIRCLE: cp = _("Circle"); break;
/* used?
case S_ARC_RECT: cp = wxT("arc_rect"); break;
case S_SPOT_OVALE: cp = wxT("spot_oval"); break;
case S_SPOT_CIRCLE: cp = wxT("spot_circle"); break;
case S_SPOT_RECT: cp = wxT("spot_rect"); break;
case S_POLYGON: cp = wxT("polygon"); break;
*/
default: cp = wxT("??EDGE??"); break;
}
text << *cp << _(" of ")
// << GetParent()->MenuText( aPcb );
<< ((MODULE*)GetParent())->GetReference();
break; break;
case TYPETRACK: case TYPETRACK:
text << _("Track"); // @todo: expand on the text text << _("Track") << wxT(" ") << ((TRACK*)item)->m_NetCode;
net = aPcb->FindNet( ((TRACK*)item)->m_NetCode );
if( net )
{
text << wxT( " [" ) << net->m_Netname << wxT("]");
}
text << _(" on ") << ReturnPcbLayerName( item->GetLayer() );
break; break;
case TYPEZONE: case TYPEZONE:
text << _("Zone"); // @todo: expand on the text text << _("Zone") << _(" on ") << ReturnPcbLayerName( item->GetLayer() );
break; break;
case TYPEVIA: case TYPEVIA:
text << _("Via"); // @todo: expand on text text << _("Via") << wxT(" ") << ((SEGVIA*)item)->m_NetCode;
net = aPcb->FindNet( ((TRACK*)item)->m_NetCode );
if( net )
{
text << wxT( " [" ) << net->m_Netname << wxT("]");
}
break; break;
case TYPEMARQUEUR: case TYPEMARQUEUR:
...@@ -201,7 +238,7 @@ wxString BOARD_ITEM::MenuText() const ...@@ -201,7 +238,7 @@ wxString BOARD_ITEM::MenuText() const
break; break;
case TYPEEDGEZONE: case TYPEEDGEZONE:
text << _("Graphic"); // @todo: extend text text << _("Edge Zone") << _(" on ") << ReturnPcbLayerName( item->GetLayer() ); // @todo: extend text
break; break;
default: default:
...@@ -418,7 +455,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay() ...@@ -418,7 +455,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
item = (*m_Collector)[i]; item = (*m_Collector)[i];
text = item->MenuText(); text = item->MenuText( m_Pcb );
xpm = item->MenuIcon(); xpm = item->MenuIcon();
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START+i, text, xpm ); ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START+i, text, xpm );
......
...@@ -147,7 +147,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC ) ...@@ -147,7 +147,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* track, wxDC* DC )
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
{ {
// Create 2 segments // Create 2 segments
g_CurrentTrackSegment = new TRACK( *g_CurrentTrackSegment ); g_CurrentTrackSegment = g_CurrentTrackSegment->Copy();
g_TrackSegmentCount++; g_TrackSegmentCount++;
g_CurrentTrackSegment->Pback = g_FirstTrackSegment; g_CurrentTrackSegment->Pback = g_FirstTrackSegment;
g_FirstTrackSegment->Pnext = g_CurrentTrackSegment; g_FirstTrackSegment->Pnext = g_CurrentTrackSegment;
...@@ -797,7 +797,7 @@ void EnsureEndTrackOnPad( D_PAD* Pad ) ...@@ -797,7 +797,7 @@ void EnsureEndTrackOnPad( D_PAD* Pad )
if( !g_CurrentTrackSegment->IsNull() ) if( !g_CurrentTrackSegment->IsNull() )
{ {
/* Must create a new segment, from track end to pad center */ /* Must create a new segment, from track end to pad center */
g_CurrentTrackSegment = new TRACK( *lasttrack ); g_CurrentTrackSegment = lasttrack->Copy();
g_TrackSegmentCount++; g_TrackSegmentCount++;
lasttrack->Pnext = g_CurrentTrackSegment; lasttrack->Pnext = g_CurrentTrackSegment;
g_CurrentTrackSegment->Pback = lasttrack; g_CurrentTrackSegment->Pback = lasttrack;
......
...@@ -55,19 +55,6 @@ ...@@ -55,19 +55,6 @@
#include "Flag.xpm" #include "Flag.xpm"
/* local functions */
static void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition,
wxMenu* PopMenu );
static void CreatePopUpMenuForFootprints( MODULE* Footprint, wxMenu* menu, bool full_menu );
static void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu );
static void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu );
static void CreatePopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
static void CreatePopUpBlockMenu( wxMenu* menu );
/*****/
/********************************************/ /********************************************/
static wxMenu* Append_Track_Width_List() static wxMenu* Append_Track_Width_List()
/********************************************/ /********************************************/
...@@ -168,7 +155,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -168,7 +155,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if( (item && item->m_Flags) || BlockActive ) if( (item && item->m_Flags) || BlockActive )
{ {
if( BlockActive ) if( BlockActive )
CreatePopUpBlockMenu( aPopMenu ); createPopUpBlockMenu( aPopMenu );
else else
{ {
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
...@@ -194,10 +181,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -194,10 +181,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
switch( item->Type() ) switch( item->Type() )
{ {
case TYPEMODULE: case TYPEMODULE:
if( !flags ) createPopUpMenuForFootprints( (MODULE*) item, aPopMenu );
CreatePopUpMenuForFootprints( (MODULE*) item, aPopMenu, TRUE );
else
CreatePopUpMenuForFootprints( (MODULE*) item, aPopMenu, FALSE );
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE )
{ {
...@@ -219,37 +203,11 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -219,37 +203,11 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
break; break;
case TYPEPAD: case TYPEPAD:
CreatePopUpMenuForPads( (D_PAD*) item, aPopMenu ); createPopUpMenuForFpPads( (D_PAD*) item, aPopMenu );
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
{
if( !flags )
{
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) );
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) );
}
}
if( !flags )
{
MODULE* module = (MODULE*) item->m_Parent;
if( module )
{
aPopMenu->AppendSeparator();
CreatePopUpMenuForFootprints( module, aPopMenu, TRUE );
}
}
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
CreatePopUpMenuForFpTexts( (TEXTE_MODULE*) item, aPopMenu ); createPopUpMenuForFpTexts( (TEXTE_MODULE*) item, aPopMenu );
if( !flags )
{
MODULE* module = (MODULE*) item->m_Parent;
if( module )
{
aPopMenu->AppendSeparator();
CreatePopUpMenuForFootprints( module, aPopMenu, TRUE );
}
}
break; break;
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
...@@ -278,14 +236,13 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -278,14 +236,13 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
break; break;
case TYPETEXTE: case TYPETEXTE:
CreatePopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu ); createPopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu );
break; break;
case TYPETRACK: case TYPETRACK:
case TYPEVIA: case TYPEVIA:
locate_track = TRUE; locate_track = TRUE;
CreatePopupMenuForTracks( (TRACK*) item, GetScreen()->m_Curseur, createPopupMenuForTracks( (TRACK*) item, aPopMenu );
aPopMenu );
break; break;
case TYPEZONE: case TYPEZONE:
...@@ -469,7 +426,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -469,7 +426,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
/****************************************/ /****************************************/
void CreatePopUpBlockMenu( wxMenu* menu ) void WinEDA_PcbFrame::createPopUpBlockMenu( wxMenu* menu )
/****************************************/ /****************************************/
/* Create Pop sub menu for block commands /* Create Pop sub menu for block commands
...@@ -494,13 +451,14 @@ void CreatePopUpBlockMenu( wxMenu* menu ) ...@@ -494,13 +451,14 @@ void CreatePopUpBlockMenu( wxMenu* menu )
/********************************************************************/ /********************************************************************/
void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition, void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
wxMenu* PopMenu )
/*******************************************************************/ /*******************************************************************/
/* Create command lines for a popup menu, for track editing /* Create command lines for a popup menu, for track editing
*/ */
{ {
wxPoint cursorPosition = GetScreen()->m_Curseur;
int flags = Track->m_Flags; int flags = Track->m_Flags;
if( flags == 0 ) if( flags == 0 )
...@@ -532,7 +490,7 @@ void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition, ...@@ -532,7 +490,7 @@ void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition,
} }
else else
{ {
if( Track->IsPointOnEnds( CursorPosition, -1 ) != 0 ) if( Track->IsPointOnEnds( cursorPosition, -1 ) != 0 )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE,
_( "Move Node" ), move_xpm ); _( "Move Node" ), move_xpm );
...@@ -623,7 +581,7 @@ void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition, ...@@ -623,7 +581,7 @@ void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition,
/*********************************************************************************/ /*********************************************************************************/
void CreatePopUpMenuForFootprints( MODULE* aModule, wxMenu* menu, bool full_menu ) void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu )
/*********************************************************************************/ /*********************************************************************************/
/* Create the wxMenuitem list for footprint editing /* Create the wxMenuitem list for footprint editing
...@@ -632,12 +590,12 @@ void CreatePopUpMenuForFootprints( MODULE* aModule, wxMenu* menu, bool full_menu ...@@ -632,12 +590,12 @@ void CreatePopUpMenuForFootprints( MODULE* aModule, wxMenu* menu, bool full_menu
wxMenu* sub_menu_footprint; wxMenu* sub_menu_footprint;
int flags = aModule->m_Flags; int flags = aModule->m_Flags;
wxString msg = aModule->MenuText(); wxString msg = aModule->MenuText( m_Pcb );
sub_menu_footprint = new wxMenu; sub_menu_footprint = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm ); ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm );
if( full_menu ) if( !flags )
{ {
ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST, ADD_MENUITEM( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST,
_( "Move (M)" ), Move_Module_xpm ); _( "Move (M)" ), Move_Module_xpm );
...@@ -663,7 +621,7 @@ void CreatePopUpMenuForFootprints( MODULE* aModule, wxMenu* menu, bool full_menu ...@@ -663,7 +621,7 @@ void CreatePopUpMenuForFootprints( MODULE* aModule, wxMenu* menu, bool full_menu
/********************************************************************/ /********************************************************************/
void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu ) void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu )
/********************************************************************/ /********************************************************************/
/* Create the wxMenuitem list for editing texts on footprints /* Create the wxMenuitem list for editing texts on footprints
...@@ -672,7 +630,7 @@ void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu ) ...@@ -672,7 +630,7 @@ void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu )
wxMenu* sub_menu_Fp_text; wxMenu* sub_menu_Fp_text;
int flags = FpText->m_Flags; int flags = FpText->m_Flags;
wxString msg = FpText->MenuText(); wxString msg = FpText->MenuText( m_Pcb );
sub_menu_Fp_text = new wxMenu; sub_menu_Fp_text = new wxMenu;
...@@ -690,18 +648,28 @@ void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu ) ...@@ -690,18 +648,28 @@ void CreatePopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu )
if( FpText->m_Type == TEXT_is_DIVERS ) if( FpText->m_Type == TEXT_is_DIVERS )
ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE, ADD_MENUITEM( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE,
_( "Delete" ), delete_xpm ); _( "Delete" ), delete_xpm );
if( !flags )
{
MODULE* module = (MODULE*) FpText->GetParent();
if( module )
{
menu->AppendSeparator();
createPopUpMenuForFootprints( module, menu );
}
}
} }
/***************************************************************/ /***************************************************************/
void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu ) void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
/***************************************************************/ /***************************************************************/
/* Create pop menu for pads */ /* Create pop menu for pads */
{ {
wxMenu* sub_menu_Pad; wxMenu* sub_menu_Pad;
int flags = Pad->m_Flags; int flags = Pad->m_Flags;
wxString msg = Pad->MenuText(); wxString msg = Pad->MenuText( m_Pcb );
sub_menu_Pad = new wxMenu; sub_menu_Pad = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm ); ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm );
...@@ -729,18 +697,36 @@ void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu ) ...@@ -729,18 +697,36 @@ void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu )
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD,
_( "delete" ), Delete_Pad_xpm ); _( "delete" ), Delete_Pad_xpm );
} }
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
{
if( !flags )
{
menu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) );
menu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) );
}
}
if( !flags )
{
MODULE* module = (MODULE*) Pad->GetParent();
if( module )
{
menu->AppendSeparator();
createPopUpMenuForFootprints( module, menu );
}
}
} }
/*************************************************************/ /*************************************************************/
void CreatePopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
/*************************************************************/ /*************************************************************/
/* Create pop menu for pcb texts */ /* Create pop menu for pcb texts */
{ {
wxMenu* sub_menu_Text; wxMenu* sub_menu_Text;
int flags = Text->m_Flags; int flags = Text->m_Flags;
wxString msg = Text->MenuText(); wxString msg = Text->MenuText( m_Pcb );
sub_menu_Text = new wxMenu; sub_menu_Text = new wxMenu;
......
...@@ -57,7 +57,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, ...@@ -57,7 +57,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
m_CanStartBlock = -1; // Command block can start if >= 0 m_CanStartBlock = -1; // Command block can start if >= 0
m_AbortEnable = m_AbortRequest = FALSE; m_AbortEnable = m_AbortRequest = FALSE;
m_AutoPAN_Enable = TRUE; m_AutoPAN_Enable = TRUE;
m_IgnoreMouseEvents = FALSE; m_IgnoreMouseEvents = 0;
ManageCurseur = NULL; ManageCurseur = NULL;
ForceCloseManageCurseur = NULL; ForceCloseManageCurseur = NULL;
......
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