Pcbnew: fix minor issues about fast grid switching, and next/previous grid selection from hotkeys. (GAL mode still has an issue)
This commit is contained in:
parent
b2745c4b00
commit
37b0868376
|
@ -48,7 +48,7 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) :
|
|||
m_NumberOfScreens = 1; // Hierarchy: Root: ScreenNumber = 1
|
||||
m_Zoom = 32.0;
|
||||
m_Grid.m_Size = wxRealPoint( 50, 50 ); // Default grid size
|
||||
m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50;
|
||||
m_Grid.m_CmdId = ID_POPUP_GRID_LEVEL_50;
|
||||
m_Center = true;
|
||||
m_IsPrinting = false;
|
||||
m_ScrollPixelsPerUnitX = 1;
|
||||
|
@ -183,7 +183,7 @@ int BASE_SCREEN::BuildGridsChoiceList( wxArrayString& aGridsList, bool aMmFirst)
|
|||
double gridValueMils = To_User_Unit( INCHES, grid.m_Size.x ) * 1000;
|
||||
double gridValue_mm = To_User_Unit( MILLIMETRES, grid.m_Size.x );
|
||||
|
||||
if( grid.m_Id == ID_POPUP_GRID_USER )
|
||||
if( grid.m_CmdId == ID_POPUP_GRID_USER )
|
||||
{
|
||||
msg = _( "User Grid" );
|
||||
idx_usergrid = i;
|
||||
|
@ -232,13 +232,13 @@ int BASE_SCREEN::SetGrid( const wxRealPoint& size )
|
|||
if( m_grids[i].m_Size == size )
|
||||
{
|
||||
m_Grid = m_grids[i];
|
||||
return m_grids[i].m_Id - ID_POPUP_GRID_LEVEL_1000;
|
||||
return m_grids[i].m_CmdId - ID_POPUP_GRID_LEVEL_1000;
|
||||
}
|
||||
|
||||
// keep track of the nearest larger grid size, if the exact size is not found
|
||||
if ( size.x < m_grids[i].m_Size.x )
|
||||
{
|
||||
gridIdx = m_grids[i].m_Id - ID_POPUP_GRID_LEVEL_1000;
|
||||
gridIdx = m_grids[i].m_CmdId - ID_POPUP_GRID_LEVEL_1000;
|
||||
nearest_grid = m_grids[i];
|
||||
}
|
||||
}
|
||||
|
@ -259,10 +259,10 @@ int BASE_SCREEN::SetGrid( int aCommandId )
|
|||
|
||||
for( unsigned i = 0; i < m_grids.size(); i++ )
|
||||
{
|
||||
if( m_grids[i].m_Id == aCommandId )
|
||||
if( m_grids[i].m_CmdId == aCommandId )
|
||||
{
|
||||
m_Grid = m_grids[i];
|
||||
return m_grids[i].m_Id - ID_POPUP_GRID_LEVEL_1000;
|
||||
return m_grids[i].m_CmdId - ID_POPUP_GRID_LEVEL_1000;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,26 +272,27 @@ int BASE_SCREEN::SetGrid( int aCommandId )
|
|||
wxT( "grid size( %g, %g )." ), aCommandId,
|
||||
m_Grid.m_Size.x, m_Grid.m_Size.y );
|
||||
|
||||
return m_grids[0].m_Id - ID_POPUP_GRID_LEVEL_1000;
|
||||
return m_grids[0].m_CmdId - ID_POPUP_GRID_LEVEL_1000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
|
||||
{
|
||||
for( unsigned i = 0; i < m_grids.size(); i++ )
|
||||
{
|
||||
if( m_grids[i].m_Size == grid.m_Size && grid.m_Id != ID_POPUP_GRID_USER )
|
||||
if( m_grids[i].m_Size == grid.m_Size && grid.m_CmdId != ID_POPUP_GRID_USER )
|
||||
{
|
||||
wxLogDebug( wxT( "Discarding duplicate grid size( %g, %g )." ),
|
||||
grid.m_Size.x, grid.m_Size.y );
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_grids[i].m_Id == grid.m_Id )
|
||||
if( m_grids[i].m_CmdId == grid.m_CmdId )
|
||||
{
|
||||
wxLogDebug( wxT( "Changing grid ID %d from size( %g, %g ) to " ) \
|
||||
wxT( "size( %g, %g )." ),
|
||||
grid.m_Id, m_grids[i].m_Size.x,
|
||||
grid.m_CmdId, m_grids[i].m_Size.x,
|
||||
m_grids[i].m_Size.y, grid.m_Size.x, grid.m_Size.y );
|
||||
m_grids[i].m_Size = grid.m_Size;
|
||||
return;
|
||||
|
@ -307,7 +308,7 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id )
|
|||
GRID_TYPE grid;
|
||||
|
||||
grid.m_Size = size;
|
||||
grid.m_Id = id;
|
||||
grid.m_CmdId = id;
|
||||
AddGrid( grid );
|
||||
}
|
||||
|
||||
|
@ -319,7 +320,7 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id )
|
|||
|
||||
new_size.x = From_User_Unit( aUnit, size.x );
|
||||
new_size.y = From_User_Unit( aUnit, size.y );
|
||||
new_grid.m_Id = id;
|
||||
new_grid.m_CmdId = id;
|
||||
new_grid.m_Size = new_size;
|
||||
|
||||
AddGrid( new_grid );
|
||||
|
@ -335,6 +336,19 @@ GRID_TYPE& BASE_SCREEN::GetGrid( size_t aIndex )
|
|||
}
|
||||
|
||||
|
||||
bool BASE_SCREEN::GridExists( int aCommandId )
|
||||
{
|
||||
// tests for grid command ID (not an index in grid list, but a wxID) exists in grid list.
|
||||
for( unsigned i = 0; i < m_grids.size(); i++ )
|
||||
{
|
||||
if( m_grids[i].m_CmdId == aCommandId )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
wxPoint BASE_SCREEN::getNearestGridPosition( const wxPoint& aPosition,
|
||||
const wxPoint& aGridOrigin, wxRealPoint* aGridSize ) const
|
||||
{
|
||||
|
|
|
@ -378,7 +378,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
|||
|
||||
if( event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED )
|
||||
{
|
||||
if( m_gridSelectBox == NULL ) // Should no happen
|
||||
if( m_gridSelectBox == NULL ) // Should not happen
|
||||
return;
|
||||
|
||||
/*
|
||||
|
@ -404,7 +404,9 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
|||
TOOL_MANAGER* mgr = GetToolManager();
|
||||
|
||||
if( mgr && IsGalCanvasActive() )
|
||||
{
|
||||
mgr->RunAction( "common.Control.gridPreset", true, idx );
|
||||
}
|
||||
else
|
||||
SetPresetGrid( idx );
|
||||
|
||||
|
@ -536,47 +538,58 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
|
|||
void EDA_DRAW_FRAME::SetNextGrid()
|
||||
{
|
||||
BASE_SCREEN * screen = GetScreen();
|
||||
int grid_cnt = screen->GetGridCount();
|
||||
|
||||
int new_grid_idx = screen->GetGridId() - ID_POPUP_GRID_LEVEL_1000 + 1;
|
||||
int new_grid_cmd = screen->GetGridCmdId();
|
||||
|
||||
if( new_grid_idx >= grid_cnt )
|
||||
new_grid_idx = 0;
|
||||
// if the grid id is the not the last, increment it
|
||||
if( screen->GridExists( new_grid_cmd + 1 ) )
|
||||
new_grid_cmd += 1;
|
||||
|
||||
SetPresetGrid( new_grid_idx );
|
||||
SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::SetPrevGrid()
|
||||
{
|
||||
BASE_SCREEN * screen = GetScreen();
|
||||
int grid_cnt = screen->GetGridCount();
|
||||
|
||||
int new_grid_idx = screen->GetGridId() - ID_POPUP_GRID_LEVEL_1000 - 1;
|
||||
int new_grid_cmd = screen->GetGridCmdId();
|
||||
|
||||
if( new_grid_idx < 0 )
|
||||
new_grid_idx = grid_cnt - 1;
|
||||
// if the grid id is the not the first, increment it
|
||||
if( screen->GridExists( new_grid_cmd - 1 ) )
|
||||
new_grid_cmd -= 1;
|
||||
|
||||
SetPresetGrid( new_grid_idx );
|
||||
SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::SetPresetGrid( int aIndex )
|
||||
{
|
||||
BASE_SCREEN * screen = GetScreen();
|
||||
|
||||
if( ! screen->GridExists( aIndex + ID_POPUP_GRID_LEVEL_1000 ) )
|
||||
aIndex = screen->GetGrids()[0].m_CmdId;
|
||||
|
||||
// aIndex is a Command Id relative to ID_POPUP_GRID_LEVEL_1000 comand id code.
|
||||
// we need an index in grid list (the cmd id in list is is screen->GetGrids()[0].m_CmdId):
|
||||
int glistIdx = aIndex + ID_POPUP_GRID_LEVEL_1000 - screen->GetGrids()[0].m_CmdId;
|
||||
|
||||
if( m_gridSelectBox )
|
||||
{
|
||||
if( aIndex < 0 || aIndex >= (int) m_gridSelectBox->GetCount() )
|
||||
if( glistIdx < 0 || glistIdx >= (int) m_gridSelectBox->GetCount() )
|
||||
{
|
||||
wxASSERT_MSG( false, "Invalid grid index" );
|
||||
return;
|
||||
}
|
||||
|
||||
m_gridSelectBox->SetSelection( aIndex );
|
||||
m_gridSelectBox->SetSelection( glistIdx );
|
||||
}
|
||||
|
||||
// Be sure m_LastGridSizeId is up to date.
|
||||
m_LastGridSizeId = aIndex;
|
||||
GetScreen()->SetGrid( aIndex + ID_POPUP_GRID_LEVEL_1000 );
|
||||
|
||||
// Put cursor on new grid
|
||||
SetCrossHairPosition( RefPos( true ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -289,10 +289,10 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
|
|||
for( unsigned i = 0; i < gridsList.GetCount(); i++ )
|
||||
{
|
||||
GRID_TYPE& grid = screen->GetGrid( i );
|
||||
gridMenu->Append( grid.m_Id, gridsList[i], wxEmptyString, true );
|
||||
gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, true );
|
||||
|
||||
if( (int)i == icurr )
|
||||
gridMenu->Check( grid.m_Id, true );
|
||||
gridMenu->Check( grid.m_CmdId, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,12 +89,11 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRA
|
|||
|
||||
LoadSettings( config() );
|
||||
|
||||
// Initialize grid id to a default value if not found in config or bad:
|
||||
if( (m_LastGridSizeId <= 0) ||
|
||||
(m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
|
||||
// Initialize grid id to a default value if not found in config or incorrect:
|
||||
if( !( GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) ) )
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000;
|
||||
|
||||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
|
||||
|
||||
// Initialize some display options
|
||||
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
|
||||
|
|
|
@ -153,7 +153,7 @@ void DIALOG_EESCHEMA_OPTIONS::SetGridSizes( const GRIDS& aGridSizes, int aGridId
|
|||
tmp.Printf( wxT( "%0.1f" ), aGridSizes[i].m_Size.x );
|
||||
m_choiceGridSize->Append( tmp );
|
||||
|
||||
if( aGridSizes[i].m_Id == aGridId )
|
||||
if( aGridSizes[i].m_CmdId == aGridId )
|
||||
select = (int) i;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void DIALOG_LIBEDIT_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id
|
|||
tmp.Printf( wxT( "%0.1f" ), grid_sizes[i].m_Size.x );
|
||||
m_choiceGridSize->Append( tmp );
|
||||
|
||||
if( grid_sizes[i].m_Id == grid_id )
|
||||
if( grid_sizes[i].m_CmdId == grid_id )
|
||||
select = (int) i;
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
|
|||
units.Add( GetUnitsLabel( MILLIMETRES ) );
|
||||
|
||||
dlg.SetUnits( units, g_UserUnit );
|
||||
dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() );
|
||||
dlg.SetGridSizes( grid_list, GetScreen()->GetGridCmdId() );
|
||||
dlg.SetBusWidth( GetDefaultBusThickness() );
|
||||
dlg.SetLineWidth( GetDefaultLineThickness() );
|
||||
dlg.SetTextSize( GetDefaultTextSize() );
|
||||
|
@ -784,7 +784,7 @@ void LIB_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
|
|||
|
||||
DIALOG_LIBEDIT_OPTIONS dlg( this );
|
||||
|
||||
dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() );
|
||||
dlg.SetGridSizes( grid_list, GetScreen()->GetGridCmdId() );
|
||||
dlg.SetLineWidth( GetDefaultLineThickness() );
|
||||
dlg.SetPinLength( GetDefaultPinLength() );
|
||||
dlg.SetPinNumSize( m_textPinNumDefaultSize );
|
||||
|
|
|
@ -337,16 +337,14 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
SetIcon( icon );
|
||||
|
||||
// Initialize grid id to the default value (50 mils):
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
||||
const int default_grid = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
||||
m_LastGridSizeId = default_grid;
|
||||
|
||||
LoadSettings( config() );
|
||||
|
||||
// Ensure m_LastGridSizeId is an offset inside the allowed schematic range
|
||||
if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 )
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
||||
|
||||
if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 )
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000;
|
||||
// Ensure m_LastGridSizeId is an offset inside the allowed schematic grid range
|
||||
if( !GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
|
||||
m_LastGridSizeId = default_grid;
|
||||
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2015 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
|
||||
|
@ -35,6 +35,7 @@
|
|||
#include <class_undoredo_container.h>
|
||||
#include <block_commande.h>
|
||||
#include <common.h>
|
||||
#include <id.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -44,14 +45,14 @@
|
|||
class GRID_TYPE
|
||||
{
|
||||
public:
|
||||
int m_Id;
|
||||
wxRealPoint m_Size;
|
||||
int m_CmdId; // The command id of this grid ( first id is ID_POPUP_GRID_LEVEL_1000 )
|
||||
wxRealPoint m_Size; // the size in internal unit of the grid (can differ for X and Y axis)
|
||||
|
||||
GRID_TYPE& operator=( const GRID_TYPE& item )
|
||||
{
|
||||
if( this != &item )
|
||||
{
|
||||
m_Id = item.m_Id;
|
||||
m_CmdId = item.m_CmdId;
|
||||
m_Size = item.m_Size;
|
||||
}
|
||||
|
||||
|
@ -60,7 +61,7 @@ public:
|
|||
|
||||
const bool operator==( const GRID_TYPE& item ) const
|
||||
{
|
||||
return m_Size == item.m_Size && m_Id == item.m_Id;
|
||||
return m_Size == item.m_Size && m_CmdId == item.m_CmdId;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -386,7 +387,7 @@ public:
|
|||
*
|
||||
* @return int - Currently selected grid command ID.
|
||||
*/
|
||||
int GetGridId() const { return m_Grid.m_Id; }
|
||||
int GetGridCmdId() const { return m_Grid.m_CmdId; }
|
||||
|
||||
/**
|
||||
* Return the grid size of the currently selected grid.
|
||||
|
@ -426,6 +427,14 @@ public:
|
|||
void AddGrid( const wxRealPoint& size, int id );
|
||||
void AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id );
|
||||
|
||||
/**
|
||||
* Function GridExists
|
||||
* tests for grid command ID (not an index in grid list, but a wxID) exists in grid list.
|
||||
* @param aCommandId = the wxWidgets command ID
|
||||
* @return true if the grid exists in grid list.
|
||||
*/
|
||||
bool GridExists( int aCommandId );
|
||||
|
||||
/**
|
||||
* Function GetGridCount().
|
||||
* Return the size of the grid list.
|
||||
|
|
|
@ -655,6 +655,18 @@ public:
|
|||
*/
|
||||
void SetFastGrid2();
|
||||
|
||||
/**
|
||||
* Virtual function SetNextGrid()
|
||||
* changes the grid size settings to the next one available.
|
||||
*/
|
||||
void SetNextGrid();
|
||||
|
||||
/**
|
||||
* Virtual function SetPrevGrid()
|
||||
* changes the grid size settings to the previous one available.
|
||||
*/
|
||||
void SetPrevGrid();
|
||||
|
||||
void ClearSelection();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
|
|
@ -83,11 +83,10 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
LoadSettings( config() );
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_1MM-ID_POPUP_GRID_LEVEL_1000 )
|
||||
if( ! GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1MM - ID_POPUP_GRID_LEVEL_1000;
|
||||
if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_1MM-ID_POPUP_GRID_LEVEL_1000 )
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_1MM-ID_POPUP_GRID_LEVEL_1000;
|
||||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
|
||||
GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
|
||||
|
||||
ReCreateMenuBar();
|
||||
ReCreateHToolbar();
|
||||
|
|
|
@ -487,7 +487,7 @@ void PCB_BASE_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
|
|||
|
||||
for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
|
||||
{
|
||||
if( GetScreen()->GetGridId() == GetScreen()->GetGrid( i ).m_Id )
|
||||
if( GetScreen()->GetGridCmdId() == GetScreen()->GetGrid( i ).m_CmdId )
|
||||
{
|
||||
select = (int) i;
|
||||
break;
|
||||
|
@ -815,7 +815,7 @@ void PCB_BASE_FRAME::updateGridSelectBox()
|
|||
for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
|
||||
{
|
||||
GRID_TYPE& grid = GetScreen()->GetGrid( i );
|
||||
m_gridSelectBox->Append( gridsList[i], (void*) &grid.m_Id );
|
||||
m_gridSelectBox->Append( gridsList[i], (void*) &grid.m_CmdId );
|
||||
}
|
||||
|
||||
m_gridSelectBox->SetSelection( icurr );
|
||||
|
@ -850,25 +850,66 @@ void PCB_BASE_FRAME::updateZoomSelectBox()
|
|||
|
||||
void PCB_BASE_FRAME::SetFastGrid1()
|
||||
{
|
||||
if( m_FastGrid1 >= GetScreen()->GetGridCount() )
|
||||
return;
|
||||
|
||||
int cmdId = GetScreen()->GetGrids()[m_FastGrid1].m_CmdId;
|
||||
SetPresetGrid( cmdId - ID_POPUP_GRID_LEVEL_1000 );
|
||||
|
||||
if( m_gridSelectBox )
|
||||
{
|
||||
m_gridSelectBox->SetSelection( m_FastGrid1 );
|
||||
|
||||
wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED );
|
||||
cmd.SetEventObject( this );
|
||||
OnSelectGrid( cmd );
|
||||
}
|
||||
else
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::SetFastGrid2()
|
||||
{
|
||||
if( m_FastGrid2 >= GetScreen()->GetGridCount() )
|
||||
return;
|
||||
|
||||
int cmdId = GetScreen()->GetGrids()[m_FastGrid2].m_CmdId;
|
||||
SetPresetGrid( cmdId - ID_POPUP_GRID_LEVEL_1000 );
|
||||
|
||||
if( m_gridSelectBox )
|
||||
{
|
||||
m_gridSelectBox->SetSelection( m_FastGrid2 );
|
||||
|
||||
wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED );
|
||||
cmd.SetEventObject( this );
|
||||
OnSelectGrid( cmd );
|
||||
}
|
||||
else
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
void PCB_BASE_FRAME::SetNextGrid()
|
||||
{
|
||||
EDA_DRAW_FRAME::SetNextGrid();
|
||||
|
||||
if( m_gridSelectBox )
|
||||
{
|
||||
wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED );
|
||||
cmd.SetEventObject( this );
|
||||
OnSelectGrid( cmd );
|
||||
}
|
||||
else
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::SetPrevGrid()
|
||||
{
|
||||
EDA_DRAW_FRAME::SetPrevGrid();
|
||||
|
||||
if( m_gridSelectBox )
|
||||
{
|
||||
wxCommandEvent cmd( wxEVT_COMMAND_COMBOBOX_SELECTED );
|
||||
cmd.SetEventObject( this );
|
||||
OnSelectGrid( cmd );
|
||||
}
|
||||
else
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ bool PCB_BASE_FRAME::InvokeDialogGrid()
|
|||
|
||||
// If the user grid is the current option, recall SetGrid()
|
||||
// to force new values put in list as current grid value
|
||||
if( screen->GetGridId() == ID_POPUP_GRID_USER )
|
||||
if( screen->GetGridCmdId() == ID_POPUP_GRID_USER )
|
||||
screen->SetGrid( ID_POPUP_GRID_USER );
|
||||
|
||||
// Notify GAL
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <pcbnew_id.h>
|
||||
#include <hotkeys.h>
|
||||
#include <class_zone.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
/* How to add a new hotkey:
|
||||
* see hotkeys.cpp
|
||||
|
|
|
@ -44,7 +44,7 @@ GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) : m_parent( aParent )
|
|||
for( unsigned int i = 0; i < gridsList.GetCount(); ++i )
|
||||
{
|
||||
GRID_TYPE& grid = screen->GetGrid( i );
|
||||
Append( grid.m_Id, gridsList[i], wxEmptyString, true );
|
||||
Append( grid.m_CmdId, gridsList[i], wxEmptyString, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,5 +64,5 @@ void GRID_MENU::Update()
|
|||
for( unsigned int i = 0; i < GetMenuItemCount(); ++i )
|
||||
Check( ID_POPUP_GRID_SELECT + 1 + i, false );
|
||||
|
||||
Check( m_parent->GetScreen()->GetGridId(), true );
|
||||
Check( m_parent->GetScreen()->GetGridCmdId(), true );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue