Commit e6c70dca authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

EESchema edit field code improvements and Doxygen comment fixes.

* Remove specialized edit reference, value, and foot print field methods
  from SCH_FRAME object.
* Improve general field method to handle all field types as this was
  essentially the same code used in the three methods removed.
* Updated the the hot key and context menu handlers to use the new field
  edit method.
* Minor Doxygen comment warning fixes.
parent 1284ad5c
Loading
Loading
Loading
Loading
+100 −279
Original line number Diff line number Diff line
@@ -16,32 +16,76 @@
#include "sch_component.h"


static void AbortMoveCmpField( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void MoveCmpField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
                          bool aErase );


/******************************************************************************/
/* Prepare the displacement of the text being edited.
/*
 * Move standard text field.  This routine is normally attached to the cursor.
 */
/******************************************************************************/
void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
static void moveField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
{
    LIB_COMPONENT* Entry;
    wxPoint pos;
    int fieldNdx;

    SetCurrentField( aField );
    if( aField == NULL )
    SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
    SCH_FIELD*      currentField = frame->GetCurrentField();

    if( currentField == NULL )
        return;

    if( aField->m_Text == wxEmptyString )
    SCH_COMPONENT* component = (SCH_COMPONENT*) currentField->GetParent();
    fieldNdx = currentField->m_FieldId;

    currentField->m_AddExtraText = frame->m_Multiflag;

    if( aErase )
    {
        DisplayError( this, _( "No Field to move" ), 10 );
        return;
        currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
    }

    pos = ( (SCH_COMPONENT*) currentField->GetParent() )->m_Pos;

    // Actual positions are calculated by the rotation/mirror transform
    // But here we want the relative position of the moved field
    // and we know the actual position.
    // So we are using the inverse rotation/mirror transform.
    wxPoint pt( aPanel->GetScreen()->GetCrossHairPosition() - pos );

    TRANSFORM itrsfm = component->GetTransform().InverseTransform();
    currentField->m_Pos = pos + itrsfm.TransformCoordinate( pt );

    currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}


static void abortMoveField( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
    SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
    SCH_FIELD*      currentField = frame->GetCurrentField();

    if( currentField )
    {
        currentField->m_AddExtraText = frame->m_Multiflag;
        currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
        currentField->ClearFlags( 0 );
        currentField->m_Pos = frame->m_OldPos;
        currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
    }

    frame->SetCurrentField( NULL );

    SAFE_DELETE( g_ItemToUndoCopy );
}


void SCH_EDIT_FRAME::MoveField( SCH_FIELD* aField, wxDC* aDC )
{
    wxCHECK_RET( aField && (aField->Type() == SCH_FIELD_T) && !aField->GetText().IsEmpty(),
                 wxT( "Cannot move invalid component field." ) );

    LIB_COMPONENT* libEntry;
    wxPoint        pos, newpos;
    SCH_COMPONENT* comp = (SCH_COMPONENT*) aField->GetParent();

    SetCurrentField( aField );

    SAFE_DELETE( g_ItemToUndoCopy );
    g_ItemToUndoCopy = new SCH_COMPONENT( *comp );

@@ -52,38 +96,32 @@ void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )

    newpos = comp->GetTransform().TransformCoordinate( newpos ) + pos;

    DrawPanel->CrossHairOff( DC );
    DrawPanel->CrossHairOff( aDC );
    GetScreen()->SetCrossHairPosition( newpos );
    DrawPanel->MoveCursorToCrossHair();

    m_OldPos    = aField->m_Pos;
    m_Multiflag = 0;
    if( aField->m_FieldId == REFERENCE )
    {
        Entry = CMP_LIBRARY::FindLibraryComponent( comp->GetLibName() );

        if( Entry  != NULL )
    if( aField->GetId() == REFERENCE )
    {
            if( Entry->GetPartCount() > 1 )
        libEntry = CMP_LIBRARY::FindLibraryComponent( comp->GetLibName() );

        if( (libEntry != NULL) && (libEntry->GetPartCount() > 1) )
            m_Multiflag = 1;
    }
    }

    DrawPanel->m_endMouseCaptureCallback = AbortMoveCmpField;
    DrawPanel->m_mouseCaptureCallback = MoveCmpField;
    aField->m_Flags = IS_MOVED;
    DrawPanel->SetMouseCapture( moveField, abortMoveField );
    aField->SetFlags( IS_MOVED );

    DrawPanel->CrossHairOn( DC );
    DrawPanel->CrossHairOn( aDC );
}


