本文整理汇总了C++中BASE_SCREEN::AddGrid方法的典型用法代码示例。如果您正苦于以下问题:C++ BASE_SCREEN::AddGrid方法的具体用法?C++ BASE_SCREEN::AddGrid怎么用?C++ BASE_SCREEN::AddGrid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BASE_SCREEN
的用法示例。
在下文中一共展示了BASE_SCREEN::AddGrid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InvokeDialogGrid
bool PCB_BASE_FRAME::InvokeDialogGrid()
{
wxPoint grid_origin = GetGridOrigin();
DIALOG_SET_GRID dlg( this, &m_UserGridUnit, g_UserUnit, &m_UserGridSize,
&grid_origin, &m_FastGrid1, &m_FastGrid2,
m_gridSelectBox->GetStrings() );
int ret = dlg.ShowModal();
if( ret == wxID_OK )
{
if( GetGridOrigin() != grid_origin && IsType( FRAME_PCB ) )
OnModify(); // because grid origin is saved in board, show as modified
SetGridOrigin( grid_origin );
BASE_SCREEN* screen = GetScreen();
screen->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
// If the user grid is the current option, recall SetGrid()
// to force new values put in list as current grid value
if( screen->GetGridCmdId() == ID_POPUP_GRID_USER )
screen->SetGrid( ID_POPUP_GRID_USER );
// Notify GAL
TOOL_MANAGER* mgr = GetToolManager();
if( mgr && IsGalCanvasActive() )
{
mgr->RunAction( "common.Control.gridPreset", true,
screen->GetGridCmdId() - ID_POPUP_GRID_LEVEL_1000 );
TOOL_EVENT gridOriginUpdate = COMMON_ACTIONS::gridSetOrigin.MakeEvent();
gridOriginUpdate.SetParameter( new VECTOR2D( grid_origin ) );
mgr->ProcessEvent( gridOriginUpdate );
}
m_canvas->Refresh();
return true;
}
return false;
}
示例2: InvokeDialogGrid
bool PCB_BASE_FRAME::InvokeDialogGrid()
{
wxPoint grid_origin = GetGridOrigin();
DIALOG_SET_GRID dlg( this, &m_UserGridUnit, g_UserUnit, &m_UserGridSize,
&grid_origin, &m_FastGrid1, &m_FastGrid2,
m_gridSelectBox->GetStrings() );
int ret = dlg.ShowModal();
if( ret == wxID_OK )
{
if( GetGridOrigin() != grid_origin && IsType( FRAME_PCB ) )
OnModify(); // because grid origin is saved in board, show as modified
SetGridOrigin( grid_origin );
BASE_SCREEN* screen = GetScreen();
screen->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
// 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 )
screen->SetGrid( ID_POPUP_GRID_USER );
if( IsGalCanvasActive() )
{
GetGalCanvas()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGrid().m_Size.x,
screen->GetGrid().m_Size.y ) );
GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
m_canvas->Refresh();
return true;
}
return false;
}