Commit f5bddb2b authored by lifekidyeaa's avatar lifekidyeaa

* added hotkeys to the library editor in eeschema (move, edit pin, delete)

* fixed a bug in hierarchal shematics where a loop (e.g. same file included at different points in the 
hierarchy)  would cause infinite memory use.   
* added a edit footprint hotkey to eeschema, since it seems I'm always editing '0603' '0402' etc. on the 
common components, and it was difficult to edit this information before.
parent cbaf4f9f
......@@ -781,9 +781,10 @@ void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxD
PartTextStruct* TextField = &Cmp->m_Field[VALUE];
msg = TextField->m_Text;
Get_Message( _( "Value" ), msg, this );
if( Get_Message( _( "Value" ), msg, this ) )
msg.Empty(); //allow the user to remove the value.
if( !msg.IsEmpty() )
if( !msg.IsEmpty() && !msg.IsEmpty())
{
/* save old cmp in undo list if not already in edit, or moving ... */
if( Cmp->m_Flags == 0 )
......@@ -799,7 +800,58 @@ void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxD
Cmp->Display_Infos( this );
}
/*****************************************************************************************/
void WinEDA_SchematicFrame::EditComponentFootprint( EDA_SchComponentStruct* Cmp, wxDC* DC )
/*****************************************************************************************/
{
wxString msg;
EDA_LibComponentStruct* Entry;
int flag = 0;
bool wasEmpty = false;
if( Cmp == NULL )
return;
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL )
return;
if( Entry->m_UnitCount > 1 )
flag = 1;
PartTextStruct* TextField = &Cmp->m_Field[FOOTPRINT];
msg = TextField->m_Text;
if(msg.IsEmpty() )
wasEmpty = true;
if( Get_Message( _( "Footprint" ), msg, this ) )
msg.Empty(); //allow the user to remove the value.
/* save old cmp in undo list if not already in edit, or moving ... */
if( Cmp->m_Flags == 0 )
SaveCopyInUndoList( Cmp, IS_CHANGED );
DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag, g_XorMode );
//move the field if it was new.
if(wasEmpty && !msg.IsEmpty())
{
Cmp->m_Field[FOOTPRINT].m_Pos = Cmp->m_Field[REFERENCE].m_Pos;
//add offset here - ? suitable heuristic below?
Cmp->m_Field[FOOTPRINT].m_Pos.x +=
(Cmp->m_Field[REFERENCE].m_Pos.x - Cmp->m_Pos.x) > 0 ?
(Cmp->m_Field[REFERENCE].m_Size.x) : (-1*Cmp->m_Field[REFERENCE].m_Size.x);
Cmp->m_Field[FOOTPRINT].m_Pos.y +=
(Cmp->m_Field[REFERENCE].m_Pos.y - Cmp->m_Pos.y) > 0 ?
(Cmp->m_Field[REFERENCE].m_Size.y) : (-1*Cmp->m_Field[REFERENCE].m_Size.y);
Cmp->m_Field[FOOTPRINT].m_Orient = Cmp->m_Field[REFERENCE].m_Orient;
}
TextField->m_Text = msg;
DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag,
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
m_CurrentScreen->SetModify();
Cmp->Display_Infos( this );
}
/*****************************************************************************/
void WinEDA_ComponentPropertiesFrame::SetInitCmp( wxCommandEvent& event )
/*****************************************************************************/
......
......@@ -194,7 +194,22 @@ void LoadSubHierarchy( WinEDA_SchematicFrame* frame, EDA_BaseStruct* DrawList )
}
if( !STRUCT->m_FileName.IsEmpty() )
{
if( frame->LoadOneEEFile( STRUCT, STRUCT->m_FileName ) == TRUE )
//problem -- must check for closed loops here, or we may never exit!
//search back up the linked list tree...
EDA_BaseStruct* strct = EEDrawList;
bool noRecurse = true;
while( strct->m_Parent ){
strct = strct->m_Parent;
if( ((DrawSheetStruct*)strct)->m_FileName ==
STRUCT->m_FileName ){
wxString msg;
msg += wxString::Format(_( "The sheet hierarchy has an infinite loop, halting recursive loads. file: "));
msg += STRUCT->m_FileName;
DisplayError( frame, msg );
noRecurse = false;
}
}
if( frame->LoadOneEEFile( STRUCT, STRUCT->m_FileName ) == TRUE && noRecurse)
{
LoadSubHierarchy( frame, STRUCT->EEDrawList );
}
......
......@@ -62,6 +62,8 @@ static Ki_HotkeyInfo HkOrientNormalComponent( wxT(
"Orient Normal Component" ),
HK_ORIENT_NORMAL_COMPONENT, 'N' );
static Ki_HotkeyInfo HkRotateComponent( wxT( "Rotate Component" ), HK_ROTATE_COMPONENT, 'R' );
static Ki_HotkeyInfo HkEditComponentValue( wxT( "Edit Component Value" ), HK_EDIT_COMPONENT_VALUE, 'V' );
static Ki_HotkeyInfo HkEditComponentFootprint( wxT( "Edit Component Footprint" ), HK_EDIT_COMPONENT_FOOTPRINT, 'F' );
static Ki_HotkeyInfo HkMoveComponent( wxT( "Move Component" ), HK_MOVE_COMPONENT, 'M', ID_POPUP_SCH_MOVE_CMP_REQUEST );
static Ki_HotkeyInfo HkDragComponent( wxT( "Drag Component" ), HK_DRAG_COMPONENT, 'G', ID_POPUP_SCH_DRAG_CMP_REQUEST );
static Ki_HotkeyInfo HkMove2Drag( wxT(
......@@ -73,6 +75,9 @@ static Ki_HotkeyInfo HkNextSearch( wxT( "Next Search" ), HK_NEXT_SEARCH, WXK_
// Library editor:
static Ki_HotkeyInfo HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
static Ki_HotkeyInfo HkEditPin( wxT( "Edit Pin" ), HK_EDIT_PIN, 'E' );
static Ki_HotkeyInfo HkMovePin( wxT( "Move Pin" ), HK_MOVE_PIN, 'M' );
static Ki_HotkeyInfo HkDeletePin( wxT( "Delete Pin" ), HK_DELETE_PIN, WXK_DELETE );
// List of common hotkey descriptors
......@@ -91,6 +96,7 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
&HkDelete, &HkInsert, &HkMove2Drag,
&HkMoveComponent, &HkDragComponent, &HkAddComponent,
&HkRotateComponent, &HkMirrorXComponent, &HkMirrorYComponent, &HkOrientNormalComponent,
&HkEditComponentValue, &HkEditComponentFootprint,
&HkBeginWire,
NULL
};
......@@ -99,6 +105,9 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] =
{
&HkInsertPin,
&HkEditPin,
&HkMovePin,
&HkDeletePin,
NULL
};
......@@ -366,6 +375,29 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
wxPostEvent( this, event );
}
break;
case HK_EDIT_COMPONENT_VALUE:
if( ItemInEdit )
break;
if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() );
if(DrawStruct)
{
EditComponentValue(
(EDA_SchComponentStruct*) DrawStruct, DC );
}
break;
case HK_EDIT_COMPONENT_FOOTPRINT:
if( ItemInEdit )
break;
if( DrawStruct == NULL )
DrawStruct = LocateSmallestComponent( GetScreen() );
if(DrawStruct)
{
EditComponentFootprint(
(EDA_SchComponentStruct*) DrawStruct, DC );
}
break;
}
if( RefreshToolBar )
......@@ -390,6 +422,8 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
return;
wxPoint MousePos = m_CurrentScreen->m_MousePosition;
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 )
......@@ -453,8 +487,36 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
else
wxBell();
break;
}
case HK_EDIT_PIN:
if(DrawEntry)
CurrentDrawItem = DrawEntry;
if(CurrentDrawItem)
{
if(CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE)
InstallPineditFrame( this, DC, MousePos );
}
break;
case HK_DELETE_PIN:
if(DrawEntry)
CurrentDrawItem = DrawEntry;
if(CurrentDrawItem)
{
wxCommandEvent evt;
evt.SetId(ID_POPUP_LIBEDIT_DELETE_ITEM);
Process_Special_Functions(evt);
}
break;
case HK_MOVE_PIN:
if(DrawEntry)
CurrentDrawItem = DrawEntry;
if(CurrentDrawItem)
{
wxCommandEvent evt;
evt.SetId(ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST);
Process_Special_Functions(evt);
}
break;
}
if( RefreshToolBar )
SetToolbars();
}
......@@ -17,10 +17,15 @@ enum hotkey_id_commnand {
HK_NEXT_SEARCH,
HK_DELETE,
HK_REPEAT_LAST,
HK_EDIT_PIN,
HK_MOVE_PIN,
HK_DELETE_PIN,
HK_UNDO,
HK_REDO,
HK_MOVEBLOCK_TO_DRAGBLOCK,
HK_ROTATE_COMPONENT,
HK_EDIT_COMPONENT_VALUE,
HK_EDIT_COMPONENT_FOOTPRINT,
HK_MIRROR_X_COMPONENT,
HK_MIRROR_Y_COMPONENT,
HK_ORIENT_NORMAL_COMPONENT,
......
......@@ -370,7 +370,7 @@ EDA_LibComponentStruct * NewStruct;
int diag;
if( CurrentLibEntry )
if( ! IsOK(this, _("Delete old component?")) ) return;
if( ! IsOK(this, _("Clear old component from screen (changes will be lost)?")) ) return;
CurrentDrawItem = NULL;
......
......@@ -17,6 +17,7 @@
#include "protos.h"
#include "id.h"
#include "hotkeys.h"
#include "Pin_to.xpm"
#include "Pin_Size_to.xpm"
......@@ -33,32 +34,11 @@ static void AddMenusForPin(wxMenu * PopMenu, LibDrawPin* Pin, WinEDA_LibeditFram
bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu)
/********************************************************************************/
{
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor();
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
if ( CurrentLibEntry == NULL ) return true;
if ( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
{ // Simple localisation des elements
DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert);
if ( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(),
GetScreen()->m_MousePosition,CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
}
if ( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(), GetScreen()->m_Curseur, CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
}
if ( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*)
LocateField(CurrentLibEntry);
}
}
// If Command in progresss: put the menu "cancel" and "end tool"
if ( m_ID_current_state )
{
......@@ -89,7 +69,8 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
else return true;
CurrentDrawItem = DrawEntry;
wxString msg;
switch ( DrawEntry->Type() )
{
case COMPONENT_PIN_DRAW_TYPE:
......@@ -99,53 +80,53 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
case COMPONENT_ARC_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
_("Move Arc"), move_arc_xpm);
msg = AddHotkeyName( _( "Move Arc " ), s_Libedit_Hokeys_Descr, HK_MOVE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_arc_xpm);
}
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
_("Arc Options"), options_arc_xpm );
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
_("Arc Delete"), delete_arc_xpm);
msg = AddHotkeyName( _( "Delete Arc " ), s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_arc_xpm);
}
break;
case COMPONENT_CIRCLE_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
_("Move Circle"), move_circle_xpm);
msg = AddHotkeyName( _( "Move Circle " ), s_Libedit_Hokeys_Descr, HK_MOVE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_circle_xpm);
}
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
_("Circle Options"), options_circle_xpm);
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
_("Circle Delete"), delete_circle_xpm);
msg = AddHotkeyName( _( "Delete Circle " ), s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,msg, delete_circle_xpm);
}
break;
case COMPONENT_RECT_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
_("Move Rect"), move_rectangle_xpm);
msg = AddHotkeyName( _( "Move Rect " ), s_Libedit_Hokeys_Descr, HK_MOVE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_rectangle_xpm);
}
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
_("Rect Options"), options_rectangle_xpm);
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
_("Rect Delete"), delete_rectangle_xpm);
msg = AddHotkeyName( _( "Delete Rect " ), s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_rectangle_xpm);
}
break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
_("Move Text"), move_text_xpm);
msg = AddHotkeyName( _( "Move Text " ), s_Libedit_Hokeys_Descr, HK_MOVE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_text_xpm);
}
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
_("Text Editor"), edit_text_xpm);
......@@ -153,16 +134,16 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
_("Rotate Text"), edit_text_xpm);
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
_("Text Delete"), delete_text_xpm);
msg = AddHotkeyName( _( "Delete Text " ), s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_text_xpm);
}
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
_("Move Line"), move_line_xpm);
msg = AddHotkeyName( _( "Move Line " ), s_Libedit_Hokeys_Descr, HK_MOVE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_line_xpm);
}
if ( DrawEntry->m_Flags & IS_NEW )
{
......@@ -173,23 +154,25 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
_("Line Options"), options_segment_xpm);
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
_("Line Delete"), delete_segment_xpm);
msg = AddHotkeyName( _( "Delete Line " ), s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_segment_xpm);
}
else if( (DrawEntry->m_Flags & IS_NEW) )
{
if( ((LibDrawPolyline*)DrawEntry)->n > 2 )
{
msg = AddHotkeyName( _( "Delete Segment " ), s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
ADD_MENUITEM(PopMenu,
ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT,
_("Segment Delete"), delete_segment_xpm);
ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT, msg, delete_segment_xpm);
}
}
break;
case COMPONENT_FIELD_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
_("Move Field"), move_field_xpm);
msg = AddHotkeyName( _( "Move Feild " ), s_Libedit_Hokeys_Descr, HK_MOVE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, move_field_xpm);
}
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM,
_("Field Rotate"), rotate_field_xpm);
......@@ -221,12 +204,14 @@ bool not_in_move = (Pin->m_Flags == 0);
if( not_in_move )
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, _("Move Pin"), move_xpm );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_PIN_EDIT, _("Pin Edit"), edit_xpm );
wxString msg;
msg = AddHotkeyName( _( "Edit Pin " ), s_Libedit_Hokeys_Descr, HK_EDIT_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_PIN_EDIT, msg, edit_xpm );
if( not_in_move )
{
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
_("Pin Delete"), delete_pin_xpm );
msg = AddHotkeyName( _( "Delete Pin " ), s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
ADD_MENUITEM(PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, delete_pin_xpm );
}
wxMenu * global_pin_change = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU(PopMenu, global_pin_change, ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_ITEM,
......
......@@ -286,7 +286,6 @@ int LineWidth = MAX(Field->m_Width, g_DrawMinimunLineWidth);
DrawPanel->CursorOn(DC);
}
/****************************************************************************/
LibDrawField * WinEDA_LibeditFrame::LocateField(EDA_LibComponentStruct *LibEntry)
/****************************************************************************/
......@@ -348,7 +347,7 @@ int hjustify, vjustify;
if ( hjustify == GR_TEXT_HJUSTIFY_CENTER ) x0 -= dx/2;
else if ( hjustify == GR_TEXT_HJUSTIFY_RIGHT ) x0 -= dx;
if ( vjustify == GR_TEXT_VJUSTIFY_CENTER ) y0 -= dy/2;
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy;
else if ( vjustify == GR_TEXT_VJUSTIFY_BOTTOM ) y0 -= dy;
x1 = x0 + dx; y1 = y0 + dy;
if( (m_CurrentScreen->m_Curseur.x >= x0) && ( m_CurrentScreen->m_Curseur.x <= x1) &&
(m_CurrentScreen->m_Curseur.y >= y0) && ( m_CurrentScreen->m_Curseur.y <= y1) )
......@@ -358,3 +357,33 @@ int hjustify, vjustify;
return NULL;
}
/********************************************************************************/
LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor()
/********************************************************************************/
{
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
if ( CurrentLibEntry == NULL ) return NULL;
if ( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
{ // Simple localisation des elements
DrawEntry = LocatePin(m_CurrentScreen->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert);
if ( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(),
GetScreen()->m_MousePosition,CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
}
if ( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = LocateDrawItem(GetScreen(), GetScreen()->m_Curseur, CurrentLibEntry,CurrentUnit,
CurrentConvert,LOCATE_ALL_DRAW_ITEM);
}
if ( DrawEntry == NULL )
{
DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*)
LocateField(CurrentLibEntry);
}
}
return DrawEntry;
}
......@@ -26,7 +26,7 @@ $(TARGET): $(OBJECTS) makefile.gtk makefile.include $(EXTRALIBS) ../libs.linux
$(LD) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $(TARGET)
netlist_form_pads-pcb: plugins/netlist_form_pads-pcb.cpp makefile.gtk
gcc $(CXXFLAGS) -D__UNIX__ -Wall plugins/netlist_form_pads-pcb.cpp $(LIBSTDC) -o netlist_form_pads-pcb
$(CXX) $(CXXFLAGS) -D__UNIX__ -Wall plugins/netlist_form_pads-pcb.cpp $(LIBSTDC) -o netlist_form_pads-pcb
install: $(TARGET)
......
......@@ -43,6 +43,7 @@
#include "Normal.xpm"
#include "Edit_Comp_Ref.xpm"
#include "Edit_Comp_Value.xpm"
#include "Edit_Comp_Footprint.xpm"
/* functions to add commands and submenus depending on the item */
static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame );
......@@ -313,8 +314,13 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component )
if( LibEntry && LibEntry->m_Options != ENTRY_POWER )
{
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_VALUE_CMP, _( "Value" ), edit_comp_value_xpm );
msg = AddHotkeyName( _( "Value " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_VALUE );
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_VALUE_CMP, msg, edit_comp_value_xpm );
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_REF_CMP, _( "Reference" ), edit_comp_ref_xpm );
msg = AddHotkeyName( _( "Footprint " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_FOOTPRINT );
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_FOOTPRINT_CMP, msg, edit_comp_footprint_xpm );
}
if( LibEntry && (LookForConvertPart( LibEntry ) >= 2) )
editmenu->Append( ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ) );
......
......@@ -64,6 +64,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_DISPLAYDOC_CMP:
case ID_POPUP_SCH_EDIT_VALUE_CMP:
case ID_POPUP_SCH_EDIT_REF_CMP:
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
case ID_POPUP_SCH_SELECT_UNIT_CMP:
case ID_POPUP_SCH_SELECT_UNIT1:
......@@ -583,8 +584,20 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break;
EditComponentReference(
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), &dc );
break;
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL )
break;
EditComponentFootprint(
(EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(), &dc );
break;
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..)
......
......@@ -310,6 +310,7 @@ enum main_id {
ID_POPUP_SCH_GENERIC_EDIT_CMP,
ID_POPUP_SCH_EDIT_VALUE_CMP,
ID_POPUP_SCH_EDIT_REF_CMP,
ID_POPUP_SCH_EDIT_FOOTPRINT_CMP,
ID_POPUP_SCH_EDIT_CONVERT_CMP,
ID_POPUP_SCH_COPY_COMPONENT_CMP,
ID_POPUP_SCH_SELECT_UNIT_CMP,
......
......@@ -1201,6 +1201,7 @@ private:
void SetInitCmp( EDA_SchComponentStruct* DrawComponent, wxDC* DC );
void EditComponentReference( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
void EditComponentValue( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
void EditComponentFootprint( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
void StartMoveCmpField( PartTextStruct* Field, wxDC* DC );
void EditCmpFieldText( PartTextStruct* Field, wxDC* DC );
void RotateCmpField( PartTextStruct* Field, wxDC* DC );
......@@ -1323,6 +1324,7 @@ private:
void RotateSymbolText( wxDC* DC );
void DeleteDrawPoly( wxDC* DC );
LibDrawField* LocateField( EDA_LibComponentStruct* LibEntry );
LibEDA_BaseStruct* LocateItemUsingCursor();
void RotateField( wxDC* DC, LibDrawField* Field );
void PlaceField( wxDC* DC, LibDrawField* Field );
void EditField( wxDC* DC, LibDrawField* Field );
......
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