center PCBNEW parts on screen when tracking clicks and parts from EESCHEMA
This commit is contained in:
parent
6acce67a64
commit
5c3b480afe
|
@ -20,7 +20,11 @@ email address.
|
|||
in PCBNEW when there is more than one click candidate at the same mouse
|
||||
or cursor coordinates. COLLECTOR not committed yet.
|
||||
* More beautification.
|
||||
|
||||
* The mouse click and part synchronization from EESCHEMA to PCBNEW would
|
||||
track fine but would not always position the PCBNEW part on screen. Now
|
||||
we center it unconditionally. No change was made in the reverse direction
|
||||
since that code uses the long established Find support.
|
||||
|
||||
|
||||
2007-Aug-14 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
|
|
|
@ -31,8 +31,10 @@ void RemoteCommand( const char* cmdline )
|
|||
{
|
||||
char line[1024];
|
||||
wxString msg;
|
||||
char* idcmd, * text;
|
||||
char* idcmd;
|
||||
char* text;
|
||||
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
|
||||
MODULE* module;
|
||||
|
||||
strncpy( line, cmdline, sizeof(line) - 1 );
|
||||
msg = CONV_FROM_UTF8( line );
|
||||
|
@ -48,7 +50,7 @@ void RemoteCommand( const char* cmdline )
|
|||
{
|
||||
msg = CONV_FROM_UTF8( text );
|
||||
|
||||
MODULE* module = ReturnModule( frame->m_Pcb, msg );
|
||||
module = ReturnModule( frame->m_Pcb, msg );
|
||||
|
||||
msg.Printf( _( "Locate module %s %s" ), msg.GetData(),
|
||||
module ? wxT( "Ok" ) : wxT( "not found" ) );
|
||||
|
@ -68,7 +70,6 @@ void RemoteCommand( const char* cmdline )
|
|||
if( idcmd && strcmp( idcmd, "$PIN:" ) == 0 )
|
||||
{
|
||||
wxString pinName, modName;
|
||||
MODULE* module;
|
||||
D_PAD* pad = NULL;
|
||||
int netcode = -1;
|
||||
|
||||
|
@ -112,6 +113,9 @@ void RemoteCommand( const char* cmdline )
|
|||
msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() );
|
||||
frame->Affiche_Message( msg );
|
||||
}
|
||||
|
||||
if( module ) // center the module on screen.
|
||||
frame->Recadre_Trace( false );
|
||||
}
|
||||
|
||||
|
||||
|
|
639
share/zoom.cpp
639
share/zoom.cpp
|
@ -1,11 +1,11 @@
|
|||
/************/
|
||||
/* zoom.cpp */
|
||||
/************/
|
||||
/************/
|
||||
/* zoom.cpp */
|
||||
/************/
|
||||
|
||||
/*
|
||||
Fonctions de gestion du zoom, du pas de grille et du
|
||||
recadrage automatique
|
||||
*/
|
||||
* Fonctions de gestion du zoom, du pas de grille et du
|
||||
* recadrage automatique
|
||||
*/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -38,404 +38,423 @@
|
|||
|
||||
|
||||
/**************************************************/
|
||||
void WinEDA_DrawFrame::Recadre_Trace(bool ToMouse)
|
||||
void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse )
|
||||
/**************************************************/
|
||||
|
||||
/* Calcule les offsets de trace.
|
||||
Les offsets sont ajustés a un multiple du pas de grille
|
||||
si ToMouse == TRUE, le curseur souris (curseur "systeme") est replace
|
||||
en position curseur graphique (curseur kicad)
|
||||
|
||||
Note: Mac OS ** does not ** allow moving mouse cursor by program.
|
||||
*/
|
||||
* Les offsets sont ajustés a un multiple du pas de grille
|
||||
* si ToMouse == TRUE, le curseur souris (curseur "systeme") est replace
|
||||
* en position curseur graphique (curseur kicad)
|
||||
*
|
||||
* Note: Mac OS ** does not ** allow moving mouse cursor by program.
|
||||
*/
|
||||
{
|
||||
/* decalages a apporter au trace en coordonnees ecran */
|
||||
PutOnGrid( &m_CurrentScreen->m_Curseur );
|
||||
AdjustScrollBars();
|
||||
|
||||
/* decalages a apporter au trace en coordonnees ecran */
|
||||
PutOnGrid(& m_CurrentScreen->m_Curseur) ;
|
||||
AdjustScrollBars();
|
||||
ReDrawPanel();
|
||||
|
||||
ReDrawPanel();
|
||||
|
||||
/* Place le curseur souris sur le curseur SCHEMA*/
|
||||
if ( ToMouse == TRUE )
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
/* Place le curseur souris sur le curseur SCHEMA*/
|
||||
if( ToMouse == TRUE )
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
void WinEDA_DrawFrame::PutOnGrid(wxPoint * coord)
|
||||
void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
|
||||
/************************************************/
|
||||
/* retourne la valeur de la coordonnee coord sur le point de grille le plus proche */
|
||||
{
|
||||
double ftmp;
|
||||
if ( ! m_CurrentScreen->m_UserGridIsON )
|
||||
{
|
||||
wxSize grid_size = m_CurrentScreen->GetGrid();
|
||||
ftmp = (double)coord->x / grid_size.x;
|
||||
coord->x = ((int)round(ftmp)) * grid_size.x;
|
||||
double ftmp;
|
||||
|
||||
ftmp = (double)coord->y / grid_size.y;
|
||||
coord->y = ((int)round(ftmp)) * grid_size.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
double pasx = m_CurrentScreen->m_UserGrid.x * m_InternalUnits;
|
||||
double pasy = m_CurrentScreen->m_UserGrid.y * m_InternalUnits;
|
||||
if ( m_CurrentScreen->m_UserGridUnit != INCHES )
|
||||
{
|
||||
pasx /= 25.4; pasy /= 25.4;
|
||||
}
|
||||
int nn = (int) round( coord->x /pasx);
|
||||
coord->x = (int) round( pasx * nn);
|
||||
nn = (int) round( coord->y /pasy);
|
||||
coord->y = (int) round( pasy * nn);
|
||||
}
|
||||
if( !m_CurrentScreen->m_UserGridIsON )
|
||||
{
|
||||
wxSize grid_size = m_CurrentScreen->GetGrid();
|
||||
|
||||
ftmp = (double) coord->x / grid_size.x;
|
||||
coord->x = ( (int) round( ftmp ) ) * grid_size.x;
|
||||
|
||||
ftmp = (double) coord->y / grid_size.y;
|
||||
coord->y = ( (int) round( ftmp ) ) * grid_size.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
double pasx = m_CurrentScreen->m_UserGrid.x * m_InternalUnits;
|
||||
double pasy = m_CurrentScreen->m_UserGrid.y * m_InternalUnits;
|
||||
|
||||
if( m_CurrentScreen->m_UserGridUnit != INCHES )
|
||||
{
|
||||
pasx /= 25.4;
|
||||
pasy /= 25.4;
|
||||
}
|
||||
|
||||
int nn = (int) round( coord->x / pasx );
|
||||
coord->x = (int) round( pasx * nn );
|
||||
|
||||
nn = (int) round( coord->y / pasy );
|
||||
coord->y = (int) round( pasy * nn );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
void WinEDA_DrawFrame::Zoom_Automatique(bool move_mouse_cursor)
|
||||
void WinEDA_DrawFrame::Zoom_Automatique( bool move_mouse_cursor )
|
||||
/**************************************************************/
|
||||
|
||||
/* Affiche le Schema au meilleur zoom au meilleur centrage pour le dessin
|
||||
de facon a avoir toute la feuille affichee a l'ecran
|
||||
*/
|
||||
* de facon a avoir toute la feuille affichee a l'ecran
|
||||
*/
|
||||
{
|
||||
int bestzoom;
|
||||
int bestzoom;
|
||||
|
||||
bestzoom = BestZoom();
|
||||
m_CurrentScreen->SetZoom(bestzoom);
|
||||
Recadre_Trace(move_mouse_cursor);
|
||||
bestzoom = BestZoom();
|
||||
m_CurrentScreen->SetZoom( bestzoom );
|
||||
Recadre_Trace( move_mouse_cursor );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************/
|
||||
void WinEDA_DrawFrame::Window_Zoom(EDA_Rect &Rect)
|
||||
void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect )
|
||||
/*************************************************/
|
||||
|
||||
/* Compute the zoom factor and the new draw offset to draw the
|
||||
selected area (Rect) in full window screen
|
||||
*/
|
||||
* selected area (Rect) in full window screen
|
||||
*/
|
||||
{
|
||||
int ii, jj;
|
||||
int bestzoom;
|
||||
wxSize size;
|
||||
int ii, jj;
|
||||
int bestzoom;
|
||||
wxSize size;
|
||||
|
||||
/* Compute the best zoom */
|
||||
Rect.Normalize();
|
||||
size = DrawPanel->GetClientSize();
|
||||
ii = Rect.GetSize().x / size.x;
|
||||
jj = Rect.GetSize().y / size.y;
|
||||
bestzoom = MAX(ii, jj);
|
||||
if ( bestzoom <= 0 ) bestzoom = 1;
|
||||
/* Compute the best zoom */
|
||||
Rect.Normalize();
|
||||
size = DrawPanel->GetClientSize();
|
||||
ii = Rect.GetSize().x / size.x;
|
||||
jj = Rect.GetSize().y / size.y;
|
||||
bestzoom = MAX( ii, jj );
|
||||
if( bestzoom <= 0 )
|
||||
bestzoom = 1;
|
||||
|
||||
m_CurrentScreen->SetZoom(bestzoom);
|
||||
m_CurrentScreen->SetZoom( bestzoom );
|
||||
|
||||
m_CurrentScreen->m_Curseur = Rect.Centre();
|
||||
Recadre_Trace(TRUE);
|
||||
m_CurrentScreen->m_Curseur = Rect.Centre();
|
||||
Recadre_Trace( TRUE );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent &event )
|
||||
void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event )
|
||||
/*****************************************************************/
|
||||
|
||||
/* Gere les commandes de zoom appelées par le menu Popup
|
||||
Toute autre commande est transmise a Parent->Process_Special_Functions(event)
|
||||
*/
|
||||
* Toute autre commande est transmise a Parent->Process_Special_Functions(event)
|
||||
*/
|
||||
{
|
||||
int id = event.GetId();
|
||||
wxClientDC dc(this);
|
||||
int id = event.GetId();
|
||||
wxClientDC dc( this );
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case ID_POPUP_ZOOM_PLUS :
|
||||
case ID_POPUP_ZOOM_MOINS :
|
||||
case ID_POPUP_ZOOM_CENTER :
|
||||
case ID_POPUP_ZOOM_AUTO :
|
||||
case ID_POPUP_ZOOM_REDRAW :
|
||||
m_Parent->OnZoom(id);
|
||||
break;
|
||||
switch( id )
|
||||
{
|
||||
case ID_POPUP_ZOOM_PLUS:
|
||||
case ID_POPUP_ZOOM_MOINS:
|
||||
case ID_POPUP_ZOOM_CENTER:
|
||||
case ID_POPUP_ZOOM_AUTO:
|
||||
case ID_POPUP_ZOOM_REDRAW:
|
||||
m_Parent->OnZoom( id );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_SELECT :
|
||||
break;
|
||||
case ID_POPUP_ZOOM_SELECT:
|
||||
break;
|
||||
|
||||
case ID_POPUP_CANCEL :
|
||||
MouseToCursorSchema();
|
||||
break;
|
||||
case ID_POPUP_CANCEL:
|
||||
MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_1 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(1);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_1:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 1 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_2 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(2);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_2:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 2 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_4 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(4);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_4:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 4 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_8 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(8);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_8:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 8 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_16 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(16);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_16:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 16 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_32 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(32);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_32:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 32 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_64 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(64);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_64:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 64 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_128 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(128);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_128:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 128 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_256 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(256);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_256:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 256 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_512 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(512);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_512:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 512 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_1024 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(1024);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_1024:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 1024 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_LEVEL_2048 :
|
||||
m_Parent->m_CurrentScreen->SetZoom(2048);
|
||||
m_Parent->Recadre_Trace(TRUE);
|
||||
break;
|
||||
case ID_POPUP_ZOOM_LEVEL_2048:
|
||||
m_Parent->m_CurrentScreen->SetZoom( 2048 );
|
||||
m_Parent->Recadre_Trace( TRUE );
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_1 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(1,1));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_1:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 1, 1 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_2 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(2,2));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_2:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 2, 2 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_5 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(5,5));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_5:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 5, 5 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_10 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(10,10));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_10:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 10, 10 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_20 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(20,20));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_20:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 20, 20 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_25 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(25,25));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_25:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 25, 25 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_50 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(50,50));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_50:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 50, 50 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_100 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(100,100));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_100:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 100, 100 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_200 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(200,200));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_200:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 200, 200 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_250 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(250,250));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_250:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 250, 250 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_500 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(500,500));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_500:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 500, 500 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_LEVEL_1000 :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(1000,1000));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_LEVEL_1000:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( 1000, 1000 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
case ID_POPUP_GRID_USER :
|
||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(-1,-1));
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
case ID_POPUP_GRID_USER:
|
||||
m_Parent->m_CurrentScreen->SetGrid( wxSize( -1, -1 ) );
|
||||
m_Parent->ReDrawPanel();
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError(this, wxT("WinEDA_DrawPanel::Process_Popup_Zoom() ID error") );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DisplayError( this, wxT( "WinEDA_DrawPanel::Process_Popup_Zoom() ID error" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
m_Parent->Affiche_Status_Box();
|
||||
m_Parent->Affiche_Status_Box();
|
||||
}
|
||||
|
||||
|
||||
class grid_list_struct
|
||||
{
|
||||
public:
|
||||
int m_value;
|
||||
int m_id;
|
||||
const wxChar * m_msg;
|
||||
int m_value;
|
||||
int m_id;
|
||||
const wxChar* m_msg;
|
||||
};
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
void WinEDA_DrawPanel::AddMenuZoom( wxMenu * MasterMenu )
|
||||
void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
|
||||
/*************************************************************/
|
||||
|
||||
/* add the zoom list menu the the MasterMenu.
|
||||
used in OnRightClick(wxMouseEvent& event)
|
||||
*/
|
||||
* used in OnRightClick(wxMouseEvent& event)
|
||||
*/
|
||||
{
|
||||
int zoom;
|
||||
wxSize grid;
|
||||
int zoom_value;
|
||||
wxString zoom_msg = _("Zoom: ");
|
||||
wxString grid_msg = _("Grid:"), msg;
|
||||
int ii;
|
||||
wxString line;
|
||||
int zoom;
|
||||
wxSize grid;
|
||||
int zoom_value;
|
||||
wxString zoom_msg = _( "Zoom: " );
|
||||
wxString grid_msg = _( "Grid:" ), msg;
|
||||
int ii;
|
||||
wxString line;
|
||||
|
||||
grid_list_struct grid_list_pcb[] =
|
||||
{
|
||||
{ 1000, ID_POPUP_GRID_LEVEL_1000, wxT(" 100") },
|
||||
{ 500, ID_POPUP_GRID_LEVEL_500, wxT(" 50") },
|
||||
{ 250, ID_POPUP_GRID_LEVEL_250, wxT(" 25") },
|
||||
{ 200, ID_POPUP_GRID_LEVEL_200, wxT(" 20") },
|
||||
{ 100, ID_POPUP_GRID_LEVEL_100, wxT(" 10") },
|
||||
{ 50, ID_POPUP_GRID_LEVEL_50, wxT(" 5") },
|
||||
{ 25, ID_POPUP_GRID_LEVEL_25, wxT(" 2.5") },
|
||||
{ 20, ID_POPUP_GRID_LEVEL_20, wxT(" 2") },
|
||||
{ 10, ID_POPUP_GRID_LEVEL_10, wxT(" 1") },
|
||||
{ 5, ID_POPUP_GRID_LEVEL_5, wxT(" 0.5") },
|
||||
{ 2, ID_POPUP_GRID_LEVEL_2, wxT(" 0.2") },
|
||||
{ 1, ID_POPUP_GRID_LEVEL_1, wxT(" 0.1") },
|
||||
{ 0, ID_POPUP_GRID_USER, _("grid user") }
|
||||
};
|
||||
grid_list_struct grid_list_pcb[] =
|
||||
{
|
||||
{ 1000, ID_POPUP_GRID_LEVEL_1000, wxT( " 100" ) },
|
||||
{ 500, ID_POPUP_GRID_LEVEL_500, wxT( " 50" ) },
|
||||
{ 250, ID_POPUP_GRID_LEVEL_250, wxT( " 25" ) },
|
||||
{ 200, ID_POPUP_GRID_LEVEL_200, wxT( " 20" ) },
|
||||
{ 100, ID_POPUP_GRID_LEVEL_100, wxT( " 10" ) },
|
||||
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 5" ) },
|
||||
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 2.5" ) },
|
||||
{ 20, ID_POPUP_GRID_LEVEL_20, wxT( " 2" ) },
|
||||
{ 10, ID_POPUP_GRID_LEVEL_10, wxT( " 1" ) },
|
||||
{ 5, ID_POPUP_GRID_LEVEL_5, wxT( " 0.5" ) },
|
||||
{ 2, ID_POPUP_GRID_LEVEL_2, wxT( " 0.2" ) },
|
||||
{ 1, ID_POPUP_GRID_LEVEL_1, wxT( " 0.1" ) },
|
||||
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) }
|
||||
};
|
||||
|
||||
grid_list_struct grid_list_schematic[] =
|
||||
{
|
||||
{ 50, ID_POPUP_GRID_LEVEL_50, wxT(" 50") },
|
||||
{ 25, ID_POPUP_GRID_LEVEL_25, wxT(" 25") },
|
||||
{ 10, ID_POPUP_GRID_LEVEL_10, wxT(" 10") },
|
||||
{ 5, ID_POPUP_GRID_LEVEL_5, wxT(" 5") },
|
||||
{ 2, ID_POPUP_GRID_LEVEL_2, wxT(" 2") },
|
||||
{ 1, ID_POPUP_GRID_LEVEL_1, wxT(" 1") },
|
||||
{ 0, ID_POPUP_GRID_USER, _("grid user") }
|
||||
};
|
||||
grid_list_struct grid_list_schematic[] =
|
||||
{
|
||||
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 50" ) },
|
||||
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 25" ) },
|
||||
{ 10, ID_POPUP_GRID_LEVEL_10, wxT( " 10" ) },
|
||||
{ 5, ID_POPUP_GRID_LEVEL_5, wxT( " 5" ) },
|
||||
{ 2, ID_POPUP_GRID_LEVEL_2, wxT( " 2" ) },
|
||||
{ 1, ID_POPUP_GRID_LEVEL_1, wxT( " 1" ) },
|
||||
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) }
|
||||
};
|
||||
|
||||
|
||||
ADD_MENUITEM(MasterMenu, ID_POPUP_ZOOM_CENTER, _("Center"), zoom_center_xpm);
|
||||
ADD_MENUITEM(MasterMenu, ID_POPUP_ZOOM_PLUS, _("Zoom +"), zoom_in_xpm);
|
||||
ADD_MENUITEM(MasterMenu, ID_POPUP_ZOOM_MOINS, _("Zoom -"), zoom_out_xpm);
|
||||
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_CENTER, _( "Center" ), zoom_center_xpm );
|
||||
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_PLUS, _( "Zoom +" ), zoom_in_xpm );
|
||||
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_MOINS, _( "Zoom -" ), zoom_out_xpm );
|
||||
|
||||
wxMenu * zoom_choice = new wxMenu;
|
||||
ADD_MENUITEM_WITH_SUBMENU(MasterMenu, zoom_choice,
|
||||
ID_POPUP_ZOOM_SELECT, _("Zoom Select"), zoom_select_xpm);
|
||||
wxMenu* zoom_choice = new wxMenu;
|
||||
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, zoom_choice,
|
||||
ID_POPUP_ZOOM_SELECT, _( "Zoom Select" ), zoom_select_xpm );
|
||||
|
||||
ADD_MENUITEM(MasterMenu, ID_POPUP_ZOOM_AUTO, _("Auto"), zoom_optimal_xpm);
|
||||
ADD_MENUITEM(MasterMenu, ID_POPUP_ZOOM_REDRAW, _("Redraw"), repaint_xpm);
|
||||
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_AUTO, _( "Auto" ), zoom_optimal_xpm );
|
||||
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_REDRAW, _( "Redraw" ), repaint_xpm );
|
||||
|
||||
/* Create the basic zoom list: */
|
||||
zoom = m_Parent->m_CurrentScreen->GetZoom();
|
||||
zoom_value = 1;
|
||||
for ( ii = 0; zoom_value <= m_Parent->m_ZoomMaxValue; zoom_value <<= 1, ii ++ ) // Create zoom choice 1 .. zoom max
|
||||
{
|
||||
line.Printf( wxT("%u"), zoom_value);
|
||||
zoom_choice->Append(ID_POPUP_ZOOM_LEVEL_1 + ii,
|
||||
zoom_msg + line, wxEmptyString,TRUE);
|
||||
if( zoom == zoom_value )
|
||||
zoom_choice->Check(ID_POPUP_ZOOM_LEVEL_1 + ii, TRUE);
|
||||
}
|
||||
/* Create the basic zoom list: */
|
||||
zoom = m_Parent->m_CurrentScreen->GetZoom();
|
||||
zoom_value = 1;
|
||||
for( ii = 0; zoom_value <= m_Parent->m_ZoomMaxValue; zoom_value <<= 1, ii++ ) // Create zoom choice 1 .. zoom max
|
||||
{
|
||||
line.Printf( wxT( "%u" ), zoom_value );
|
||||
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_1 + ii,
|
||||
zoom_msg + line, wxEmptyString, TRUE );
|
||||
if( zoom == zoom_value )
|
||||
zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_1 + ii, TRUE );
|
||||
}
|
||||
|
||||
wxMenu * grid_choice = new wxMenu;
|
||||
ADD_MENUITEM_WITH_SUBMENU(MasterMenu, grid_choice,
|
||||
ID_POPUP_GRID_SELECT, _("Grid Select"), grid_select_xpm);
|
||||
wxMenu* grid_choice = new wxMenu;
|
||||
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, grid_choice,
|
||||
ID_POPUP_GRID_SELECT, _( "Grid Select" ), grid_select_xpm );
|
||||
|
||||
grid = m_Parent->m_CurrentScreen->GetGrid();
|
||||
switch(m_Parent->m_Ident )
|
||||
{
|
||||
case MODULE_EDITOR_FRAME:
|
||||
case GERBER_FRAME:
|
||||
case PCB_FRAME:
|
||||
case CVPCB_DISPLAY_FRAME:
|
||||
for ( ii = 0; ; ii ++ ) // Create grid list
|
||||
{
|
||||
msg = grid_msg + grid_list_pcb[ii].m_msg;
|
||||
grid_choice->Append(grid_list_pcb[ii].m_id, msg, wxEmptyString, TRUE);
|
||||
if( grid_list_pcb[ii].m_value <= 0 )
|
||||
{
|
||||
if ( m_Parent->m_CurrentScreen->m_UserGridIsON )
|
||||
grid_choice->Check(grid_list_pcb[ii].m_id, TRUE);
|
||||
break;
|
||||
}
|
||||
if( grid.x == grid_list_pcb[ii].m_value )
|
||||
grid_choice->Check(grid_list_pcb[ii].m_id, TRUE);
|
||||
}
|
||||
break;
|
||||
grid = m_Parent->m_CurrentScreen->GetGrid();
|
||||
|
||||
case SCHEMATIC_FRAME:
|
||||
case LIBEDITOR_FRAME:
|
||||
for ( ii = 0; ; ii ++ ) // Create zoom choice 256 .. 1024
|
||||
{
|
||||
if ( grid_list_schematic[ii].m_value <= 0)
|
||||
break;
|
||||
msg = grid_msg + grid_list_schematic[ii].m_msg;
|
||||
grid_choice->Append(grid_list_schematic[ii].m_id,
|
||||
msg, wxEmptyString, TRUE);
|
||||
if( grid.x == grid_list_schematic[ii].m_value )
|
||||
grid_choice->Check(grid_list_schematic[ii].m_id, TRUE);
|
||||
}
|
||||
break;
|
||||
switch( m_Parent->m_Ident )
|
||||
{
|
||||
case MODULE_EDITOR_FRAME:
|
||||
case GERBER_FRAME:
|
||||
case PCB_FRAME:
|
||||
case CVPCB_DISPLAY_FRAME:
|
||||
for( ii = 0; ; ii++ ) // Create grid list
|
||||
{
|
||||
msg = grid_msg + grid_list_pcb[ii].m_msg;
|
||||
grid_choice->Append( grid_list_pcb[ii].m_id, msg, wxEmptyString, TRUE );
|
||||
if( grid_list_pcb[ii].m_value <= 0 )
|
||||
{
|
||||
if( m_Parent->m_CurrentScreen->m_UserGridIsON )
|
||||
grid_choice->Check( grid_list_pcb[ii].m_id, TRUE );
|
||||
break;
|
||||
}
|
||||
if( grid.x == grid_list_pcb[ii].m_value )
|
||||
grid_choice->Check( grid_list_pcb[ii].m_id, TRUE );
|
||||
}
|
||||
|
||||
case VIEWER_FRAME:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
MasterMenu->AppendSeparator();
|
||||
ADD_MENUITEM(MasterMenu, ID_POPUP_CANCEL, _("Close"), cancel_xpm);
|
||||
case SCHEMATIC_FRAME:
|
||||
case LIBEDITOR_FRAME:
|
||||
for( ii = 0; ; ii++ ) // Create zoom choice 256 .. 1024
|
||||
{
|
||||
if( grid_list_schematic[ii].m_value <= 0 )
|
||||
break;
|
||||
msg = grid_msg + grid_list_schematic[ii].m_msg;
|
||||
grid_choice->Append( grid_list_schematic[ii].m_id,
|
||||
msg, wxEmptyString, TRUE );
|
||||
if( grid.x == grid_list_schematic[ii].m_value )
|
||||
grid_choice->Check( grid_list_schematic[ii].m_id, TRUE );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case VIEWER_FRAME:
|
||||
break;
|
||||
}
|
||||
|
||||
MasterMenu->AppendSeparator();
|
||||
ADD_MENUITEM( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), cancel_xpm );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
void WinEDA_DrawFrame::Process_Zoom( wxCommandEvent& event )
|
||||
/**********************************************************/
|
||||
|
||||
/**********************************************************/
|
||||
void WinEDA_DrawFrame::Process_Zoom(wxCommandEvent& event)
|
||||
/**********************************************************/
|
||||
/* fonction de traitement des boutons de Zoom.
|
||||
Appelle simplement la fonction de traitement du Zoom de la
|
||||
fenetre active.
|
||||
*/
|
||||
* Appelle simplement la fonction de traitement du Zoom de la
|
||||
* fenetre active.
|
||||
*/
|
||||
{
|
||||
int id = event.GetId();
|
||||
int id = event.GetId();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case ID_ZOOM_PLUS_BUTT:
|
||||
case ID_ZOOM_MOINS_BUTT:
|
||||
case ID_ZOOM_REDRAW_BUTT:
|
||||
case ID_ZOOM_PAGE_BUTT:
|
||||
OnZoom(id);
|
||||
break;
|
||||
switch( id )
|
||||
{
|
||||
case ID_ZOOM_PLUS_BUTT:
|
||||
case ID_ZOOM_MOINS_BUTT:
|
||||
case ID_ZOOM_REDRAW_BUTT:
|
||||
case ID_ZOOM_PAGE_BUTT:
|
||||
OnZoom( id );
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError(this, wxT("WinEDA_DrawFrame::Process_Zoom id Error") );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DisplayError( this, wxT( "WinEDA_DrawFrame::Process_Zoom id Error" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue