本文整理汇总了C++中BASE_SCREEN::GetGrid方法的典型用法代码示例。如果您正苦于以下问题:C++ BASE_SCREEN::GetGrid方法的具体用法?C++ BASE_SCREEN::GetGrid怎么用?C++ BASE_SCREEN::GetGrid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BASE_SCREEN
的用法示例。
在下文中一共展示了BASE_SCREEN::GetGrid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GridPreset
int PCBNEW_CONTROL::GridPreset( const TOOL_EVENT& aEvent )
{
long idx = aEvent.Parameter<long>();
m_frame->SetPresetGrid( idx );
BASE_SCREEN* screen = m_frame->GetScreen();
GRID_TYPE grid = screen->GetGrid( idx );
getView()->GetGAL()->SetGridSize( VECTOR2D( grid.m_Size ) );
getView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
return 0;
}
示例2: SetTitle
GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) : m_parent( aParent )
{
BASE_SCREEN* screen = aParent->GetScreen();
SetTitle( _( "Grid" ) );
SetIcon( grid_select_xpm );
wxArrayString gridsList;
screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
for( unsigned int i = 0; i < gridsList.GetCount(); ++i )
{
GRID_TYPE& grid = screen->GetGrid( i );
Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
}
}
示例3: 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;
}
示例4: OnSelectGrid
void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
{
int* clientData;
int eventId = ID_POPUP_GRID_LEVEL_100;
if( event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED )
{
if( m_gridSelectBox == NULL )
return;
/*
* Don't use wxCommandEvent::GetClientData() here. It always
* returns NULL in GTK. This solution is not as elegant but
* it works.
*/
int index = m_gridSelectBox->GetSelection();
wxASSERT( index != wxNOT_FOUND );
clientData = (int*) m_gridSelectBox->wxItemContainer::GetClientData( index );
if( clientData != NULL )
eventId = *clientData;
}
else
{
eventId = event.GetId();
/* Update the grid select combobox if the grid size was changed
* by menu event.
*/
if( m_gridSelectBox != NULL )
{
for( size_t i = 0; i < m_gridSelectBox->GetCount(); i++ )
{
clientData = (int*) m_gridSelectBox->wxItemContainer::GetClientData( i );
if( clientData && eventId == *clientData )
{
m_gridSelectBox->SetSelection( i );
break;
}
}
}
}
// Be sure m_LastGridSizeId is up to date.
m_LastGridSizeId = eventId - ID_POPUP_GRID_LEVEL_1000;
BASE_SCREEN* screen = GetScreen();
if( screen->GetGridId() == eventId )
return;
/*
* This allows for saving non-sequential command ID offsets used that
* may be used in the grid size combobox. Do not use the selection
* index returned by GetSelection().
*/
screen->SetGrid( eventId );
SetCrossHairPosition( RefPos( true ) );
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();
}
示例5: AddMenuZoomAndGrid
void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
{
int maxZoomIds;
double zoom;
wxString msg;
BASE_SCREEN* screen = m_canvas->GetScreen();
msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
wxMenu* zoom_choice = new wxMenu;
AddMenuItem( MasterMenu, zoom_choice,
ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
KiBitmap( zoom_selection_xpm ) );
zoom = screen->GetZoom();
maxZoomIds = ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START;
maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
maxZoomIds : screen->m_ZoomList.size();
// Populate zoom submenu.
for( int i = 0; i < maxZoomIds; i++ )
{
msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
wxEmptyString, wxITEM_CHECK );
if( zoom == screen->m_ZoomList[i] )
zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
}
// Create grid submenu as required.
if( screen->GetGridCount() )
{
wxMenu* gridMenu = new wxMenu;
AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
_( "Grid" ), KiBitmap( grid_select_xpm ) );
wxArrayString gridsList;
int icurr = screen->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES );
for( unsigned i = 0; i < gridsList.GetCount(); i++ )
{
GRID_TYPE& grid = screen->GetGrid( i );
gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
if( (int)i == icurr )
gridMenu->Check( grid.m_CmdId, true );
}
}
MasterMenu->AppendSeparator();
AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
}
示例6: DrawBackGround
void WinEDA_DrawPanel::DrawBackGround(wxDC * DC)
/***********************************************/
/* Trace les axes X et Y et la grille
La grille n'est affichee que si elle peut etre facilement visible
La grille passe toujours par le centre de l'ecran
*/
{
int Color = BLUE;
BASE_SCREEN * screen = GetScreen();
int ii,jj ,xg , yg , color;
wxSize pas_grille_affichee;
bool drawgrid = FALSE;
int zoom = GetZoom();
wxSize size;
wxPoint org;
double pasx, pasy;
color = screen->m_GridColor;
GRSetDrawMode(DC, GR_COPY);
/* le pas d'affichage doit etre assez grand pour avoir une grille visible */
drawgrid = m_Parent->m_Draw_Grid;
pas_grille_affichee = screen->GetGrid();
ii = pas_grille_affichee.x / zoom;
if (ii < 5 ) { pas_grille_affichee.x *= 2 ; ii *= 2; }
if( ii < 5 ) drawgrid = FALSE; // grille trop petite
ii = pas_grille_affichee.y / zoom;
if (ii < 5 ) { pas_grille_affichee.y *= 2 ; ii *= 2; }
if( ii < 5 ) drawgrid = FALSE; // grille trop petite
GetViewStart(&org.x, &org.y);
GetScrollPixelsPerUnit(&ii, &jj);
org.x *= ii; org.y *= jj;
screen->m_StartVisu = org;
org.x *= zoom; org.y *= zoom;
org.x += screen->m_DrawOrg.x; org.y += screen->m_DrawOrg.y;
size = GetClientSize();
size.x *= zoom; size.y *= zoom;
pasx = screen->m_UserGrid.x * m_Parent->m_InternalUnits;
pasy = screen->m_UserGrid.y * m_Parent->m_InternalUnits;
if ( screen->m_UserGridUnit != INCHES )
{
pasx /= 25.4; pasy /= 25.4;
}
if( drawgrid)
{
m_Parent->PutOnGrid(&org) ;
GRSetColorPen(DC, color );
for ( ii = 0 ; ; ii++ )
{
xg = screen->m_UserGridIsON ? (int)( (ii * pasx) + 0.5)
:ii * pas_grille_affichee.x;
int xpos = org.x + xg;
for ( jj = 0 ; ; jj++ )
{
yg = screen->m_UserGridIsON ? (int)( (jj * pasy) + 0.5)
: jj * pas_grille_affichee.y;
GRPutPixel(&m_ClipBox, DC, xpos, org.y + yg, color);
if ( yg > size.y ) break;
}
if ( xg > size.x ) break;
}
}
/* trace des axes principaux */
if ( m_Parent->m_Draw_Axes )
{
/* Trace de l'axe vertical */
GRDashedLine(&m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
0, screen->ReturnPageSize().y, Color );
/* Trace de l'axe horizontal */
GRDashedLine(&m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
screen->ReturnPageSize().x, 0, Color );
}
/* trace des axes auxiliaires */
if ( m_Parent->m_Draw_Auxiliary_Axe)
{
m_Draw_Auxiliary_Axe(DC, FALSE);
}
}