Commit e6c70dca authored by Wayne Stambaugh's avatar Wayne Stambaugh

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
......@@ -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 )
if( aField->GetId() == REFERENCE )
{
Entry = CMP_LIBRARY::FindLibraryComponent( comp->GetLibName() );
libEntry = CMP_LIBRARY::FindLibraryComponent( comp->GetLibName() );
if( Entry != NULL )
{
if( Entry->GetPartCount() > 1 )
m_Multiflag = 1;
}
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 )
{
wxPoint pos;
int fieldNdx;
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
SCH_FIELD* currentField = frame->GetCurrentField();
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();
fieldNdx = Field->m_FieldId;
flag = 0;
if( fieldNdx == REFERENCE )
{
Entry = CMP_LIBRARY::FindLibraryComponent(
( (SCH_COMPONENT*) Field->GetParent() )->GetLibName() );
if( Entry != NULL )
{
if( Entry->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 );
Field->m_AddExtraText = flag;
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
if( Field->m_Orient == TEXT_ORIENT_HORIZ )
Field->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 )
void SCH_EDIT_FRAME::RotateField( SCH_FIELD* aField, wxDC* aDC )
{
wxCHECK_RET( Cmp != NULL && Cmp->Type() == SCH_COMPONENT_T,
wxT( "Invalid schematic component item." ) );
wxCHECK_RET( aField != NULL && aField->Type() == SCH_FIELD_T && !aField->GetText().IsEmpty(),
wxT( "Cannot rotate invalid schematic field." ) );
LIB_COMPONENT* Entry;
int flag = 0;
LIB_COMPONENT* libEntry;
SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
Entry = CMP_LIBRARY::FindLibraryComponent( Cmp->GetLibName() );
if( Entry == NULL )
return;
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
if( aField->GetId() == REFERENCE )
{
/* 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 );
}
libEntry = CMP_LIBRARY::FindLibraryComponent( component->GetLibName() );
/*****************************************************************************/
/* 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();
if( (libEntry != NULL) && (libEntry->GetPartCount() > 1) )
flag = 1;
}
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;
// Save old component in undo list if not already in edit, or moving.
if( aField->GetFlags() == 0 )
SaveCopyInUndoList( component, UR_CHANGED );
// 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 );
aField->m_AddExtraText = flag;
aField->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
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 );
if( aField->m_Orient == TEXT_ORIENT_HORIZ )
aField->m_Orient = TEXT_ORIENT_VERT;
else
aField->m_Orient = TEXT_ORIENT_HORIZ;
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 );
}
......@@ -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 );
}
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;
}
......
......@@ -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
......
......@@ -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 );
......
......@@ -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:
......
......@@ -364,9 +364,9 @@ public:
*
* @param aSheetPath The sheet path used to look up the reference designator.
* @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( SCH_SHEET_PATH* aSheetPath, const wxString& aReference,
const wxString& aFootPrint, bool aSetVisible );
......
......@@ -119,21 +119,21 @@ public:
/**
* Function GetDefaultFieldName
* returns a default symbol field name for field \a aFieldNdx for all components.
* These fieldnames are not modifiable, but template fieldnames are.
* These field names are not modifiable, but template field names are.
* @param aFieldNdx The field number index
*/
static wxString GetDefaultFieldName( int aFieldNdx );
/**
* Function AddTemplateFieldName
* inserts or appends a wanted symbol field name into the fieldnames
* inserts or appends a wanted symbol field name into the field names
* template. Should be used for any symbol property editor. If the name
* already exists, it overwrites the same name.
*
* @param aFieldName is a full description of the wanted field, and it must not match
* any of the default fieldnames.
* any of the default field names.
* @return int - the index within the config container at which aFieldName was
* added, or -1 if the name is illegal because it matches a default fieldname.
* added, or -1 if the name is illegal because it matches a default field name.
*/
int AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName )
{
......@@ -143,7 +143,7 @@ public:
/**
* Function GetTemplateFieldName
* returns a template fieldnames list for read only access.
* returns a template field names list for read only access.
*/
const TEMPLATE_FIELDNAMES& GetTemplateFieldNames()
{
......@@ -153,7 +153,7 @@ public:
/**
* Function DeleteAllTemplateFieldNames
* removes all template fieldnames.
* removes all template field names.
*/
void DeleteAllTemplateFieldNames()
{
......@@ -254,26 +254,7 @@ public:
* @param aDC The device context to update if and item is deleted.
* @return True if an item was deleted.
*/
bool DeleteItemAtCrossHair( wxDC* DC );
/**
* Function FillFootprintFieldForAllInstancesofComponent
* searches for component "aReference", and places a Footprint in
* Footprint field
* @param aReference = reference of the component to initialize
* @param aFootPrint = new value for the filed Footprint component
* @param aSetVisible = true to have the field visible, false to set the
* invisible flag
* @return true if the given component is found
* Note:
* the component is searched in the whole schematic, and because some
* components have more than one instance (multiple parts per package
* components) the search is not stopped when a reference is found
* (all instances must be found).
*/
bool FillFootprintFieldForAllInstancesofComponent( const wxString& aReference,
const wxString& aFootPrint,
bool aSetVisible );
bool DeleteItemAtCrossHair( wxDC* aDC );
SCH_ITEM* FindComponentAndItem( const wxString& component_reference,
bool Find_in_hierarchy,
......@@ -583,12 +564,10 @@ private:
void OnSelectUnit( wxCommandEvent& aEvent );
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
void EditComponentReference( SCH_COMPONENT* DrawLibItem, wxDC* DC );
void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC );
void EditComponentFootprint( SCH_COMPONENT* DrawLibItem, wxDC* DC );
void StartMoveCmpField( SCH_FIELD* Field, wxDC* DC );
void EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC );
void RotateCmpField( SCH_FIELD* Field, wxDC* DC );
void MoveField( SCH_FIELD* aField, wxDC* aDC );
void EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC );
void RotateField( SCH_FIELD* aField, wxDC* aDC );
void PasteListOfItems( wxDC* DC );
......@@ -742,9 +721,9 @@ public:
void LoadLibraries( void );
/** Virtual function PrintPage
* Previously used to print a page,
* but now only used to plot/print the current sheet to the clipboard
/**
* Function PrintPage
* plots or prints the current sheet to the clipboard.
* @param aDC = wxDC given by the calling print function
* @param aPrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
......
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