/*
 * Edit a field: text and size
*/
void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC )
{
    wxCHECK_RET( aField != NULL && aField->Type() == SCH_FIELD_T,
                 wxT( "Invalid schemaitic field type. " ) );
                 wxT( "Cannot edit invalid schematic field." ) );

    int            fieldNdx, flag;
    SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
@@ -100,8 +138,10 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC )

    if( fieldNdx == VALUE && entry->IsPower() )
    {
        DisplayInfoMessage( this, _( "The component is a POWER, it's value cannot be \
modified!\n\nYou must create a new power component with the value."  ) );
        wxString msg;
        msg.Printf( _( "%s is a power component and it's value cannot be modified!\n\nYou must \
create a new power component with the new value." ), GetChars( entry->GetName() ) );
        DisplayInfoMessage( this, msg );
        return;
    }

@@ -110,24 +150,27 @@ modified!\n\nYou must create a new power component with the value." ) );
    if( fieldNdx == REFERENCE && entry->GetPartCount() > 1 )
        flag = 1;

    /* save old cmp in undo list if not already in edit, or moving ... */
    // Save old component in undo list if not already in edit, or moving.
    if( aField->GetFlags() == 0 )
        SaveCopyInUndoList( component, UR_CHANGED );

    wxString newtext = aField->m_Text;
    DrawPanel->m_IgnoreMouseEvents = true;

    wxString title = _( "Field " ) + aField->m_Name;
    wxString title;
    title.Printf( _( "Edit %s Field" ), GetChars( aField->m_Name ) );

    wxTextEntryDialog dlg( this, wxEmptyString , title, newtext );
    int diag = dlg.ShowModal();
    int response = dlg.ShowModal();

    DrawPanel->MoveCursorToCrossHair();
    DrawPanel->m_IgnoreMouseEvents = false;
    newtext = dlg.GetValue( );
    newtext.Trim( true );
    newtext.Trim( false );

    if ( diag != wxID_OK || newtext == aField->GetText() )
        return;  // cancelled by user
    if ( response != wxID_OK || newtext == aField->GetText() )
        return;  // canceled by user

    aField->m_AddExtraText = flag;
    aField->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
@@ -169,258 +212,36 @@ modified!\n\nYou must create a new power component with the value." ) );
}


/*
 * Move standard text field.  This routine is normally attached to the cursor.
 */
static void MoveCmpField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
                          bool aErase )
void SCH_EDIT_FRAME::RotateField( SCH_FIELD* aField, wxDC* aDC )
{
    wxPoint pos;
    int fieldNdx;

    SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
    SCH_FIELD*      currentField = frame->GetCurrentField();
    wxCHECK_RET( aField != NULL && aField->Type() == SCH_FIELD_T && !aField->GetText().IsEmpty(),
                 wxT( "Cannot rotate invalid schematic field." ) );

    if( currentField == NULL )
        return;

    SCH_COMPONENT* component = (SCH_COMPONENT*) currentField->GetParent();
    fieldNdx = currentField->m_FieldId;

    currentField->m_AddExtraText = frame->m_Multiflag;

    if( aErase )
    {
        currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
    }

    pos = ( (SCH_COMPONENT*) currentField->GetParent() )->m_Pos;

    // Actual positions are calculated by the rotation/mirror transform
    // But here we want the relative position of the moved field
    // and we know the actual position.
    // So we are using the inverse rotation/mirror transform.
    wxPoint pt( aPanel->GetScreen()->GetCrossHairPosition() - pos );

    TRANSFORM itrsfm = component->GetTransform().InverseTransform();
    currentField->m_Pos = pos + itrsfm.TransformCoordinate( pt );

    currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}


static void AbortMoveCmpField( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
    SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) Panel->GetParent();
    SCH_FIELD*      currentField = frame->GetCurrentField();

    if( currentField )
    {
        currentField->m_AddExtraText = frame->m_Multiflag;
        currentField->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
        currentField->m_Flags = 0;
        currentField->m_Pos   = frame->m_OldPos;
        currentField->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
    }

    frame->SetCurrentField( NULL );

    SAFE_DELETE( g_ItemToUndoCopy );
}


