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
|
in PCBNEW when there is more than one click candidate at the same mouse
|
||||||
or cursor coordinates. COLLECTOR not committed yet.
|
or cursor coordinates. COLLECTOR not committed yet.
|
||||||
* More beautification.
|
* 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>
|
2007-Aug-14 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
|
@ -31,8 +31,10 @@ void RemoteCommand( const char* cmdline )
|
||||||
{
|
{
|
||||||
char line[1024];
|
char line[1024];
|
||||||
wxString msg;
|
wxString msg;
|
||||||
char* idcmd, * text;
|
char* idcmd;
|
||||||
|
char* text;
|
||||||
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
|
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
|
||||||
|
MODULE* module;
|
||||||
|
|
||||||
strncpy( line, cmdline, sizeof(line) - 1 );
|
strncpy( line, cmdline, sizeof(line) - 1 );
|
||||||
msg = CONV_FROM_UTF8( line );
|
msg = CONV_FROM_UTF8( line );
|
||||||
|
@ -48,7 +50,7 @@ void RemoteCommand( const char* cmdline )
|
||||||
{
|
{
|
||||||
msg = CONV_FROM_UTF8( text );
|
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(),
|
msg.Printf( _( "Locate module %s %s" ), msg.GetData(),
|
||||||
module ? wxT( "Ok" ) : wxT( "not found" ) );
|
module ? wxT( "Ok" ) : wxT( "not found" ) );
|
||||||
|
@ -68,7 +70,6 @@ void RemoteCommand( const char* cmdline )
|
||||||
if( idcmd && strcmp( idcmd, "$PIN:" ) == 0 )
|
if( idcmd && strcmp( idcmd, "$PIN:" ) == 0 )
|
||||||
{
|
{
|
||||||
wxString pinName, modName;
|
wxString pinName, modName;
|
||||||
MODULE* module;
|
|
||||||
D_PAD* pad = NULL;
|
D_PAD* pad = NULL;
|
||||||
int netcode = -1;
|
int netcode = -1;
|
||||||
|
|
||||||
|
@ -112,6 +113,9 @@ void RemoteCommand( const char* cmdline )
|
||||||
msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() );
|
msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() );
|
||||||
frame->Affiche_Message( msg );
|
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
|
* Fonctions de gestion du zoom, du pas de grille et du
|
||||||
recadrage automatique
|
* recadrage automatique
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.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.
|
/* Calcule les offsets de trace.
|
||||||
Les offsets sont ajustés a un multiple du pas de grille
|
* Les offsets sont ajustés a un multiple du pas de grille
|
||||||
si ToMouse == TRUE, le curseur souris (curseur "systeme") est replace
|
* si ToMouse == TRUE, le curseur souris (curseur "systeme") est replace
|
||||||
en position curseur graphique (curseur kicad)
|
* en position curseur graphique (curseur kicad)
|
||||||
|
*
|
||||||
Note: Mac OS ** does not ** allow moving mouse cursor by program.
|
* 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 */
|
ReDrawPanel();
|
||||||
PutOnGrid(& m_CurrentScreen->m_Curseur) ;
|
|
||||||
AdjustScrollBars();
|
|
||||||
|
|
||||||
ReDrawPanel();
|
/* Place le curseur souris sur le curseur SCHEMA*/
|
||||||
|
if( ToMouse == TRUE )
|
||||||
/* Place le curseur souris sur le curseur SCHEMA*/
|
DrawPanel->MouseToCursorSchema();
|
||||||
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 */
|
/* retourne la valeur de la coordonnee coord sur le point de grille le plus proche */
|
||||||
{
|
{
|
||||||
double ftmp;
|
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;
|
|
||||||
|
|
||||||
ftmp = (double)coord->y / grid_size.y;
|
if( !m_CurrentScreen->m_UserGridIsON )
|
||||||
coord->y = ((int)round(ftmp)) * grid_size.y;
|
{
|
||||||
}
|
wxSize grid_size = m_CurrentScreen->GetGrid();
|
||||||
else
|
|
||||||
{
|
ftmp = (double) coord->x / grid_size.x;
|
||||||
double pasx = m_CurrentScreen->m_UserGrid.x * m_InternalUnits;
|
coord->x = ( (int) round( ftmp ) ) * grid_size.x;
|
||||||
double pasy = m_CurrentScreen->m_UserGrid.y * m_InternalUnits;
|
|
||||||
if ( m_CurrentScreen->m_UserGridUnit != INCHES )
|
ftmp = (double) coord->y / grid_size.y;
|
||||||
{
|
coord->y = ( (int) round( ftmp ) ) * grid_size.y;
|
||||||
pasx /= 25.4; pasy /= 25.4;
|
}
|
||||||
}
|
else
|
||||||
int nn = (int) round( coord->x /pasx);
|
{
|
||||||
coord->x = (int) round( pasx * nn);
|
double pasx = m_CurrentScreen->m_UserGrid.x * m_InternalUnits;
|
||||||
nn = (int) round( coord->y /pasy);
|
double pasy = m_CurrentScreen->m_UserGrid.y * m_InternalUnits;
|
||||||
coord->y = (int) round( pasy * nn);
|
|
||||||
}
|
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
|
/* 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();
|
bestzoom = BestZoom();
|
||||||
m_CurrentScreen->SetZoom(bestzoom);
|
m_CurrentScreen->SetZoom( bestzoom );
|
||||||
Recadre_Trace(move_mouse_cursor);
|
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
|
/* 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 ii, jj;
|
||||||
int bestzoom;
|
int bestzoom;
|
||||||
wxSize size;
|
wxSize size;
|
||||||
|
|
||||||
/* Compute the best zoom */
|
/* Compute the best zoom */
|
||||||
Rect.Normalize();
|
Rect.Normalize();
|
||||||
size = DrawPanel->GetClientSize();
|
size = DrawPanel->GetClientSize();
|
||||||
ii = Rect.GetSize().x / size.x;
|
ii = Rect.GetSize().x / size.x;
|
||||||
jj = Rect.GetSize().y / size.y;
|
jj = Rect.GetSize().y / size.y;
|
||||||
bestzoom = MAX(ii, jj);
|
bestzoom = MAX( ii, jj );
|
||||||
if ( bestzoom <= 0 ) bestzoom = 1;
|
if( bestzoom <= 0 )
|
||||||
|
bestzoom = 1;
|
||||||
|
|
||||||
m_CurrentScreen->SetZoom(bestzoom);
|
m_CurrentScreen->SetZoom( bestzoom );
|
||||||
|
|
||||||
m_CurrentScreen->m_Curseur = Rect.Centre();
|
m_CurrentScreen->m_Curseur = Rect.Centre();
|
||||||
Recadre_Trace(TRUE);
|
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
|
/* 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();
|
int id = event.GetId();
|
||||||
wxClientDC dc(this);
|
wxClientDC dc( this );
|
||||||
|
|
||||||
switch (id)
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_POPUP_ZOOM_PLUS :
|
case ID_POPUP_ZOOM_PLUS:
|
||||||
case ID_POPUP_ZOOM_MOINS :
|
case ID_POPUP_ZOOM_MOINS:
|
||||||
case ID_POPUP_ZOOM_CENTER :
|
case ID_POPUP_ZOOM_CENTER:
|
||||||
case ID_POPUP_ZOOM_AUTO :
|
case ID_POPUP_ZOOM_AUTO:
|
||||||
case ID_POPUP_ZOOM_REDRAW :
|
case ID_POPUP_ZOOM_REDRAW:
|
||||||
m_Parent->OnZoom(id);
|
m_Parent->OnZoom( id );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_SELECT :
|
case ID_POPUP_ZOOM_SELECT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_CANCEL :
|
case ID_POPUP_CANCEL:
|
||||||
MouseToCursorSchema();
|
MouseToCursorSchema();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_1 :
|
case ID_POPUP_ZOOM_LEVEL_1:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(1);
|
m_Parent->m_CurrentScreen->SetZoom( 1 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_2 :
|
case ID_POPUP_ZOOM_LEVEL_2:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(2);
|
m_Parent->m_CurrentScreen->SetZoom( 2 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_4 :
|
case ID_POPUP_ZOOM_LEVEL_4:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(4);
|
m_Parent->m_CurrentScreen->SetZoom( 4 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_8 :
|
case ID_POPUP_ZOOM_LEVEL_8:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(8);
|
m_Parent->m_CurrentScreen->SetZoom( 8 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_16 :
|
case ID_POPUP_ZOOM_LEVEL_16:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(16);
|
m_Parent->m_CurrentScreen->SetZoom( 16 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_32 :
|
case ID_POPUP_ZOOM_LEVEL_32:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(32);
|
m_Parent->m_CurrentScreen->SetZoom( 32 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_64 :
|
case ID_POPUP_ZOOM_LEVEL_64:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(64);
|
m_Parent->m_CurrentScreen->SetZoom( 64 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_128 :
|
case ID_POPUP_ZOOM_LEVEL_128:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(128);
|
m_Parent->m_CurrentScreen->SetZoom( 128 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_256 :
|
case ID_POPUP_ZOOM_LEVEL_256:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(256);
|
m_Parent->m_CurrentScreen->SetZoom( 256 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_512 :
|
case ID_POPUP_ZOOM_LEVEL_512:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(512);
|
m_Parent->m_CurrentScreen->SetZoom( 512 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_1024 :
|
case ID_POPUP_ZOOM_LEVEL_1024:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(1024);
|
m_Parent->m_CurrentScreen->SetZoom( 1024 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_LEVEL_2048 :
|
case ID_POPUP_ZOOM_LEVEL_2048:
|
||||||
m_Parent->m_CurrentScreen->SetZoom(2048);
|
m_Parent->m_CurrentScreen->SetZoom( 2048 );
|
||||||
m_Parent->Recadre_Trace(TRUE);
|
m_Parent->Recadre_Trace( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_1 :
|
case ID_POPUP_GRID_LEVEL_1:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(1,1));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 1, 1 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_2 :
|
case ID_POPUP_GRID_LEVEL_2:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(2,2));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 2, 2 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_5 :
|
case ID_POPUP_GRID_LEVEL_5:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(5,5));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 5, 5 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_10 :
|
case ID_POPUP_GRID_LEVEL_10:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(10,10));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 10, 10 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_20 :
|
case ID_POPUP_GRID_LEVEL_20:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(20,20));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 20, 20 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_25 :
|
case ID_POPUP_GRID_LEVEL_25:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(25,25));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 25, 25 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_50 :
|
case ID_POPUP_GRID_LEVEL_50:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(50,50));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 50, 50 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_100 :
|
case ID_POPUP_GRID_LEVEL_100:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(100,100));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 100, 100 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_200 :
|
case ID_POPUP_GRID_LEVEL_200:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(200,200));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 200, 200 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_250 :
|
case ID_POPUP_GRID_LEVEL_250:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(250,250));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 250, 250 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_500 :
|
case ID_POPUP_GRID_LEVEL_500:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(500,500));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 500, 500 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_LEVEL_1000 :
|
case ID_POPUP_GRID_LEVEL_1000:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(1000,1000));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( 1000, 1000 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_GRID_USER :
|
case ID_POPUP_GRID_USER:
|
||||||
m_Parent->m_CurrentScreen->SetGrid(wxSize(-1,-1));
|
m_Parent->m_CurrentScreen->SetGrid( wxSize( -1, -1 ) );
|
||||||
m_Parent->ReDrawPanel();
|
m_Parent->ReDrawPanel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError(this, wxT("WinEDA_DrawPanel::Process_Popup_Zoom() ID error") );
|
DisplayError( this, wxT( "WinEDA_DrawPanel::Process_Popup_Zoom() ID error" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Parent->Affiche_Status_Box();
|
m_Parent->Affiche_Status_Box();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class grid_list_struct
|
class grid_list_struct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_value;
|
int m_value;
|
||||||
int m_id;
|
int m_id;
|
||||||
const wxChar * m_msg;
|
const wxChar* m_msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
void WinEDA_DrawPanel::AddMenuZoom( wxMenu * MasterMenu )
|
void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
|
|
||||||
/* add the zoom list menu the the MasterMenu.
|
/* add the zoom list menu the the MasterMenu.
|
||||||
used in OnRightClick(wxMouseEvent& event)
|
* used in OnRightClick(wxMouseEvent& event)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int zoom;
|
int zoom;
|
||||||
wxSize grid;
|
wxSize grid;
|
||||||
int zoom_value;
|
int zoom_value;
|
||||||
wxString zoom_msg = _("Zoom: ");
|
wxString zoom_msg = _( "Zoom: " );
|
||||||
wxString grid_msg = _("Grid:"), msg;
|
wxString grid_msg = _( "Grid:" ), msg;
|
||||||
int ii;
|
int ii;
|
||||||
wxString line;
|
wxString line;
|
||||||
|
|
||||||
grid_list_struct grid_list_pcb[] =
|
grid_list_struct grid_list_pcb[] =
|
||||||
{
|
{
|
||||||
{ 1000, ID_POPUP_GRID_LEVEL_1000, wxT(" 100") },
|
{ 1000, ID_POPUP_GRID_LEVEL_1000, wxT( " 100" ) },
|
||||||
{ 500, ID_POPUP_GRID_LEVEL_500, wxT(" 50") },
|
{ 500, ID_POPUP_GRID_LEVEL_500, wxT( " 50" ) },
|
||||||
{ 250, ID_POPUP_GRID_LEVEL_250, wxT(" 25") },
|
{ 250, ID_POPUP_GRID_LEVEL_250, wxT( " 25" ) },
|
||||||
{ 200, ID_POPUP_GRID_LEVEL_200, wxT(" 20") },
|
{ 200, ID_POPUP_GRID_LEVEL_200, wxT( " 20" ) },
|
||||||
{ 100, ID_POPUP_GRID_LEVEL_100, wxT(" 10") },
|
{ 100, ID_POPUP_GRID_LEVEL_100, wxT( " 10" ) },
|
||||||
{ 50, ID_POPUP_GRID_LEVEL_50, wxT(" 5") },
|
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 5" ) },
|
||||||
{ 25, ID_POPUP_GRID_LEVEL_25, wxT(" 2.5") },
|
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 2.5" ) },
|
||||||
{ 20, ID_POPUP_GRID_LEVEL_20, wxT(" 2") },
|
{ 20, ID_POPUP_GRID_LEVEL_20, wxT( " 2" ) },
|
||||||
{ 10, ID_POPUP_GRID_LEVEL_10, wxT(" 1") },
|
{ 10, ID_POPUP_GRID_LEVEL_10, wxT( " 1" ) },
|
||||||
{ 5, ID_POPUP_GRID_LEVEL_5, wxT(" 0.5") },
|
{ 5, ID_POPUP_GRID_LEVEL_5, wxT( " 0.5" ) },
|
||||||
{ 2, ID_POPUP_GRID_LEVEL_2, wxT(" 0.2") },
|
{ 2, ID_POPUP_GRID_LEVEL_2, wxT( " 0.2" ) },
|
||||||
{ 1, ID_POPUP_GRID_LEVEL_1, wxT(" 0.1") },
|
{ 1, ID_POPUP_GRID_LEVEL_1, wxT( " 0.1" ) },
|
||||||
{ 0, ID_POPUP_GRID_USER, _("grid user") }
|
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) }
|
||||||
};
|
};
|
||||||
|
|
||||||
grid_list_struct grid_list_schematic[] =
|
grid_list_struct grid_list_schematic[] =
|
||||||
{
|
{
|
||||||
{ 50, ID_POPUP_GRID_LEVEL_50, wxT(" 50") },
|
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 50" ) },
|
||||||
{ 25, ID_POPUP_GRID_LEVEL_25, wxT(" 25") },
|
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 25" ) },
|
||||||
{ 10, ID_POPUP_GRID_LEVEL_10, wxT(" 10") },
|
{ 10, ID_POPUP_GRID_LEVEL_10, wxT( " 10" ) },
|
||||||
{ 5, ID_POPUP_GRID_LEVEL_5, wxT(" 5") },
|
{ 5, ID_POPUP_GRID_LEVEL_5, wxT( " 5" ) },
|
||||||
{ 2, ID_POPUP_GRID_LEVEL_2, wxT(" 2") },
|
{ 2, ID_POPUP_GRID_LEVEL_2, wxT( " 2" ) },
|
||||||
{ 1, ID_POPUP_GRID_LEVEL_1, wxT(" 1") },
|
{ 1, ID_POPUP_GRID_LEVEL_1, wxT( " 1" ) },
|
||||||
{ 0, ID_POPUP_GRID_USER, _("grid user") }
|
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ADD_MENUITEM(MasterMenu, ID_POPUP_ZOOM_CENTER, _("Center"), zoom_center_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_PLUS, _( "Zoom +" ), zoom_in_xpm );
|
||||||
ADD_MENUITEM(MasterMenu, ID_POPUP_ZOOM_MOINS, _("Zoom -"), zoom_out_xpm);
|
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_MOINS, _( "Zoom -" ), zoom_out_xpm );
|
||||||
|
|
||||||
wxMenu * zoom_choice = new wxMenu;
|
wxMenu* zoom_choice = new wxMenu;
|
||||||
ADD_MENUITEM_WITH_SUBMENU(MasterMenu, zoom_choice,
|
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, zoom_choice,
|
||||||
ID_POPUP_ZOOM_SELECT, _("Zoom Select"), zoom_select_xpm);
|
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_AUTO, _( "Auto" ), zoom_optimal_xpm );
|
||||||
ADD_MENUITEM(MasterMenu, ID_POPUP_ZOOM_REDRAW, _("Redraw"), repaint_xpm);
|
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_REDRAW, _( "Redraw" ), repaint_xpm );
|
||||||
|
|
||||||
/* Create the basic zoom list: */
|
/* Create the basic zoom list: */
|
||||||
zoom = m_Parent->m_CurrentScreen->GetZoom();
|
zoom = m_Parent->m_CurrentScreen->GetZoom();
|
||||||
zoom_value = 1;
|
zoom_value = 1;
|
||||||
for ( ii = 0; zoom_value <= m_Parent->m_ZoomMaxValue; zoom_value <<= 1, ii ++ ) // Create zoom choice 1 .. zoom max
|
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);
|
line.Printf( wxT( "%u" ), zoom_value );
|
||||||
zoom_choice->Append(ID_POPUP_ZOOM_LEVEL_1 + ii,
|
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_1 + ii,
|
||||||
zoom_msg + line, wxEmptyString,TRUE);
|
zoom_msg + line, wxEmptyString, TRUE );
|
||||||
if( zoom == zoom_value )
|
if( zoom == zoom_value )
|
||||||
zoom_choice->Check(ID_POPUP_ZOOM_LEVEL_1 + ii, TRUE);
|
zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_1 + ii, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenu * grid_choice = new wxMenu;
|
wxMenu* grid_choice = new wxMenu;
|
||||||
ADD_MENUITEM_WITH_SUBMENU(MasterMenu, grid_choice,
|
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, grid_choice,
|
||||||
ID_POPUP_GRID_SELECT, _("Grid Select"), grid_select_xpm);
|
ID_POPUP_GRID_SELECT, _( "Grid Select" ), grid_select_xpm );
|
||||||
|
|
||||||
grid = m_Parent->m_CurrentScreen->GetGrid();
|
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;
|
|
||||||
|
|
||||||
case SCHEMATIC_FRAME:
|
switch( m_Parent->m_Ident )
|
||||||
case LIBEDITOR_FRAME:
|
{
|
||||||
for ( ii = 0; ; ii ++ ) // Create zoom choice 256 .. 1024
|
case MODULE_EDITOR_FRAME:
|
||||||
{
|
case GERBER_FRAME:
|
||||||
if ( grid_list_schematic[ii].m_value <= 0)
|
case PCB_FRAME:
|
||||||
break;
|
case CVPCB_DISPLAY_FRAME:
|
||||||
msg = grid_msg + grid_list_schematic[ii].m_msg;
|
for( ii = 0; ; ii++ ) // Create grid list
|
||||||
grid_choice->Append(grid_list_schematic[ii].m_id,
|
{
|
||||||
msg, wxEmptyString, TRUE);
|
msg = grid_msg + grid_list_pcb[ii].m_msg;
|
||||||
if( grid.x == grid_list_schematic[ii].m_value )
|
grid_choice->Append( grid_list_pcb[ii].m_id, msg, wxEmptyString, TRUE );
|
||||||
grid_choice->Check(grid_list_schematic[ii].m_id, TRUE);
|
if( grid_list_pcb[ii].m_value <= 0 )
|
||||||
}
|
{
|
||||||
break;
|
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();
|
case SCHEMATIC_FRAME:
|
||||||
ADD_MENUITEM(MasterMenu, ID_POPUP_CANCEL, _("Close"), cancel_xpm);
|
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.
|
/* fonction de traitement des boutons de Zoom.
|
||||||
Appelle simplement la fonction de traitement du Zoom de la
|
* Appelle simplement la fonction de traitement du Zoom de la
|
||||||
fenetre active.
|
* fenetre active.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
|
||||||
switch (id)
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_ZOOM_PLUS_BUTT:
|
case ID_ZOOM_PLUS_BUTT:
|
||||||
case ID_ZOOM_MOINS_BUTT:
|
case ID_ZOOM_MOINS_BUTT:
|
||||||
case ID_ZOOM_REDRAW_BUTT:
|
case ID_ZOOM_REDRAW_BUTT:
|
||||||
case ID_ZOOM_PAGE_BUTT:
|
case ID_ZOOM_PAGE_BUTT:
|
||||||
OnZoom(id);
|
OnZoom( id );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError(this, wxT("WinEDA_DrawFrame::Process_Zoom id Error") );
|
DisplayError( this, wxT( "WinEDA_DrawFrame::Process_Zoom id Error" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue