Commit ba055196 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: Add hotkey 'U' to edit reference. Better filtering for hotheys V,...

Eeschema: Add hotkey 'U' to edit reference. Better filtering for  hotheys V, F, U: now the corresponding field is selected without selection list between component and the field.
parent 1671432a
......@@ -168,6 +168,9 @@ static EDA_HOTKEY HkEdit( wxT( "Edit Schematic Item" ), HK_EDIT, 'E', ID_SCH_EDI
static EDA_HOTKEY HkEditComponentValue( wxT( "Edit Component Value" ),
HK_EDIT_COMPONENT_VALUE, 'V',
ID_SCH_EDIT_COMPONENT_VALUE );
static EDA_HOTKEY HkEditComponentReference( wxT( "Edit Component Reference" ),
HK_EDIT_COMPONENT_REFERENCE, 'U',
ID_SCH_EDIT_COMPONENT_REFERENCE );
static EDA_HOTKEY HkEditComponentFootprint( wxT( "Edit Component Footprint" ),
HK_EDIT_COMPONENT_FOOTPRINT, 'F',
ID_SCH_EDIT_COMPONENT_FOOTPRINT );
......@@ -240,6 +243,7 @@ EDA_HOTKEY* s_Schematic_Hotkey_List[] =
&HkOrientNormalComponent,
&HkEdit,
&HkEditComponentValue,
&HkEditComponentReference,
&HkEditComponentFootprint,
&HkBeginWire,
&HkBeginBus,
......@@ -490,6 +494,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_MOVE_COMPONENT_OR_ITEM: // Start move schematic item.
case HK_EDIT: // Edit schematic item.
case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
{
// force a new item search on hot keys at current position,
......
......@@ -23,6 +23,7 @@ enum hotkey_id_commnand {
HK_ROTATE,
HK_EDIT,
HK_EDIT_COMPONENT_VALUE,
HK_EDIT_COMPONENT_REFERENCE,
HK_EDIT_COMPONENT_FOOTPRINT,
HK_MIRROR_X_COMPONENT,
HK_MIRROR_Y_COMPONENT,
......
......@@ -249,18 +249,37 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
{
wxString msg;
wxString msg, name;
switch( Field->GetId() )
{
case REFERENCE: name = _( "Reference" ); break;
case VALUE: name = _( "Value" ); break;
case FOOTPRINT: name = _( "Footprint Field" ); break;
default: name = _( "Field" ); break;
}
if( !Field->GetFlags() )
{
msg = AddHotkeyName( _( "Move Field" ), s_Schematic_Hokeys_Descr,
msg = AddHotkeyName( _( "Move" ) + wxT(" ") + name, s_Schematic_Hokeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
}
msg = AddHotkeyName( _( "Rotate Field" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
msg = AddHotkeyName( _( "Rotate" ) + wxT(" ") + name, s_Schematic_Hokeys_Descr,
HK_ROTATE );
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_field_xpm ) );
msg = AddHotkeyName( _( "Edit Field" ), s_Schematic_Hokeys_Descr, HK_EDIT );
// Ref, value and footprint have specific hotkeys. Show the specific hotkey:
hotkey_id_commnand id;
switch( Field->GetId() )
{
case REFERENCE: id = HK_EDIT_COMPONENT_REFERENCE; break;
case VALUE: id = HK_EDIT_COMPONENT_VALUE; break;
case FOOTPRINT: id = HK_EDIT_COMPONENT_FOOTPRINT; break;
default: id = HK_EDIT; break;
}
msg = AddHotkeyName( _( "Edit" ) + wxT(" ") + name, s_Schematic_Hokeys_Descr, id );
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
}
......@@ -313,13 +332,17 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
if( libComponent && libComponent->IsNormal() )
{
msg = AddHotkeyName( _( "Value " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_VALUE );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_VALUE, msg, KiBitmap( edit_comp_value_xpm ) );
msg = AddHotkeyName( _( "Value" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_VALUE );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_VALUE, msg,
KiBitmap( edit_comp_value_xpm ) );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_REFERENCE, _( "Reference" ),
msg = AddHotkeyName( _( "Reference" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_REFERENCE );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_REFERENCE, msg,
KiBitmap( edit_comp_ref_xpm ) );
msg = AddHotkeyName( _( "Footprint " ), s_Schematic_Hokeys_Descr,
msg = AddHotkeyName( _( "Footprint" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_FOOTPRINT );
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_FOOTPRINT, msg,
KiBitmap( edit_comp_footprint_xpm ) );
......
......@@ -89,6 +89,21 @@ const KICAD_T SCH_COLLECTOR::EditableItems[] = {
EOT
};
const KICAD_T SCH_COLLECTOR::CmpFieldValueOnly[] = {
SCH_FIELD_LOCATE_VALUE_T,
EOT
};
const KICAD_T SCH_COLLECTOR::CmpFieldReferenceOnly[] = {
SCH_FIELD_LOCATE_REFERENCE_T,
EOT
};
const KICAD_T SCH_COLLECTOR::CmpFieldFootprintOnly[] = {
SCH_FIELD_LOCATE_FOOTPRINT_T,
EOT
};
const KICAD_T SCH_COLLECTOR::MovableItems[] = {
SCH_MARKER_T,
......
......@@ -52,6 +52,21 @@ public:
*/
static const KICAD_T EditableItems[];
/**
* A scan list for a specific editable field: Value.
*/
static const KICAD_T CmpFieldValueOnly[];
/**
* A scan list for a specific editable field: Reference.
*/
static const KICAD_T CmpFieldReferenceOnly[];
/**
* A scan list for a specific editable field: Footprint.
*/
static const KICAD_T CmpFieldFootprintOnly[];
/**
* A scan list for all movable schematic items.
*/
......
......@@ -1672,6 +1672,7 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR* aInspector, const void* aTestData
const KICAD_T aFilterTypes[] )
{
KICAD_T stype;
LIB_COMPONENT* component;
for( const KICAD_T* p = aFilterTypes; (stype = *p) != EOT; ++p )
{
......@@ -1681,31 +1682,50 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR* aInspector, const void* aTestData
if( SEARCH_QUIT == aInspector->Inspect( this, aTestData ) )
return SEARCH_QUIT;
}
else if( stype == SCH_FIELD_T )
switch( stype )
{
case SCH_FIELD_T:
// Test the bounding boxes of fields if they are visible and not empty.
for( int ii = 0; ii < GetFieldCount(); ii++ )
{
if( SEARCH_QUIT == aInspector->Inspect( GetField( ii ), (void*) this ) )
return SEARCH_QUIT;
}
}
else if( stype == LIB_PIN_T )
{
LIB_COMPONENT* component = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
break;
case SCH_FIELD_LOCATE_REFERENCE_T:
if( SEARCH_QUIT == aInspector->Inspect( GetField( REFERENCE ), (void*) this ) )
return SEARCH_QUIT;
break;
case SCH_FIELD_LOCATE_VALUE_T:
if( SEARCH_QUIT == aInspector->Inspect( GetField( VALUE ), (void*) this ) )
return SEARCH_QUIT;
break;
case SCH_FIELD_LOCATE_FOOTPRINT_T:
if( SEARCH_QUIT == aInspector->Inspect( GetField( FOOTPRINT ), (void*) this ) )
return SEARCH_QUIT;
break;
case LIB_PIN_T:
component = CMP_LIBRARY::FindLibraryComponent( m_ChipName );
if( component != NULL )
{
LIB_PINS pins;
component->GetPins( pins, m_unit, m_convert );
for( size_t i = 0; i < pins.size(); i++ )
{
if( SEARCH_QUIT == aInspector->Inspect( pins[ i ], (void*) this ) )
return SEARCH_QUIT;
}
}
break;
default:
break;
}
}
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......
......@@ -807,7 +807,35 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
item = LocateAndShowItem( data->GetPosition(), SCH_COLLECTOR::EditableItems,
// Set the locat filter, according to the edit command
const KICAD_T* filterList = SCH_COLLECTOR::EditableItems;
const KICAD_T* filterListAux = NULL;
switch( aEvent.GetId() )
{
case ID_SCH_EDIT_COMPONENT_REFERENCE:
filterList = SCH_COLLECTOR::CmpFieldReferenceOnly;
filterListAux = SCH_COLLECTOR::ComponentsOnly;
break;
case ID_SCH_EDIT_COMPONENT_VALUE:
filterList = SCH_COLLECTOR::CmpFieldValueOnly;
filterListAux = SCH_COLLECTOR::ComponentsOnly;
break;
case ID_SCH_EDIT_COMPONENT_FOOTPRINT:
filterList = SCH_COLLECTOR::CmpFieldFootprintOnly;
filterListAux = SCH_COLLECTOR::ComponentsOnly;
break;
default:
break;
}
item = LocateAndShowItem( data->GetPosition(), filterList,
aEvent.GetInt() );
// If no item found, and if an auxiliary filter exists, try to use it
if( !item && filterListAux )
item = LocateAndShowItem( data->GetPosition(), filterListAux,
aEvent.GetInt() );
// Exit if no item found at the current location or the item is already being edited.
......
......@@ -94,6 +94,13 @@ enum KICAD_T {
SCH_SHEET_PIN_T,
SCH_SHEET_T,
// Be prudent with these 3 types:
// they should be used only to locate a specific field type
// among SCH_FIELD_T items types
SCH_FIELD_LOCATE_REFERENCE_T,
SCH_FIELD_LOCATE_VALUE_T,
SCH_FIELD_LOCATE_FOOTPRINT_T,
// General
SCH_SCREEN_T,
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_freeroute.cpp
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dialog_freeroute.cpp
* Dialog to access to FreeRoute, the web bases free router, export/import files
* to/from FreeRoute
*/
#include <fctsys.h>
#include <appl_wxstruct.h>
......
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