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
This diff is collapsed.
......@@ -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