Pcbnew: add hotkey Z to reset grid origin.

Save grid origin in .kicad_pcb files only if not 0,0 (to keep compatibility with previous versions of pcbnew, mainly the stable version)
Very minor other fixes (set modify flag when grid origin is moved from the dialog grid)
This commit is contained in:
jean-pierre charras 2013-08-03 18:16:57 +02:00
parent 76a604bc35
commit d68c727b0f
8 changed files with 28 additions and 8 deletions

View File

@ -218,6 +218,7 @@ enum common_hotkey_id_commnand {
HK_NOT_FOUND = 0,
HK_RESET_LOCAL_COORD,
HK_SET_GRID_ORIGIN,
HK_RESET_GRID_ORIGIN,
HK_HELP,
HK_ZOOM_IN,
HK_ZOOM_OUT,

View File

@ -211,6 +211,9 @@ bool PCB_BASE_FRAME::InvokeDialogGrid()
if( ret == wxID_OK )
{
if( GetGridOrigin() != grid_origin && IsType( PCB_FRAME_TYPE ) )
OnModify(); // because grid origin is saved in board, show as modified
SetGridOrigin( grid_origin );
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );

View File

@ -55,6 +55,7 @@ static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer"
static EDA_HOTKEY HkSaveModule( wxT( "Save Module" ), HK_SAVE_MODULE, 'S' + GR_KB_CTRL );
static EDA_HOTKEY HkSavefile( wxT( "Save board" ), HK_SAVE_BOARD, 'S' + GR_KB_CTRL );
static EDA_HOTKEY HkSavefileAs( wxT( "Save board as" ), HK_SAVE_BOARD_AS, 'S' + GR_KB_CTRL + GR_KB_SHIFT );
static EDA_HOTKEY HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' + GR_KB_CTRL );
static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK );
@ -78,6 +79,7 @@ static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_
static EDA_HOTKEY HkSwitchHighContrastMode( wxT("Switch Highcontrast mode"), HK_SWITCH_HIGHCONTRAST_MODE,'H');
static EDA_HOTKEY HkSetGridOrigin( wxT("Set Grid Origin"), HK_SET_GRID_ORIGIN, 'S' );
static EDA_HOTKEY HkResetGridOrigin( wxT("Reset Grid Origin"), HK_RESET_GRID_ORIGIN, 'Z' );
/* Fit on Screen */
#if !defined( __WXMAC__ )
@ -195,7 +197,7 @@ EDA_HOTKEY* common_Hotkey_List[] =
{
&HkHelp, &HkZoomIn, &HkZoomOut,
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto,
&HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin,
&HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin, &HkResetGridOrigin,
&HkUndo, &HkRedo,
NULL
};
@ -211,7 +213,7 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
&HkPlaceItem, &HkCopyItem,
&HkEndTrack, &HkMoveItem, &HkFlipItem,
&HkRotateItem, &HkDragFootprint,
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile,
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile, &HkSavefileAs,
&HkLoadfile, &HkFindItem, &HkEditBoardItem,
&HkSwitch2CopperLayer, &HkSwitch2InnerLayer1,
&HkSwitch2InnerLayer2, &HkSwitch2InnerLayer3, &HkSwitch2InnerLayer4,

View File

@ -26,7 +26,9 @@ enum hotkey_id_commnand {
HK_SWITCH_TRACK_POSTURE,
HK_DRAG_TRACK_KEEP_SLOPE,
HK_END_TRACK,
HK_SAVE_BOARD, HK_LOAD_BOARD,
HK_SAVE_BOARD,
HK_SAVE_BOARD_AS,
HK_LOAD_BOARD,
HK_SAVE_MODULE,
HK_SWITCH_UNITS,
HK_SWITCH_TRACK_DISPLAY_MODE,

View File

@ -351,6 +351,12 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
m_canvas->Refresh();
break;
case HK_RESET_GRID_ORIGIN:
SetGridOrigin( wxPoint(0,0) );
OnModify(); // because grid origin is saved in board, show as modified
m_canvas->Refresh();
break;
case HK_SWITCH_UNITS:
evt_type = (g_UserUnit == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH;

View File

@ -64,6 +64,11 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
m_canvas->Refresh();
break;
case HK_RESET_GRID_ORIGIN:
SetGridOrigin( wxPoint(0,0) );
m_canvas->Refresh();
break;
case HK_SWITCH_UNITS:
cmd.SetId( (g_UserUnit == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH );

View File

@ -560,9 +560,10 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
FMTIU( aBoard->GetAuxOrigin().x ).c_str(),
FMTIU( aBoard->GetAuxOrigin().y ).c_str() );
m_out->Print( aNestLevel+1, "(grid_origin %s %s)\n",
FMTIU( aBoard->GetGridOrigin().x ).c_str(),
FMTIU( aBoard->GetGridOrigin().y ).c_str() );
if( aBoard->GetGridOrigin().x || aBoard->GetGridOrigin().y )
m_out->Print( aNestLevel+1, "(grid_origin %s %s)\n",
FMTIU( aBoard->GetGridOrigin().x ).c_str(),
FMTIU( aBoard->GetGridOrigin().y ).c_str() );
m_out->Print( aNestLevel+1, "(visible_elements %X)\n",
aBoard->GetDesignSettings().GetVisibleElements() );

View File

@ -105,8 +105,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( save_xpm ) );
// Save As
AddMenuItem( filesMenu, ID_SAVE_BOARD_AS,
_( "Sa&ve As...\tCtrl+Shift+S" ),
text = AddHotkeyName( _( "Sa&ve As..." ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD_AS );
AddMenuItem( filesMenu, ID_SAVE_BOARD_AS, text,
_( "Save the current board as..." ),
KiBitmap( save_as_xpm ) );
filesMenu->AppendSeparator();