void SCH_EDIT_FRAME::RotateCmpField( SCH_FIELD* Field, wxDC* DC )
{
    int            fieldNdx, flag;
    LIB_COMPONENT* Entry;

    if( Field == NULL )
        return;
    if( Field->m_Text == wxEmptyString )
        return;

    SCH_COMPONENT* Cmp = (SCH_COMPONENT*) Field->GetParent();
    int            flag = 0;
    LIB_COMPONENT* libEntry;
    SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();

    fieldNdx = Field->m_FieldId;
    flag     = 0;
    if( fieldNdx == REFERENCE )
    if( aField->GetId() == REFERENCE )
    {
        Entry = CMP_LIBRARY::FindLibraryComponent(
            ( (SCH_COMPONENT*) Field->GetParent() )->GetLibName() );
        libEntry = CMP_LIBRARY::FindLibraryComponent( component->GetLibName() );

        if( Entry != NULL )
        {
            if( Entry->GetPartCount() > 1 )
        if( (libEntry != NULL) && (libEntry->GetPartCount() > 1) )
            flag = 1;
    }
    }

    /* save old cmp in undo list if not already in edit, or moving ... */
    if( Field->m_Flags == 0 )
        SaveCopyInUndoList( Cmp, UR_CHANGED );
    // Save old component in undo list if not already in edit, or moving.
    if( aField->GetFlags() == 0 )
        SaveCopyInUndoList( component, UR_CHANGED );

    Field->m_AddExtraText = flag;
    Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
    aField->m_AddExtraText = flag;
    aField->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );

    if( Field->m_Orient == TEXT_ORIENT_HORIZ )
        Field->m_Orient = TEXT_ORIENT_VERT;
    if( aField->m_Orient == TEXT_ORIENT_HORIZ )
        aField->m_Orient = TEXT_ORIENT_VERT;
    else
        Field->m_Orient = TEXT_ORIENT_HORIZ;
    Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );

    OnModify();
}


/****************************************************************************/
/* Edit the component text reference*/
/****************************************************************************/
void SCH_EDIT_FRAME::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC )
{
    wxCHECK_RET( Cmp != NULL && Cmp->Type() == SCH_COMPONENT_T,
                 wxT( "Invalid schematic component item." ) );

    LIB_COMPONENT* Entry;
    int            flag = 0;

    Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->GetLibName() );

    if( Entry == NULL )
        return;
        aField->m_Orient = TEXT_ORIENT_HORIZ;

    if( Entry->GetPartCount() > 1 )
        flag = 1;

    wxString ref = Cmp->GetRef( GetSheet() );
    wxTextEntryDialog dlg( this, _( "Reference" ), _( "Component reference" ), ref );
    if( dlg.ShowModal() != wxID_OK )
        return; // cancelled by user

    ref = dlg.GetValue( );
    ref.Trim( true );
    ref.Trim( false );

    if( !ref.IsEmpty() ) // New text entered
    {
        /* save old cmp in undo list if not already in edit, or moving ... */
        if( Cmp->m_Flags == 0 )
            SaveCopyInUndoList( Cmp, UR_CHANGED );
        Cmp->SetRef( GetSheet(), ref );

        Cmp->GetField( REFERENCE )->m_AddExtraText = flag;
        Cmp->GetField( REFERENCE )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
        Cmp->SetRef( GetSheet(), ref );
        Cmp->GetField( REFERENCE )->Draw( DrawPanel, DC, wxPoint( 0, 0 ),
                                          Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
        OnModify();
    }

    Cmp->DisplayInfo( this );
}


/*****************************************************************************/
/* Routine to change the selected text */
/*****************************************************************************/
void SCH_EDIT_FRAME::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
{
    wxCHECK_RET( Cmp != NULL && Cmp->Type() == SCH_COMPONENT_T,
                 wxT( "Invalid schematic component item." ) );

    wxString       message;
    LIB_COMPONENT* Entry;

    Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->GetLibName() );

    if( Entry == NULL )
        return;

    SCH_FIELD* TextField = Cmp->GetField( VALUE );

    message = TextField->m_Text;

    wxTextEntryDialog dlg( this,  _( "Value" ), _( "Component value" ), message );
    if( dlg.ShowModal() != wxID_OK )
        return; // cancelled by user

    message = dlg.GetValue( );
    message.Trim( true );
    message.Trim( false );

    if( !message.IsEmpty() )
    {
        /* save old cmp in undo list if not already in edit, or moving ... */
        if( Cmp->m_Flags == 0 )
            SaveCopyInUndoList( Cmp, UR_CHANGED );

        TextField->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
        TextField->m_Text = message;
        TextField->Draw( DrawPanel, DC, wxPoint( 0, 0 ),
                         Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
        OnModify();
    }

    Cmp->DisplayInfo( this );
}


