本文整理汇总了C++中BASE_SCREEN::GetZoom方法的典型用法代码示例。如果您正苦于以下问题:C++ BASE_SCREEN::GetZoom方法的具体用法?C++ BASE_SCREEN::GetZoom怎么用?C++ BASE_SCREEN::GetZoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BASE_SCREEN
的用法示例。
在下文中一共展示了BASE_SCREEN::GetZoom方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetZoomLevelIndicator
const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const
{
BASE_SCREEN* screen = GetScreen();
wxString Line;
if( screen )
{
// returns a human readable value which can be displayed as zoom
// level indicator in dialogs.
double level = m_zoomLevelCoeff / (double)screen->GetZoom();
Line.Printf( wxT( "Z %.2f" ), level );
}
return Line;
}
示例2: update
void ZOOM_MENU::update()
{
BASE_SCREEN* screen = m_parent->GetScreen();
double zoom = screen->GetZoom();
const std::vector<double>& zoomList = m_parent->GetScreen()->m_ZoomList;
// Check the current zoom
int maxZoomIds = std::min( ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START,
(int) screen->m_ZoomList.size() );
for( int i = 0; i < maxZoomIds; ++i )
{
// Search for a value near the current zoom setting:
double rel_error = std::fabs( zoomList[i] - zoom )/zoom;
Check( ID_POPUP_ZOOM_LEVEL_START+1 + i, rel_error < 0.1 );
}
}
示例3: UpdateStatusBar
void EDA_DRAW_FRAME::UpdateStatusBar()
{
wxString Line;
BASE_SCREEN* screen = GetScreen();
if( !screen )
return;
// Display Zoom level: zoom = zoom_coeff/ZoomScalar
Line.Printf( wxT( "Z %g" ), screen->GetZoom() );
SetStatusText( Line, 1 );
// Absolute and relative cursor positions are handled by overloading this function and
// handling the internal to user units conversion at the appropriate level.
// refresh units display
DisplayUnitsMsg();
}
示例4: 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 ) );
}
示例5: ReadGeneralDescrPcb
int WinEDA_BasePcbFrame::ReadGeneralDescrPcb(wxDC * DC, FILE * File, int * LineNum)
/**********************************************************************************/
{
char Line[1024], *data;
BASE_SCREEN * screen = m_CurrentScreen;
while( GetLine(File, Line, LineNum ) != NULL )
{
data = strtok(Line," =\n\r");
if(strnicmp(data,"$EndGENERAL",10) == 0) break;
if( strncmp(data, "Ly", 2) == 0 ) // Old format for Layer count
{
int Masque_Layer = 1, ii;
data = strtok(NULL," =\n\r");
sscanf(data,"%X",&Masque_Layer);
// Setup layer count
m_Pcb->m_BoardSettings->m_CopperLayerCount = 0;
for ( ii = 0; ii < NB_COPPER_LAYERS; ii++ )
{
if ( Masque_Layer & 1 ) m_Pcb->m_BoardSettings->m_CopperLayerCount++;
Masque_Layer >>= 1;
}
continue;
}
if(strnicmp(data, "Links", 5) == 0)
{
data = strtok(NULL," =\n\r");
m_Pcb->m_NbLinks = atoi(data);
continue;
}
if(strnicmp(data, "NoConn", 6) == 0)
{
data = strtok(NULL," =\n\r");
m_Pcb->m_NbNoconnect = atoi(data);
continue;
}
if(strnicmp(data, "Di", 2) == 0)
{
int ii, jj, bestzoom;
wxSize pcbsize, screensize;
data = strtok(NULL," =\n\r");
m_Pcb->m_BoundaryBox.SetX(atoi(data));
data = strtok(NULL," =\n\r");
m_Pcb->m_BoundaryBox.SetY(atoi(data));
data = strtok(NULL," =\n\r");
m_Pcb->m_BoundaryBox.SetWidth(atoi(data) - m_Pcb->m_BoundaryBox.GetX());
data = strtok(NULL," =\n\r");
m_Pcb->m_BoundaryBox.SetHeight(atoi(data) - m_Pcb->m_BoundaryBox.GetY());
/* calcul du zoom optimal */
pcbsize = m_Pcb->m_BoundaryBox.GetSize();
screensize = DrawPanel->GetClientSize();
ii = pcbsize.x/screensize.x;
jj = pcbsize.y/screensize.y;
bestzoom = max(ii, jj);
screen->m_Curseur = m_Pcb->m_BoundaryBox.Centre();
screen->SetZoom(bestzoom);
// la position des tracés a changé: mise a jour dans le DC courant
wxPoint org;
DrawPanel->GetViewStart(&org.x, &org.y);
DrawPanel->GetScrollPixelsPerUnit(&ii, &jj);
org.x *= ii; org.y *= jj;
#ifdef WX_ZOOM
DC->SetUserScale(1.0/(double)screen->GetZoom(), 1.0/screen->GetZoom());
org.x *= screen->GetZoom(); org.y *= screen->GetZoom();
DC->SetDeviceOrigin(-org.x, -org.y);
#endif
DrawPanel->SetBoundaryBox();
Recadre_Trace(TRUE);
continue;
}
/* Lecture du nombre de segments type DRAW , TRACT, ZONE */
if(stricmp(data, "Ndraw") == 0)
{
data = strtok(NULL," =\n\r");
NbDraw = atoi(data);;
continue;
}
if(stricmp(data, "Ntrack") == 0)
{
data = strtok(NULL," =\n\r");
NbTrack = atoi(data);
continue;
}
if(stricmp(data, "Nzone") == 0)
{
data = strtok(NULL," =\n\r");
NbZone = atoi(data);
continue;
}
if(stricmp(data, "Nmodule") == 0)
//.........这里部分代码省略.........