Commit 3806557f authored by charras's avatar charras

Eeschema: fixed: root components non found in schematic

parent f54a9e58
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#define BUILD_VERSION "(20090808-unstable)" #define BUILD_VERSION "(20090827-unstable)"
#ifdef HAVE_SVN_VERSION #ifdef HAVE_SVN_VERSION
......
...@@ -588,12 +588,12 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -588,12 +588,12 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
if( Screen->GetCurItem() ) /* trace en cours */ if( Screen->GetCurItem() ) /* trace en cours */
{ {
Panel->ManageCurseur( Panel, DC, FALSE );
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
EraseStruct( (SCH_ITEM*) Screen->GetCurItem(), (SCH_SCREEN*) Screen ); EraseStruct( (SCH_ITEM*) Screen->GetCurItem(), (SCH_SCREEN*) Screen );
Screen->SetCurItem( NULL ); Screen->SetCurItem( NULL );
RestoreOldWires( Screen ); RestoreOldWires( Screen );
Panel->Refresh();
} }
else else
g_ItemToRepeat = NULL; // Fin de commande generale g_ItemToRepeat = NULL; // Fin de commande generale
......
...@@ -124,13 +124,14 @@ LibCmpEntry* LibraryStruct::FindEntry( const wxChar* name, LibrEntryType type ) ...@@ -124,13 +124,14 @@ LibCmpEntry* LibraryStruct::FindEntry( const wxChar* name, LibrEntryType type )
if( entry != NULL && entry->Type != ROOT && type == ROOT ) if( entry != NULL && entry->Type != ROOT && type == ROOT )
{ {
EDA_LibCmpAliasStruct* alias = ( EDA_LibCmpAliasStruct* ) entry; EDA_LibCmpAliasStruct* alias = ( EDA_LibCmpAliasStruct* ) entry;
const wxChar* rootname = alias->m_RootName.GetData();
PQCompFunc( (PQCompFuncType) LibraryEntryCompare ); PQCompFunc( (PQCompFuncType) LibraryEntryCompare );
entry = (LibCmpEntry*) PQFirst( &m_Entries, false ); entry = (LibCmpEntry*) PQFirst( &m_Entries, false );
while( entry ) while( entry )
{ {
if( entry->m_Name.m_Text.CmpNoCase( name ) == 0 if( entry->m_Name.m_Text.CmpNoCase( rootname ) == 0
&& entry->Type == ROOT ) && entry->Type == ROOT )
break; break;
......
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
* should give better search capability. * should give better search capability.
* *
* @param names - String array to place entry names into. * @param names - String array to place entry names into.
* @parem nameSearch - Name wild card search criteria. * @param nameSearch - Name wild card search criteria.
* @param keySearch - Key word search criteria. * @param keySearch - Key word search criteria.
* @param sort - Sort names if true. * @param sort - Sort names if true.
*/ */
......
...@@ -484,13 +484,14 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire, ...@@ -484,13 +484,14 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
wxPoint pos = frame->GetScreen()->m_Curseur; wxPoint pos = frame->GetScreen()->m_Curseur;
if( is_new ) if( is_new )
{
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Wire End" ), apply_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Wire End" ), apply_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Wire" ), delete_xpm );
if( is_new )
return; return;
}
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, _( "Drag Wire" ), move_track_xpm );
PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Wire" ), delete_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _(
"Delete Connection" ), delete_connection_xpm ); "Delete Connection" ), delete_connection_xpm );
...@@ -523,12 +524,14 @@ void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus, ...@@ -523,12 +524,14 @@ void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
wxPoint pos = frame->GetScreen()->m_Curseur; wxPoint pos = frame->GetScreen()->m_Curseur;
if( is_new ) if( is_new )
{
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm );
return;
}
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE,
_( "Delete Bus" ), delete_bus_xpm ); _( "Delete Bus" ), delete_bus_xpm );
if( !is_new )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE,
_( "Break Bus" ), break_bus_xpm ); _( "Break Bus" ), break_bus_xpm );
......
...@@ -60,6 +60,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -60,6 +60,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_ITEM_REQUEST: case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
case ID_POPUP_SCH_MOVE_CMP_REQUEST: case ID_POPUP_SCH_MOVE_CMP_REQUEST:
case ID_POPUP_SCH_DRAG_CMP_REQUEST: case ID_POPUP_SCH_DRAG_CMP_REQUEST:
case ID_POPUP_SCH_DRAG_WIRE_REQUEST:
case ID_POPUP_SCH_EDIT_CMP: case ID_POPUP_SCH_EDIT_CMP:
case ID_POPUP_SCH_MIROR_X_CMP: case ID_POPUP_SCH_MIROR_X_CMP:
case ID_POPUP_SCH_MIROR_Y_CMP: case ID_POPUP_SCH_MIROR_Y_CMP:
...@@ -421,9 +422,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -421,9 +422,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_ITEM_REQUEST: case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( id == ID_POPUP_SCH_DRAG_CMP_REQUEST ) if( (id == ID_POPUP_SCH_DRAG_CMP_REQUEST ) ||
(id == ID_POPUP_SCH_DRAG_WIRE_REQUEST ) )
{ {
// The easiest way to handle a drag component is simulate a // The easiest way to handle a drag component is to simulate a
// block drag command // block drag command
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ {
...@@ -437,6 +439,33 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -437,6 +439,33 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
Process_Move_Item( (SCH_ITEM*) screen->GetCurItem(), &dc ); Process_Move_Item( (SCH_ITEM*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_DRAG_WIRE_REQUEST:
DrawPanel->MouseToCursorSchema();
// The easiest way to handle a drag component is to simulate a
// block drag command
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{
if( !HandleBlockBegin( &dc, BLOCK_DRAG,
screen->m_Curseur ) )
break;
// Ensure the block selection contains the segment, or one end of the segment
// the initial rect is only one point (w = h = 0)
// The rect must contains one or 2 ends.
// If only one end is selected, this is a drag Node
// if no ends selected, we adjust the rect area to contain the whole segment
// This works fine only for H and V segments and only if they do not cross a component
// TODO: a better way to drag only wires
EDA_DrawLineStruct* segm = (EDA_DrawLineStruct*)screen->GetCurItem();
if( !screen->m_BlockLocate.Inside(segm->m_Start) &&
!screen->m_BlockLocate.Inside(segm->m_End) )
{
screen->m_BlockLocate.SetOrigin(segm->m_Start);
screen->m_BlockLocate.SetEnd(segm->m_End);
}
HandleBlockEnd( &dc );
}
break;
case ID_POPUP_SCH_EDIT_CMP: case ID_POPUP_SCH_EDIT_CMP:
// Ensure the struct is a component (could be a struct of a // Ensure the struct is a component (could be a struct of a
......
...@@ -265,7 +265,7 @@ enum main_id { ...@@ -265,7 +265,7 @@ enum main_id {
ID_POPUP_SCH_MOVE_CMP_REQUEST, ID_POPUP_SCH_MOVE_CMP_REQUEST,
ID_POPUP_SCH_DELETE_CMP, ID_POPUP_SCH_DELETE_CMP,
ID_POPUP_SCH_DRAG_CMP_REQUEST, ID_POPUP_SCH_DRAG_CMP_REQUEST,
ID_POPUP_SCH_UNUSED_1, ID_POPUP_SCH_DRAG_WIRE_REQUEST,
ID_POPUP_SCH_UNUSED_2, ID_POPUP_SCH_UNUSED_2,
ID_POPUP_SCH_ENTRY_SELECT_SLASH, ID_POPUP_SCH_ENTRY_SELECT_SLASH,
ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH,
......
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