Eeschema: Bug fix (move component field was not undoable)

Minor enhancement in popup menus for wire and bus.
Kicad: stm32f0discovery template: very minor fix.
This commit is contained in:
jean-pierre charras 2012-10-23 18:37:19 +02:00
parent 28f238e36b
commit 6abf0e9f94
10 changed files with 99 additions and 19 deletions

View File

@ -95,17 +95,18 @@ enum id_eeschema_frm
ID_POPUP_START_RANGE,
ID_POPUP_SCH_DELETE,
ID_POPUP_SCH_BREAK_WIRE,
ID_POPUP_SCH_BEGIN_WIRE,
ID_POPUP_SCH_BEGIN_BUS,
ID_POPUP_END_LINE,
ID_POPUP_SCH_DELETE_CONNECTION,
ID_POPUP_SCH_DELETE_NODE,
ID_POPUP_SCH_DELETE_CMP,
ID_POPUP_SCH_UNUSED_2,
ID_POPUP_SCH_ENTRY_SELECT_SLASH,
ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH,
ID_POPUP_SCH_INIT_CMP,
ID_POPUP_SCH_SET_SHAPE_TEXT,
ID_POPUP_END_LINE,
ID_POPUP_SCH_END_SHEET,
ID_POPUP_SCH_RESIZE_SHEET,
ID_POPUP_SCH_CLEANUP_SHEET,

View File

@ -130,14 +130,17 @@ static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z'
#endif
// Schematic editor
static EDA_HOTKEY HkBeginWire( wxT( "Begin Wire" ), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT );
static EDA_HOTKEY HkBeginBus( wxT( "Begin Bus" ), HK_BEGIN_BUS, 'B', ID_BUS_BUTT );
static EDA_HOTKEY HkEndLineWireBus( wxT( "End Line Wire Bus" ), HK_END_CURR_LINEWIREBUS, 'K',
ID_POPUP_END_LINE );
static EDA_HOTKEY HkAddLabel( wxT( "Add Label" ), HK_ADD_LABEL, 'L', ID_LABEL_BUTT );
static EDA_HOTKEY HkAddHierarchicalLabel( wxT( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H',
ID_HIERLABEL_BUTT );
static EDA_HOTKEY HkAddGlobalLabel( wxT( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'L',
ID_GLABEL_BUTT );
static EDA_HOTKEY HkAddJunction( wxT( "Add Junction" ), HK_ADD_JUNCTION, 'J', ID_JUNCTION_BUTT );
static EDA_HOTKEY HkBeginWire( wxT( "Draw Wire" ), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT );
static EDA_HOTKEY HkBeginBus( wxT( "Draw Bus" ), HK_BEGIN_BUS, 'B', ID_BUS_BUTT );
static EDA_HOTKEY HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A',
ID_SCH_PLACE_COMPONENT );
static EDA_HOTKEY HkAddPower( wxT( "Add Power" ), HK_ADD_NEW_POWER, 'P',
@ -240,6 +243,7 @@ EDA_HOTKEY* s_Schematic_Hotkey_List[] =
&HkEditComponentFootprint,
&HkBeginWire,
&HkBeginBus,
&HkEndLineWireBus,
&HkAddLabel,
&HkAddHierarchicalLabel,
&HkAddGlobalLabel,
@ -373,13 +377,21 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_DELETE:
if( notBusy )
DeleteItemAtCrossHair( aDC );
break;
case HK_REPEAT_LAST:
if( notBusy && m_itemToRepeat && ( m_itemToRepeat->GetFlags() == 0 ) )
RepeatDrawItem( aDC );
break;
case HK_END_CURR_LINEWIREBUS:
// this key terminates a new line/bus/wire in progress
if( aItem && aItem->IsNew() &&
aItem->Type() == SCH_LINE_T )
{
cmd.SetId( hotKey->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd );
}
break;
case HK_UNDO:
@ -390,7 +402,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
cmd.SetId( hotKey->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd );
}
break;
case HK_FIND_NEXT_ITEM:

View File

@ -34,6 +34,7 @@ enum hotkey_id_commnand {
HK_ADD_NEW_POWER,
HK_BEGIN_WIRE,
HK_BEGIN_BUS,
HK_END_CURR_LINEWIREBUS,
HK_ADD_WIRE_ENTRY,
HK_ADD_BUS_ENTRY,
HK_ADD_LABEL,

View File

@ -99,7 +99,8 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
}
}
// If Command in progress: add "cancel" and "end tool" menu
// If a command is in progress: add "cancel" and "end tool" menu
// If
if( GetToolId() != ID_NO_TOOL_SELECTED )
{
if( item && item->GetFlags() )
@ -114,6 +115,24 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
}
PopMenu->AppendSeparator();
switch( GetToolId() )
{
case ID_WIRE_BUTT:
AddMenusForWire( PopMenu, NULL, this );
if( item == NULL )
PopMenu->AppendSeparator();
break;
case ID_BUS_BUTT:
AddMenusForBus( PopMenu, NULL, this );
if( item == NULL )
PopMenu->AppendSeparator();
break;
default:
break;
}
}
else
{
@ -533,14 +552,22 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
{
bool is_new = Wire->IsNew();
SCH_SCREEN* screen = frame->GetScreen();
wxPoint pos = screen->GetCrossHairPosition();
wxString msg;
if( Wire == NULL )
{
msg = AddHotkeyName( _( "Begin Wire" ), s_Schematic_Hokeys_Descr, HK_BEGIN_WIRE );
AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
return;
}
bool is_new = Wire->IsNew();
if( is_new )
{
AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "Wire End" ), KiBitmap( apply_xpm ) );
msg = AddHotkeyName( _( "Wire End" ), s_Schematic_Hokeys_Descr, HK_END_CURR_LINEWIREBUS );
AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( apply_xpm ) );
return;
}
@ -576,13 +603,21 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
{
bool is_new = Bus->IsNew();
wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg;
if( Bus == NULL )
{
msg = AddHotkeyName( _( "Begin Bus" ), s_Schematic_Hokeys_Descr, HK_BEGIN_BUS );
AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
return;
}
bool is_new = Bus->IsNew();
if( is_new )
{
AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), KiBitmap( apply_xpm ) );
msg = AddHotkeyName( _( "Bus End" ), s_Schematic_Hokeys_Descr, HK_END_CURR_LINEWIREBUS );
AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( apply_xpm ) );
return;
}

View File

@ -68,6 +68,8 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_CANCEL_CURRENT_COMMAND:
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
case ID_POPUP_SCH_BEGIN_WIRE:
case ID_POPUP_SCH_BEGIN_BUS:
case ID_POPUP_END_LINE:
case ID_POPUP_SCH_SET_SHAPE_TEXT:
case ID_POPUP_SCH_CLEANUP_SHEET:
@ -161,8 +163,17 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
EndSegment( &dc );
break;
case ID_POPUP_SCH_SET_SHAPE_TEXT:
case ID_POPUP_SCH_BEGIN_WIRE:
m_canvas->MoveCursorToCrossHair();
OnLeftClick( &dc, screen->GetCrossHairPosition() );
break;
case ID_POPUP_SCH_BEGIN_BUS:
m_canvas->MoveCursorToCrossHair();
OnLeftClick( &dc, screen->GetCrossHairPosition() );
break;
case ID_POPUP_SCH_SET_SHAPE_TEXT:
// Not used
break;

View File

@ -902,6 +902,16 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
undoItem = sheet;
}
else if( item->Type() == SCH_FIELD_T )
{
SCH_COMPONENT* cmp = (SCH_COMPONENT*) item->GetParent();
wxCHECK_RET( (cmp != NULL) && (cmp->Type() == SCH_COMPONENT_T),
wxT( "Cannot place field in invalid schematic component object." ) );
undoItem = cmp;
}
if( item->IsNew() )
{
if( item->Type() == SCH_SHEET_T )
@ -932,8 +942,18 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
}
else
{
// Here, item is not a basic schematic item, but an item inside
// a parent basic schematic item,
// currently: sheet pin or component field.
// currently, only a sheet pin can be found as new item,
// because new component fields have a specific handling, and do not appears here
SaveCopyInUndoList( undoItem, UR_CHANGED );
if( item->Type() == SCH_SHEET_PIN_T )
( (SCH_SHEET*)undoItem )->AddPin( (SCH_SHEET_PIN*) item );
else
wxLogMessage(wxT( "addCurrentItemToList: expected type = SCH_SHEET_PIN_T, actual type = %d" ),
item->Type() );
}
}
else

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

View File

@ -13,7 +13,8 @@ This project includes a PCB edge defined as the same size as the STM32F100 Disco
board with the connectors placed correctly to align the two boards. All IO present on the
Discovery board is connected to the project through 0.1" expansion headers.
<br><br>
<P><IMG SRC="stm32f0discovery.png" NAME="brd" ALIGN=BOTTOM BORDER=0><BR><BR><BR><BR>
<P ALIGN=CENTER><IMG SRC="board_stm32vl_discovery.png" NAME="brd" ALIGN=BOTTOM
BORDER=0><BR><BR><BR><BR>
</P>
(c)2012 Kerusey Karyu<br>
</body>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

View File

@ -1,6 +1,6 @@
PCBNEW-BOARD Version 1 date 2012-10-20 20:10:51
PCBNEW-BOARD Version 1 date 22/10/2012 08:11:40
# Created by Pcbnew(2012-10-17 BZR 3773)-testing
# Created by Pcbnew(2012-10-20 BZR 3775)-testing
$GENERAL
encoding utf-8
@ -21,7 +21,7 @@ $EndGENERAL
$SHEETDESCR
Sheet A3 16535 11693
Title "STM32 Value Line Discovery - Shiled board"
Date "20 oct 2012"
Date "22 oct 2012"
Rev "1.0"
Comp ""
Comment1 ""
@ -32,8 +32,8 @@ $EndSHEETDESCR
$SETUP
Layers 2
Layer[0] Dolna signal
Layer[15] Gorna signal
Layer[0] Back signal
Layer[15] Front signal
TrackWidth 100
TrackClearence 100
ZoneClearence 200