Commit 30a4bd39 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Minor Eeschema fixes.

* Fix a set position method bug in schematic item that caused the fields
  to drawn in the wrong position.
* Group zoom hot keys to use the same command event in schematic and
  library editor frames.
parent 6a4e8aa9
...@@ -83,32 +83,35 @@ ...@@ -83,32 +83,35 @@
/* Fit on Screen */ /* Fit on Screen */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomAuto( wxT( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME ); static EDA_HOTKEY HkZoomAuto( wxT( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE );
#else #else
static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0' ); static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0',
ID_ZOOM_PAGE );
#endif #endif
static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4,
ID_POPUP_ZOOM_CENTER );
/* Refresh Screen */ /* Refresh Screen */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW );
#else #else
static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R' ); static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R',
ID_ZOOM_REDRAW );
#endif #endif
/* Zoom In */ /* Zoom In */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN );
#else #else
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+' ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_POPUP_ZOOM_IN );
#endif #endif
/* Zoom Out */ /* Zoom Out */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_POPUP_ZOOM_OUT );
#else #else
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', ID_POPUP_ZOOM_OUT );
#endif #endif
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
...@@ -307,15 +310,15 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -307,15 +310,15 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
aHotKey += 'A' - 'a'; aHotKey += 'A' - 'a';
// Search command from key : // Search command from key :
EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List ); EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List );
if( HK_Descr == NULL ) if( hotKey == NULL )
HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Schematic_Hotkey_List ); hotKey = GetDescriptorFromHotkey( aHotKey, s_Schematic_Hotkey_List );
if( HK_Descr == NULL ) if( hotKey == NULL )
return; return;
switch( HK_Descr->m_Idcommand ) switch( hotKey->m_Idcommand )
{ {
default: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
...@@ -330,27 +333,11 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -330,27 +333,11 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT: case HK_ZOOM_OUT:
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW: case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER: case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_AUTO: case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE ); cmd.SetId( hotKey->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;
...@@ -358,7 +345,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -358,7 +345,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_REDO: case HK_REDO:
if( notBusy ) if( notBusy )
{ {
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent ); wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, hotKey->m_IdMenuEvent );
wxPostEvent( this, event ); wxPostEvent( this, event );
} }
break; break;
...@@ -694,7 +681,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -694,7 +681,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
} }
cmd.SetId( HK_Descr->m_IdMenuEvent ); cmd.SetId( hotKey->m_IdMenuEvent );
wxPostEvent( this, cmd ); wxPostEvent( this, cmd );
break; break;
...@@ -705,7 +692,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -705,7 +692,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem == NULL ) if( aItem == NULL )
{ {
aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::DraggableItems, aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::DraggableItems,
HK_Descr->m_Idcommand ); hotKey->m_Idcommand );
if( aItem == NULL ) if( aItem == NULL )
break; break;
...@@ -721,7 +708,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -721,7 +708,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_SHEET_T: case SCH_SHEET_T:
cmd.SetId( HK_Descr->m_IdMenuEvent ); cmd.SetId( hotKey->m_IdMenuEvent );
wxPostEvent( this, cmd ); wxPostEvent( this, cmd );
break; break;
...@@ -750,13 +737,13 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -750,13 +737,13 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem == NULL ) if( aItem == NULL )
{ {
aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::MovableItems, aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::MovableItems,
HK_Descr->m_Idcommand ); hotKey->m_Idcommand );
if( aItem == NULL ) if( aItem == NULL )
break; break;
} }
cmd.SetId( HK_Descr->m_IdMenuEvent ); cmd.SetId( hotKey->m_IdMenuEvent );
wxPostEvent( this, cmd ); wxPostEvent( this, cmd );
break; break;
...@@ -820,7 +807,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -820,7 +807,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem ) if( aItem )
{ {
cmd.SetId( HK_Descr->m_IdMenuEvent ); cmd.SetId( hotKey->m_IdMenuEvent );
wxPostEvent( this, cmd ); wxPostEvent( this, cmd );
} }
...@@ -850,15 +837,15 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -850,15 +837,15 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( (aHotKey >= 'a') && (aHotKey <= 'z') ) if( (aHotKey >= 'a') && (aHotKey <= 'z') )
aHotKey += 'A' - 'a'; aHotKey += 'A' - 'a';
EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List ); EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List );
if( HK_Descr == NULL ) if( hotKey == NULL )
HK_Descr = GetDescriptorFromHotkey( aHotKey, s_LibEdit_Hotkey_List ); hotKey = GetDescriptorFromHotkey( aHotKey, s_LibEdit_Hotkey_List );
if( HK_Descr == NULL ) if( hotKey == NULL )
return; return;
switch( HK_Descr->m_Idcommand ) switch( hotKey->m_Idcommand )
{ {
default: default:
case HK_NOT_FOUND: case HK_NOT_FOUND:
...@@ -873,27 +860,11 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -873,27 +860,11 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT: case HK_ZOOM_OUT:
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW: case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER: case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_AUTO: case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE ); cmd.SetId( hotKey->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
break; break;
......
...@@ -428,7 +428,7 @@ private: ...@@ -428,7 +428,7 @@ private:
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; } virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; } virtual void doSetPosition( const wxPoint& aPosition ) { Move( aPosition - m_Pos ); }
}; };
......
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