Commit 1ecea828 authored by stambaughw's avatar stambaughw

Initial ground work for zoom improvements and minor build updates.

parent a64f1567
......@@ -5,6 +5,18 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Dec-18 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++all
* Virtualize DrawFrame class methods required to eliminate compiling
drawframe.cpp multiple times depending on the application being built.
* Move zoom.cpp and drawframe.cpp to common library and update CMake files.
* drawpanel.cpp - Extracted mouse wheel events out of mouse event handler,
generate commands for mouse wheel events, and moved panning from DrawFrame
class into DrawPanel class.
* Initial ground work for new zoom implementation.
2008-Dec-15 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++gerbview
......
......@@ -17,6 +17,7 @@ set(COMMON_SRCS
dcsvg.cpp
displlst.cpp
dlist.cpp
drawframe.cpp
drawpanel.cpp
drawtxt.cpp
edaappl.cpp
......@@ -34,6 +35,7 @@ set(COMMON_SRCS
toolbars.cpp
trigo.cpp
worksheet.cpp
wxwineda.cpp)
wxwineda.cpp
zoom.cpp)
add_library(common ${COMMON_SRCS})
......@@ -7,32 +7,13 @@
#endif
#include "fctsys.h"
#include "common.h"
#ifdef PCBNEW
#include "pcbnew.h"
#endif
#ifdef EESCHEMA
#include "program.h"
#include "libcmp.h"
#include "general.h"
#endif
#ifdef CVPCB
#include "pcbnew.h"
#include "cvpcb.h"
#endif
#include <wx/fontdlg.h>
#include "bitmaps.h"
#include "protos.h"
#include "macros.h"
#include "id.h"
#include <wx/fontdlg.h>
/*******************************************************/
/* Constructeur de WinEDA_DrawFrame: la fenetre generale */
......@@ -70,10 +51,9 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
// Internal units per inch
// = 1000 for schema, = 10000 for PCB
m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
if( (m_Ident == PCB_FRAME) || (m_Ident == GERBER_FRAME)
|| (m_Ident == CVPCB_DISPLAY_FRAME)
|| (m_Ident == MODULE_EDITOR_FRAME)
)
if( ( m_Ident == PCB_FRAME ) || ( m_Ident == GERBER_FRAME )
|| ( m_Ident == CVPCB_DISPLAY_FRAME )
|| ( m_Ident == MODULE_EDITOR_FRAME ) )
m_InternalUnits = PCB_INTERNAL_UNIT;
minsize.x = 470;
......@@ -81,7 +61,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );
/* Verification des parametres de creation */
if( (size.x < minsize.x) || (size.y < minsize.y) )
if( ( size.x < minsize.x ) || ( size.y < minsize.y ) )
SetSize( 0, 0, minsize.x, minsize.y );
// Creation de la ligne de status
......@@ -104,9 +84,11 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
if( m_Ident != DISPLAY3D_FRAME )
{
DrawPanel = new WinEDA_DrawPanel( this, -1, wxPoint( 0, 0 ), m_FrameSize );
DrawPanel = new WinEDA_DrawPanel( this, -1, wxPoint( 0, 0 ),
m_FrameSize );
MsgPanel = new WinEDA_MsgPanel( this, -1, wxPoint( 0, m_FrameSize.y ),
wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
wxSize( m_FrameSize.x,
m_MsgFrameHeight ) );
MsgPanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
ColorRefs[LIGHTGRAY].m_Green,
ColorRefs[LIGHTGRAY].m_Blue ) );
......@@ -120,7 +102,7 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame()
{
if( DrawPanel ) // Required: in WinEDA3D_DrawFrame, DrawPanel == NULL !
wxGetApp().m_EDA_Config->Write( wxT( "AutoPAN" ),
DrawPanel->m_AutoPAN_Enable );
DrawPanel->m_AutoPAN_Enable );
}
......@@ -500,8 +482,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
* Met a jour seulement les variables message et curseur
*/
{
bool redraw = false;
// Change Cursor
if( DrawPanel )
{
......@@ -514,16 +494,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
if( id < 0 )
return;
#ifdef PCBNEW
// handle color changes for transitions in and out of ID_TRACK_BUTT
if( ( m_ID_current_state==ID_TRACK_BUTT && id!=ID_TRACK_BUTT )
|| ( m_ID_current_state!=ID_TRACK_BUTT && id==ID_TRACK_BUTT ) )
{
if( DisplayOpt.ContrastModeDisplay )
redraw = true;
}
#endif
// Old Tool Inactif ou ID_NO_SELECT_BUTT actif si pas de nouveau Tool
if( m_ID_current_state )
{
......@@ -560,11 +530,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_ID_current_state = id;
// must do this after the tool has been set, otherwise pad::Draw() does
// not show proper color when DisplayOpt.ContrastModeDisplay is true.
if( redraw )
ReDrawPanel();
}
......@@ -634,24 +599,6 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
Zoom_Automatique( FALSE );
break;
case ID_ZOOM_PANNING_UP:
OnPanning( ID_ZOOM_PANNING_UP );
break;
case ID_ZOOM_PANNING_DOWN:
OnPanning( ID_ZOOM_PANNING_DOWN );
break;
case ID_ZOOM_PANNING_LEFT:
OnPanning( ID_ZOOM_PANNING_LEFT );
DrawPanel->CursorOn( NULL );
break;
case ID_ZOOM_PANNING_RIGHT:
OnPanning( ID_ZOOM_PANNING_RIGHT );
break;
default:
wxMessageBox( wxT( "WinEDA_DrawFrame::OnZoom switch Error" ) );
break;
......@@ -661,59 +608,6 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
}
/**********************************************/
void WinEDA_DrawFrame::OnPanning( int direction )
/**********************************************/
/* Fonction de traitement du zoom
* Modifie le facteur de zoom et reaffiche l'ecran
* Pour les commandes par menu Popup ou par le clavier, le curseur est
* replac� au centre de l'ecran
*/
{
if( DrawPanel == NULL )
return;
int delta;
wxClientDC dc( DrawPanel );
int x, y;
DrawPanel->PrepareGraphicContext( &dc );
DrawPanel->GetViewStart( &x, &y ); // x and y are in scroll unit, not in pixels
delta = DrawPanel->m_ScrollButt_unit;
switch( direction )
{
case ID_ZOOM_PANNING_UP:
y -= delta;
break;
case ID_ZOOM_PANNING_DOWN:
y += delta;
break;
case ID_ZOOM_PANNING_LEFT:
x -= delta;
break;
case ID_ZOOM_PANNING_RIGHT:
x += delta;
break;
default:
wxMessageBox( wxT( "WinEDA_DrawFrame::OnPanning Error" ) );
break;
}
DrawPanel->Scroll( x, y );
/* Place le curseur souris sur le curseur SCHEMA*/
DrawPanel->MouseToCursorSchema();
}
/*****************************/
/* default virtual fonctions */
/*****************************/
......@@ -874,12 +768,14 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
}
/***********************************************/
void WinEDA_DrawFrame::Affiche_Status_Box()
/***********************************************/
/* Routine d'affichage du zoom et des coord curseur.
/*
* Update the status bar information.
*
* The base method updates the absolute and relative cooridinates and the
* zoom information. If you override this virtual method, make sure to call
* this subclassed method.
*/
void WinEDA_DrawFrame::Affiche_Status_Box()
{
wxString Line;
int dx, dy;
......@@ -893,10 +789,10 @@ void WinEDA_DrawFrame::Affiche_Status_Box()
SetStatusText( Line, 1 );
Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : wxT( "X %.4f Y %.4f" ),
To_User_Unit( g_UnitMetric, screen->m_Curseur.x,
m_InternalUnits ),
To_User_Unit( g_UnitMetric, screen->m_Curseur.y,
m_InternalUnits ) );
To_User_Unit( g_UnitMetric, screen->m_Curseur.x,
m_InternalUnits ),
To_User_Unit( g_UnitMetric, screen->m_Curseur.y,
m_InternalUnits ) );
SetStatusText( Line, 2 );
/* affichage des coordonnees relatives */
......@@ -904,26 +800,8 @@ void WinEDA_DrawFrame::Affiche_Status_Box()
dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) : wxT( "x %.4f y %.4f" ),
To_User_Unit( g_UnitMetric, dx, m_InternalUnits ),
To_User_Unit( g_UnitMetric, dy, m_InternalUnits ) );
To_User_Unit( g_UnitMetric, dx, m_InternalUnits ),
To_User_Unit( g_UnitMetric, dy, m_InternalUnits ) );
SetStatusText( Line, 3 );
#ifdef PCBNEW
if( DisplayOpt.DisplayPolarCood ) /* Display coordonnee polaire */
{
double theta, ro;
if( (dx == 0) && (dy == 0) )
theta = 0.0;
else
theta = atan2( (double) -dy, (double) dx );
theta = theta * 180 / M_PI;
ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
Line.Printf( g_UnitMetric ? wxT( "Ro %.3f Th %.1f" ) : wxT( "Ro %.4f Th %.1f" ),
To_User_Unit( g_UnitMetric, (int) round( ro ), m_InternalUnits ),
theta );
SetStatusText( Line, 0 );
}
#endif
}
......@@ -29,6 +29,7 @@ static bool s_IgnoreNextLeftButtonRelease = false;
// Events used by WinEDA_DrawPanel
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
EVT_MOUSEWHEEL( WinEDA_DrawPanel::OnMouseWheel )
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent )
......@@ -42,6 +43,7 @@ BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
WinEDA_DrawPanel::Process_Popup_Zoom )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
WinEDA_DrawPanel::OnPopupGridSelect )
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan )
END_EVENT_TABLE()
/************************************************************************/
......@@ -899,6 +901,47 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
}
/*
* Handle mouse wheel events.
*
* The mouse wheel is used to provide support for zooming and panning. This
* is accomplished by converting mouse wheel events in psuedo menu command
* events.
*/
void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
{
if( event.GetWheelRotation() == 0 )
{
event.Skip();
return;
}
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
// This is a zoom in ou out command
if( event.GetWheelRotation() > 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
cmd.SetId( ID_PAN_UP );
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_LEFT );
else
cmd.SetId( ID_POPUP_ZOOM_IN );
}
else if ( event.GetWheelRotation() < 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
cmd.SetId( ID_PAN_DOWN );
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_RIGHT );
else
cmd.SetId( ID_POPUP_ZOOM_OUT );
}
GetEventHandler()->ProcessEvent( cmd );
}
/******************************************************/
void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
/*******************************************************/
......@@ -932,30 +975,6 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
else
return;
// Mouse Wheel is a zoom command:
if( event.m_wheelRotation )
{
// This is a zoom in ou out command
if( event.GetWheelRotation() > 0 )
{
if( event.ShiftDown() )
localkey = EDA_PANNING_UP_KEY;
else if( event.ControlDown() )
localkey = EDA_PANNING_LEFT_KEY;
else
localkey = EDA_ZOOM_IN_FROM_MOUSE;
}
else
{
if( event.ShiftDown() )
localkey = EDA_PANNING_DOWN_KEY;
else if( event.ControlDown() )
localkey = EDA_PANNING_RIGHT_KEY;
else
localkey = EDA_ZOOM_OUT_FROM_MOUSE;
}
}
if( !event.IsButton() && !event.Moving()
&& !event.Dragging() && !localkey )
{
......@@ -1283,3 +1302,38 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
event.Skip(); // Allow menu shortcut processing
#endif
}
void WinEDA_DrawPanel::OnPan( wxCommandEvent& event )
{
int x, y;
wxClientDC dc( this );
PrepareGraphicContext( &dc );
GetViewStart( &x, &y ); // x and y are in scroll units, not in pixels
switch( event.GetId() )
{
case ID_PAN_UP:
y -= m_ScrollButt_unit;
break;
case ID_PAN_DOWN:
y += m_ScrollButt_unit;
break;
case ID_PAN_LEFT:
x -= m_ScrollButt_unit;
break;
case ID_PAN_RIGHT:
x += m_ScrollButt_unit;
break;
default:
wxLogDebug( wxT( "Unknown ID %d in WinEDA_DrawPanel::OnPan()." ),
event.GetId() );
}
Scroll( x, y );
MouseToCursorSchema();
}
......@@ -527,6 +527,10 @@ bool WinEDA_App::SetLanguage( bool first_time )
m_Locale = new wxLocale();
m_Locale->Init( m_LanguageId );
dic_path = ReturnKicadDatasPath() + BaseDictionaryPath;
wxLogDebug( wxT( "Adding prefix <" ) + dic_path +
wxT( "> to language lookup path." ) );
m_Locale->AddCatalogLookupPathPrefix( dic_path );
if( !first_time )
......@@ -554,6 +558,9 @@ void WinEDA_App::SetLanguageIdentifier( int menu_id )
{
unsigned int ii;
wxLogDebug( wxT( "Select language ID %d from %d possible languages." ),
menu_id, LANGUAGE_DESCR_COUNT );
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
if( menu_id == s_Language_List[ii].m_KI_Lang_Identifier )
......
......@@ -49,10 +49,7 @@ set(CVPCB_EXTRA_SRCS
../pcbnew/classpcb.cpp
../pcbnew/collectors.cpp
../pcbnew/ioascii.cpp
../pcbnew/tracemod.cpp
../share/drawframe.cpp
../share/zoom.cpp)
../pcbnew/tracemod.cpp)
if(WIN32)
if(MINGW)
......
......@@ -100,11 +100,9 @@ set(EESCHEMA_SRCS
viewlibs.cpp)
set(EESCHEMA_EXTRA_SRCS
../share/drawframe.cpp
../share/setpage.cpp
../share/svg_print.cpp
../share/wxprint.cpp
../share/zoom.cpp)
../share/wxprint.cpp)
if(WIN32)
if(MINGW)
......
......@@ -244,26 +244,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
case 0:
break;
case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
......@@ -375,26 +355,6 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
case 0:
break;
case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
......@@ -505,26 +465,6 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
case 0:
break;
case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
......
......@@ -53,10 +53,8 @@ set(GERBVIEW_EXTRA_SRCS
../pcbnew/sel_layer.cpp
../pcbnew/undelete.cpp
../share/drawframe.cpp
../share/setpage.cpp
../share/wxprint.cpp
../share/zoom.cpp)
../share/wxprint.cpp)
if(WIN32)
if(MINGW)
......
......@@ -71,26 +71,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed )
{
case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP );
curpos = GetScreen()->m_Curseur;
break;
case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = GetScreen()->m_Curseur;
break;
case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = GetScreen()->m_Curseur;
break;
case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = GetScreen()->m_Curseur;
......
......@@ -94,10 +94,13 @@ public:
void OnActivate( wxActivateEvent& event );
/* Mouse and keys events */
void OnMouseWheel( wxMouseEvent& event );
void OnMouseEvent( wxMouseEvent& event );
void OnMouseLeaving( wxMouseEvent& event );
void OnKeyEvent( wxKeyEvent& event );
void OnPan( wxCommandEvent& event );
/*************************/
void EraseScreen( wxDC* DC );
......
......@@ -380,16 +380,18 @@ enum main_id {
ID_ZOOM_REDRAW_KEY,
ID_ZOOM_CENTER_KEY,
ID_ZOOM_AUTO,
ID_ZOOM_PANNING_UP,
ID_ZOOM_PANNING_DOWN,
ID_ZOOM_PANNING_LEFT,
ID_ZOOM_PANNING_RIGHT,
ID_ZOOM_UNUSED0,
ID_ZOOM_UNUSED1,
ID_ZOOM_UNUSED2,
ID_ZOOM_UNUSED3,
ID_ZOOM_ENDLIST,
/* Panning command event IDs. */
ID_PAN_UP,
ID_PAN_DOWN,
ID_PAN_LEFT,
ID_PAN_RIGHT,
ID_GET_ANNOTATE, // Gestion fonctions : id consecutifs
ID_GET_ERC,
ID_GET_NETLIST,
......
......@@ -94,6 +94,9 @@ public:
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ReCreateMenuBar();
virtual void SetToolID( int id, int new_cursor_id,
const wxString& title );
virtual void Affiche_Status_Box();
PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) WinEDA_DrawFrame::GetBaseScreen(); }
......
......@@ -248,7 +248,8 @@ public:
virtual void ReCreateVToolbar() = 0;
virtual void ReCreateMenuBar();
virtual void ReCreateAuxiliaryToolbar();
void SetToolID( int id, int new_cursor_id, const wxString& title );
virtual void SetToolID( int id, int new_cursor_id,
const wxString& title );
virtual void OnSelectGrid( wxCommandEvent& event );
virtual void OnSelectZoom( wxCommandEvent& event );
......@@ -260,7 +261,6 @@ public:
// void OnChar(wxKeyEvent& event);
void SetToolbarBgColor( int color_num );
void OnZoom( int zoom_type );
void OnPanning( int direction );
void OnGrid( int grid_type );
void Recadre_Trace( bool ToMouse );
void PutOnGrid( wxPoint* coord ); /* set the coordiante "coord" to the nearest grid coordinate */
......@@ -299,7 +299,7 @@ public:
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars();
void Affiche_Status_Box(); /* Affichage des coord curseur, zoom .. */
virtual void Affiche_Status_Box(); /* Affichage des coord curseur, zoom .. */
void DisplayUnitsMsg();
/* Handlers for block commands */
......
......@@ -152,10 +152,8 @@ set(PCBNEW_SRCS
)
set(PCBNEW_EXTRA_SRCS
../share/drawframe.cpp
../share/setpage.cpp
../share/wxprint.cpp
../share/zoom.cpp)
../share/wxprint.cpp)
if(WIN32)
if(MINGW)
......
......@@ -338,3 +338,60 @@ GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
return guide;
}
void WinEDA_BasePcbFrame::SetToolID( int id, int new_cursor_id,
const wxString& title )
{
bool redraw = false;
WinEDA_DrawFrame::SetToolID( id, new_cursor_id, title );
if( id < 0 )
return;
// handle color changes for transitions in and out of ID_TRACK_BUTT
if( ( m_ID_current_state == ID_TRACK_BUTT && id != ID_TRACK_BUTT )
|| ( m_ID_current_state != ID_TRACK_BUTT && id == ID_TRACK_BUTT ) )
{
if( DisplayOpt.ContrastModeDisplay )
redraw = true;
}
// must do this after the tool has been set, otherwise pad::Draw() does
// not show proper color when DisplayOpt.ContrastModeDisplay is true.
if( redraw )
ReDrawPanel();
}
void WinEDA_BasePcbFrame::Affiche_Status_Box()
{
wxString Line;
int dx, dy;
double theta, ro;
BASE_SCREEN* screen = GetBaseScreen();
if( !screen )
return;
WinEDA_DrawFrame::Affiche_Status_Box();
dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
if( DisplayOpt.DisplayPolarCood ) /* Display coordonnee polaire */
{
if( (dx == 0) && (dy == 0) )
theta = 0.0;
else
theta = atan2( (double) -dy, (double) dx );
theta = theta * 180.0 / M_PI;
ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
Line.Printf( g_UnitMetric ? wxT( "Ro %.3f Th %.1f" ) : wxT( "Ro %.4f Th %.1f" ),
To_User_Unit( g_UnitMetric, (int) round( ro ), m_InternalUnits ),
theta );
}
SetStatusText( Line, 0 );
}
......@@ -530,26 +530,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed )
{
case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP );
curpos = GetScreen()->m_Curseur;
break;
case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = GetScreen()->m_Curseur;
break;
case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = GetScreen()->m_Curseur;
break;
case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
oldpos = curpos = GetScreen()->m_Curseur;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment