Commit 3806557f authored by charras's avatar charras

Eeschema: fixed: root components non found in schematic

parent f54a9e58
......@@ -8,7 +8,7 @@
#include "appl_wxstruct.h"
#define BUILD_VERSION "(20090808-unstable)"
#define BUILD_VERSION "(20090827-unstable)"
#ifdef HAVE_SVN_VERSION
......
......@@ -583,7 +583,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
{
SCH_ITEM* Struct;
EDA_DrawLineStruct* SegmStruct;
PICKED_ITEMS_LIST* pickedlist = &screen->m_BlockLocate.m_ItemsSelection;
if( pickedlist->GetCount() == 0 )
......@@ -632,7 +632,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
// Save m_Flags for Undo/redo drag operations:
pickedlist->SetPickerFlags(SegmStruct->m_Flags, ii);
}
}
......
......@@ -588,12 +588,12 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
if( Screen->GetCurItem() ) /* trace en cours */
{
Panel->ManageCurseur( Panel, DC, FALSE );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
EraseStruct( (SCH_ITEM*) Screen->GetCurItem(), (SCH_SCREEN*) Screen );
Screen->SetCurItem( NULL );
RestoreOldWires( Screen );
Panel->Refresh();
}
else
g_ItemToRepeat = NULL; // Fin de commande generale
......
......@@ -124,13 +124,14 @@ LibCmpEntry* LibraryStruct::FindEntry( const wxChar* name, LibrEntryType type )
if( entry != NULL && entry->Type != ROOT && type == ROOT )
{
EDA_LibCmpAliasStruct* alias = ( EDA_LibCmpAliasStruct* ) entry;
const wxChar* rootname = alias->m_RootName.GetData();
PQCompFunc( (PQCompFuncType) LibraryEntryCompare );
entry = (LibCmpEntry*) PQFirst( &m_Entries, false );
while( entry )
{
if( entry->m_Name.m_Text.CmpNoCase( name ) == 0
if( entry->m_Name.m_Text.CmpNoCase( rootname ) == 0
&& entry->Type == ROOT )
break;
......
......@@ -87,7 +87,7 @@ public:
* should give better search capability.
*
* @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 sort - Sort names if true.
*/
......
......@@ -484,13 +484,14 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
wxPoint pos = frame->GetScreen()->m_Curseur;
if( is_new )
{
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;
}
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_CONNECTION, _(
"Delete Connection" ), delete_connection_xpm );
......@@ -523,13 +524,15 @@ void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
wxPoint pos = frame->GetScreen()->m_Curseur;
if( is_new )
{
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm );
return;
}
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE,
_( "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 );
PopMenu->AppendSeparator();
......
......@@ -60,6 +60,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
case ID_POPUP_SCH_MOVE_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_MIROR_X_CMP:
case ID_POPUP_SCH_MIROR_Y_CMP:
......@@ -421,9 +422,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
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
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{
......@@ -437,7 +439,34 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
Process_Move_Item( (SCH_ITEM*) screen->GetCurItem(), &dc );
break;
case ID_POPUP_SCH_EDIT_CMP:
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:
// Ensure the struct is a component (could be a struct of a
// component, like Field, text..)
......
......@@ -265,7 +265,7 @@ enum main_id {
ID_POPUP_SCH_MOVE_CMP_REQUEST,
ID_POPUP_SCH_DELETE_CMP,
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_ENTRY_SELECT_SLASH,
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