void SCH_EDIT_FRAME::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC )
{
    wxCHECK_RET( Cmp != NULL && Cmp->Type() == SCH_COMPONENT_T,
                 wxT( "Invalid schematic component item." ) );

    wxString       message;
    LIB_COMPONENT* Entry;

    Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->GetLibName() );

    if( Entry == NULL )
        return;

    SCH_FIELD* TextField = Cmp->GetField( FOOTPRINT );
    message = TextField->m_Text;

    wxTextEntryDialog dlg( this, _( "Footprint" ), _( "Component footprint" ), message );
    if( dlg.ShowModal() != wxID_OK )
        return; // cancelled by user

    message = dlg.GetValue( );
    message.Trim( true );
    message.Trim( false );

    bool wasEmpty = false;
    if( TextField->m_Text.IsEmpty() )
        wasEmpty = true;

    // save old cmp in undo list if not already in edit, or moving ...
    if( Cmp->m_Flags == 0 )
        SaveCopyInUndoList( Cmp, UR_CHANGED );
    Cmp->GetField( FOOTPRINT )->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );

    // Give a suitable position to the field if it was new,
    // and therefore has no position already given.
    if( wasEmpty && !message.IsEmpty() )
    {
        Cmp->GetField( FOOTPRINT )->m_Pos = Cmp->GetField( REFERENCE )->m_Pos;

        // add offset here - ? suitable heuristic below?
        Cmp->GetField( FOOTPRINT )->m_Pos.x +=
            ( Cmp->GetField( REFERENCE )->m_Pos.x - Cmp->m_Pos.x ) > 0 ?
            ( Cmp->GetField( REFERENCE )->m_Size.x ) :
            ( -1 * Cmp->GetField( REFERENCE )->m_Size.x );

        Cmp->GetField( FOOTPRINT )->m_Pos.y +=
            ( Cmp->GetField( REFERENCE )->m_Pos.y - Cmp->m_Pos.y ) > 0 ?
            ( Cmp->GetField( REFERENCE )->m_Size.y ) :
            ( -1 * Cmp->GetField( REFERENCE )->m_Size.y );

        Cmp->GetField( FOOTPRINT )->m_Orient = Cmp->GetField( REFERENCE )->m_Orient;
    }
    aField->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );

    TextField->m_Text = message;
    Cmp->GetField( FOOTPRINT )->Draw( DrawPanel, DC, wxPoint( 0, 0 ),
                                      Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
    OnModify();

    Cmp->DisplayInfo( this );
}
+11 −34
Original line number Diff line number Diff line
@@ -124,9 +124,11 @@ static Ki_HotkeyInfo HkOrientNormalComponent( wxT( "Orient Normal Component" ),
static Ki_HotkeyInfo HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R' );
static Ki_HotkeyInfo HkEdit( wxT( "Edit Schematic Item" ), HK_EDIT, 'E' );
static Ki_HotkeyInfo HkEditComponentValue( wxT( "Edit Component Value" ),
                                           HK_EDIT_COMPONENT_VALUE, 'V' );
                                           HK_EDIT_COMPONENT_VALUE, 'V',
                                           ID_POPUP_SCH_EDIT_VALUE_CMP );
static Ki_HotkeyInfo HkEditComponentFootprint( wxT( "Edit Component Footprint" ),
                                               HK_EDIT_COMPONENT_FOOTPRINT, 'F' );
                                               HK_EDIT_COMPONENT_FOOTPRINT, 'F',
                                               ID_POPUP_SCH_EDIT_FOOTPRINT_CMP );
static Ki_HotkeyInfo HkMove( wxT( "Move Schematic Item" ),
                             HK_MOVE_COMPONENT_OR_ITEM, 'M',
                             ID_POPUP_SCH_MOVE_CMP_REQUEST );
@@ -802,26 +804,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
            break;

        case SCH_FIELD_T:
            switch( ( (SCH_FIELD*) aItem )->GetId() )
            {
            case REFERENCE:
                EditComponentReference( (SCH_COMPONENT*)aItem->GetParent(), aDC );
                break;
            case VALUE:
                EditComponentValue( (SCH_COMPONENT*) aItem->GetParent(), aDC );
                break;
            case FOOTPRINT:
                EditComponentFootprint( (SCH_COMPONENT*) aItem->GetParent(), aDC );
                break;
            default:
                /**
                 * @todo Not sure exactly why there are functions specific to the reference,
                 * value, and footprint fields when the EditComponentFieldText() function
                 * seems like it was designed to handle any field.  This should probably be
                 * cleaned up.
                 */
            EditComponentFieldText( (SCH_FIELD*) aItem, aDC );
            }
            break;

        default:
            ;
@@ -830,18 +814,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
        break;

    case HK_EDIT_COMPONENT_VALUE:
        if( itemInEdit )
            break;

        if( aItem == NULL )
            aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::ComponentsOnly );

        if( aItem )
            EditComponentValue( (SCH_COMPONENT*) aItem, aDC );

        break;

    case HK_EDIT_COMPONENT_FOOTPRINT:

        if( itemInEdit )
            break;

@@ -849,7 +823,10 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
            aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::ComponentsOnly );

        if( aItem )
            EditComponentFootprint( (SCH_COMPONENT*) aItem, aDC );
        {
            cmd.SetId( HK_Descr->m_IdMenuEvent );
            wxPostEvent( this, cmd );
        }

        break;
    }
+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ public:
     *                    collection.
     * @param aPosition A wxPoint to use in hit-testing.
     */
    void Collect( SCH_ITEM* aItem, const KICAD_T aScanList[], const wxPoint& aPositiion );
    void Collect( SCH_ITEM* aItem, const KICAD_T aFilterList[], const wxPoint& aPosition );

    /**
     * Function IsCorner
+6 −6
Original line number Diff line number Diff line
@@ -209,15 +209,15 @@ public:
     * field to \a aFootPrint if found.
     *
     * @param aReference The reference designator of the component.
     * @param aFootPrint The value to set the footprint fiield.
     * @param aFootPrint The value to set the footprint field.
     * @param aSetVisible The value to set the field visibility flag.
     * @retrun True if \a aReference was found otherwise false.
     * @return True if \a aReference was found otherwise false.
     */
    bool SetComponentFootprint( const wxString& aReference, const wxString& aFootPrint,
                                bool aSetVisible );

    /**
     * Find the next schematic item in this sheet ojbect.
     * Find the next schematic item in this sheet object.
     *
     * @param aType - The type of schematic item object to search for.
     * @param aLastItem - Start search from aLastItem.  If no aLastItem, search from
@@ -349,7 +349,7 @@ public:

    /**
     * Function IsModified
     * checks the entire hierachy for any modifications.
     * checks the entire hierarchy for any modifications.
     * @returns True if the hierarchy is modified otherwise false.
     */
    bool IsModified();
@@ -422,9 +422,9 @@ public:
     * field to \a aFootPrint if found.
     *
     * @param aReference The reference designator of the component.
     * @param aFootPrint The value to set the footprint fiield.
     * @param aFootPrint The value to set the footprint field.
     * @param aSetVisible The value to set the field visibility flag.
     * @retrun True if \a aReference was found otherwise false.
     * @return True if \a aReference was found otherwise false.
     */
    bool SetComponentFootprint( const wxString& aReference, const wxString& aFootPrint,
                                bool aSetVisible );
+9 −13
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )

    case ID_POPUP_SCH_ROTATE_FIELD:
        DrawPanel->MoveCursorToCrossHair();
        RotateCmpField( (SCH_FIELD*) item, &dc );
        RotateField( (SCH_FIELD*) item, &dc );
        break;

    case ID_POPUP_SCH_EDIT_FIELD:
@@ -304,33 +304,30 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
        // Ensure the struct is a component (could be a struct of a
        // component, like Field, text..)
        if( item != NULL && item->Type() == SCH_COMPONENT_T )
            EditComponentValue( (SCH_COMPONENT*) item, &dc );
            EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ), &dc );

        break;

    case ID_POPUP_SCH_EDIT_REF_CMP:

        // Ensure the struct is a component (could be a struct of a
        // component, like Field, text..)
        // Ensure the struct is a component (could be a struct of a component, like Field, text..)
        if( item != NULL && item->Type() == SCH_COMPONENT_T )
            EditComponentReference( (SCH_COMPONENT*) item, &dc );
            EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ), &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..)
        // Ensure the struct is a component (could be a struct of a component, like Field, text..)
        if( item && item->Type() == SCH_COMPONENT_T )
            EditComponentFootprint( (SCH_COMPONENT*) item, &dc );
            EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ), &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..)
        // Ensure the struct is a component (could be a struct of a component, like Field, text..)
        if( item && item->Type() == SCH_COMPONENT_T )
        {
            DrawPanel->MoveCursorToCrossHair();
@@ -341,8 +338,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )

    case ID_POPUP_SCH_DISPLAYDOC_CMP:

        // Ensure the struct is a component (could be a piece of a
        // component, like Field, text..)
        // Ensure the struct is a component (could be a piece of a component, like Field, text..)
        if( item && item->Type() == SCH_COMPONENT_T )
        {
            LIB_ALIAS* LibEntry;
@@ -498,7 +494,7 @@ void SCH_EDIT_FRAME::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
        break;

    case SCH_FIELD_T:
        StartMoveCmpField( (SCH_FIELD*) DrawStruct, DC );
        MoveField( (SCH_FIELD*) DrawStruct, DC );
        break;

    case SCH_MARKER_T:
Loading