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 ...@@ -5,6 +5,18 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. 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> 2008-Dec-15 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
++gerbview ++gerbview
......
...@@ -17,6 +17,7 @@ set(COMMON_SRCS ...@@ -17,6 +17,7 @@ set(COMMON_SRCS
dcsvg.cpp dcsvg.cpp
displlst.cpp displlst.cpp
dlist.cpp dlist.cpp
drawframe.cpp
drawpanel.cpp drawpanel.cpp
drawtxt.cpp drawtxt.cpp
edaappl.cpp edaappl.cpp
...@@ -34,6 +35,7 @@ set(COMMON_SRCS ...@@ -34,6 +35,7 @@ set(COMMON_SRCS
toolbars.cpp toolbars.cpp
trigo.cpp trigo.cpp
worksheet.cpp worksheet.cpp
wxwineda.cpp) wxwineda.cpp
zoom.cpp)
add_library(common ${COMMON_SRCS}) add_library(common ${COMMON_SRCS})
...@@ -7,32 +7,13 @@ ...@@ -7,32 +7,13 @@
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include "common.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 "bitmaps.h"
#include "macros.h"
#include "protos.h"
#include "id.h" #include "id.h"
#include <wx/fontdlg.h>
/*******************************************************/ /*******************************************************/
/* Constructeur de WinEDA_DrawFrame: la fenetre generale */ /* Constructeur de WinEDA_DrawFrame: la fenetre generale */
...@@ -70,10 +51,9 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -70,10 +51,9 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
// Internal units per inch // Internal units per inch
// = 1000 for schema, = 10000 for PCB // = 1000 for schema, = 10000 for PCB
m_InternalUnits = EESCHEMA_INTERNAL_UNIT; m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
if( (m_Ident == PCB_FRAME) || (m_Ident == GERBER_FRAME) if( ( m_Ident == PCB_FRAME ) || ( m_Ident == GERBER_FRAME )
|| (m_Ident == CVPCB_DISPLAY_FRAME) || ( m_Ident == CVPCB_DISPLAY_FRAME )
|| (m_Ident == MODULE_EDITOR_FRAME) || ( m_Ident == MODULE_EDITOR_FRAME ) )
)
m_InternalUnits = PCB_INTERNAL_UNIT; m_InternalUnits = PCB_INTERNAL_UNIT;
minsize.x = 470; minsize.x = 470;
...@@ -81,7 +61,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -81,7 +61,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 ); SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );
/* Verification des parametres de creation */ /* 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 ); SetSize( 0, 0, minsize.x, minsize.y );
// Creation de la ligne de status // Creation de la ligne de status
...@@ -104,9 +84,11 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -104,9 +84,11 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
if( m_Ident != DISPLAY3D_FRAME ) 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 ), 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, MsgPanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
ColorRefs[LIGHTGRAY].m_Green, ColorRefs[LIGHTGRAY].m_Green,
ColorRefs[LIGHTGRAY].m_Blue ) ); ColorRefs[LIGHTGRAY].m_Blue ) );
...@@ -500,8 +482,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, ...@@ -500,8 +482,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
* Met a jour seulement les variables message et curseur * Met a jour seulement les variables message et curseur
*/ */
{ {
bool redraw = false;
// Change Cursor // Change Cursor
if( DrawPanel ) if( DrawPanel )
{ {
...@@ -514,16 +494,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, ...@@ -514,16 +494,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
if( id < 0 ) if( id < 0 )
return; 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 // Old Tool Inactif ou ID_NO_SELECT_BUTT actif si pas de nouveau Tool
if( m_ID_current_state ) if( m_ID_current_state )
{ {
...@@ -560,11 +530,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, ...@@ -560,11 +530,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE ); m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_ID_current_state = id; 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 ) ...@@ -634,24 +599,6 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
Zoom_Automatique( FALSE ); Zoom_Automatique( FALSE );
break; 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: default:
wxMessageBox( wxT( "WinEDA_DrawFrame::OnZoom switch Error" ) ); wxMessageBox( wxT( "WinEDA_DrawFrame::OnZoom switch Error" ) );
break; break;
...@@ -661,59 +608,6 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type ) ...@@ -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 */ /* default virtual fonctions */
/*****************************/ /*****************************/
...@@ -874,12 +768,14 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event ) ...@@ -874,12 +768,14 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
} }
/***********************************************/ /*
void WinEDA_DrawFrame::Affiche_Status_Box() * Update the status bar information.
/***********************************************/ *
* The base method updates the absolute and relative cooridinates and the
/* Routine d'affichage du zoom et des coord curseur. * zoom information. If you override this virtual method, make sure to call
* this subclassed method.
*/ */
void WinEDA_DrawFrame::Affiche_Status_Box()
{ {
wxString Line; wxString Line;
int dx, dy; int dx, dy;
...@@ -908,22 +804,4 @@ void WinEDA_DrawFrame::Affiche_Status_Box() ...@@ -908,22 +804,4 @@ void WinEDA_DrawFrame::Affiche_Status_Box()
To_User_Unit( g_UnitMetric, dy, m_InternalUnits ) ); To_User_Unit( g_UnitMetric, dy, m_InternalUnits ) );
SetStatusText( Line, 3 ); 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; ...@@ -29,6 +29,7 @@ static bool s_IgnoreNextLeftButtonRelease = false;
// Events used by WinEDA_DrawPanel // Events used by WinEDA_DrawPanel
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow ) BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving ) EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
EVT_MOUSEWHEEL( WinEDA_DrawPanel::OnMouseWheel )
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent ) EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent ) EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent ) EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent )
...@@ -42,6 +43,7 @@ BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow ) ...@@ -42,6 +43,7 @@ BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
WinEDA_DrawPanel::Process_Popup_Zoom ) WinEDA_DrawPanel::Process_Popup_Zoom )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
WinEDA_DrawPanel::OnPopupGridSelect ) WinEDA_DrawPanel::OnPopupGridSelect )
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan )
END_EVENT_TABLE() END_EVENT_TABLE()
/************************************************************************/ /************************************************************************/
...@@ -899,6 +901,47 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event ) ...@@ -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 ) void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
/*******************************************************/ /*******************************************************/
...@@ -932,30 +975,6 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -932,30 +975,6 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
else else
return; 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() if( !event.IsButton() && !event.Moving()
&& !event.Dragging() && !localkey ) && !event.Dragging() && !localkey )
{ {
...@@ -1283,3 +1302,38 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) ...@@ -1283,3 +1302,38 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
event.Skip(); // Allow menu shortcut processing event.Skip(); // Allow menu shortcut processing
#endif #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 ) ...@@ -527,6 +527,10 @@ bool WinEDA_App::SetLanguage( bool first_time )
m_Locale = new wxLocale(); m_Locale = new wxLocale();
m_Locale->Init( m_LanguageId ); m_Locale->Init( m_LanguageId );
dic_path = ReturnKicadDatasPath() + BaseDictionaryPath; dic_path = ReturnKicadDatasPath() + BaseDictionaryPath;
wxLogDebug( wxT( "Adding prefix <" ) + dic_path +
wxT( "> to language lookup path." ) );
m_Locale->AddCatalogLookupPathPrefix( dic_path ); m_Locale->AddCatalogLookupPathPrefix( dic_path );
if( !first_time ) if( !first_time )
...@@ -554,6 +558,9 @@ void WinEDA_App::SetLanguageIdentifier( int menu_id ) ...@@ -554,6 +558,9 @@ void WinEDA_App::SetLanguageIdentifier( int menu_id )
{ {
unsigned int ii; 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++ ) for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{ {
if( menu_id == s_Language_List[ii].m_KI_Lang_Identifier ) if( menu_id == s_Language_List[ii].m_KI_Lang_Identifier )
......
...@@ -49,10 +49,7 @@ set(CVPCB_EXTRA_SRCS ...@@ -49,10 +49,7 @@ set(CVPCB_EXTRA_SRCS
../pcbnew/classpcb.cpp ../pcbnew/classpcb.cpp
../pcbnew/collectors.cpp ../pcbnew/collectors.cpp
../pcbnew/ioascii.cpp ../pcbnew/ioascii.cpp
../pcbnew/tracemod.cpp ../pcbnew/tracemod.cpp)
../share/drawframe.cpp
../share/zoom.cpp)
if(WIN32) if(WIN32)
if(MINGW) if(MINGW)
......
...@@ -100,11 +100,9 @@ set(EESCHEMA_SRCS ...@@ -100,11 +100,9 @@ set(EESCHEMA_SRCS
viewlibs.cpp) viewlibs.cpp)
set(EESCHEMA_EXTRA_SRCS set(EESCHEMA_EXTRA_SRCS
../share/drawframe.cpp
../share/setpage.cpp ../share/setpage.cpp
../share/svg_print.cpp ../share/svg_print.cpp
../share/wxprint.cpp ../share/wxprint.cpp)
../share/zoom.cpp)
if(WIN32) if(WIN32)
if(MINGW) if(MINGW)
......
...@@ -244,26 +244,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi ...@@ -244,26 +244,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
case 0: case 0:
break; 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: case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY ); OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur; curpos = screen->m_Curseur;
...@@ -375,26 +355,6 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -375,26 +355,6 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
case 0: case 0:
break; 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: case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY ); OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur; curpos = screen->m_Curseur;
...@@ -505,26 +465,6 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -505,26 +465,6 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
case 0: case 0:
break; 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: case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY ); OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur; curpos = screen->m_Curseur;
......
...@@ -53,10 +53,8 @@ set(GERBVIEW_EXTRA_SRCS ...@@ -53,10 +53,8 @@ set(GERBVIEW_EXTRA_SRCS
../pcbnew/sel_layer.cpp ../pcbnew/sel_layer.cpp
../pcbnew/undelete.cpp ../pcbnew/undelete.cpp
../share/drawframe.cpp
../share/setpage.cpp ../share/setpage.cpp
../share/wxprint.cpp ../share/wxprint.cpp)
../share/zoom.cpp)
if(WIN32) if(WIN32)
if(MINGW) if(MINGW)
......
...@@ -71,26 +71,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -71,26 +71,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed ) 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: case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY ); OnZoom( ID_ZOOM_IN_KEY );
curpos = GetScreen()->m_Curseur; curpos = GetScreen()->m_Curseur;
......
...@@ -94,10 +94,13 @@ public: ...@@ -94,10 +94,13 @@ public:
void OnActivate( wxActivateEvent& event ); void OnActivate( wxActivateEvent& event );
/* Mouse and keys events */ /* Mouse and keys events */
void OnMouseWheel( wxMouseEvent& event );
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
void OnMouseLeaving( wxMouseEvent& event ); void OnMouseLeaving( wxMouseEvent& event );
void OnKeyEvent( wxKeyEvent& event ); void OnKeyEvent( wxKeyEvent& event );
void OnPan( wxCommandEvent& event );
/*************************/ /*************************/
void EraseScreen( wxDC* DC ); void EraseScreen( wxDC* DC );
......
...@@ -380,16 +380,18 @@ enum main_id { ...@@ -380,16 +380,18 @@ enum main_id {
ID_ZOOM_REDRAW_KEY, ID_ZOOM_REDRAW_KEY,
ID_ZOOM_CENTER_KEY, ID_ZOOM_CENTER_KEY,
ID_ZOOM_AUTO, ID_ZOOM_AUTO,
ID_ZOOM_PANNING_UP,
ID_ZOOM_PANNING_DOWN,
ID_ZOOM_PANNING_LEFT,
ID_ZOOM_PANNING_RIGHT,
ID_ZOOM_UNUSED0, ID_ZOOM_UNUSED0,
ID_ZOOM_UNUSED1, ID_ZOOM_UNUSED1,
ID_ZOOM_UNUSED2, ID_ZOOM_UNUSED2,
ID_ZOOM_UNUSED3, ID_ZOOM_UNUSED3,
ID_ZOOM_ENDLIST, 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_ANNOTATE, // Gestion fonctions : id consecutifs
ID_GET_ERC, ID_GET_ERC,
ID_GET_NETLIST, ID_GET_NETLIST,
......
...@@ -94,6 +94,9 @@ public: ...@@ -94,6 +94,9 @@ public:
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0; virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ReCreateMenuBar(); 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(); } PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) WinEDA_DrawFrame::GetBaseScreen(); }
......
...@@ -248,7 +248,8 @@ public: ...@@ -248,7 +248,8 @@ public:
virtual void ReCreateVToolbar() = 0; virtual void ReCreateVToolbar() = 0;
virtual void ReCreateMenuBar(); virtual void ReCreateMenuBar();
virtual void ReCreateAuxiliaryToolbar(); 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 OnSelectGrid( wxCommandEvent& event );
virtual void OnSelectZoom( wxCommandEvent& event ); virtual void OnSelectZoom( wxCommandEvent& event );
...@@ -260,7 +261,6 @@ public: ...@@ -260,7 +261,6 @@ public:
// void OnChar(wxKeyEvent& event); // void OnChar(wxKeyEvent& event);
void SetToolbarBgColor( int color_num ); void SetToolbarBgColor( int color_num );
void OnZoom( int zoom_type ); void OnZoom( int zoom_type );
void OnPanning( int direction );
void OnGrid( int grid_type ); void OnGrid( int grid_type );
void Recadre_Trace( bool ToMouse ); void Recadre_Trace( bool ToMouse );
void PutOnGrid( wxPoint* coord ); /* set the coordiante "coord" to the nearest grid coordinate */ void PutOnGrid( wxPoint* coord ); /* set the coordiante "coord" to the nearest grid coordinate */
...@@ -299,7 +299,7 @@ public: ...@@ -299,7 +299,7 @@ public:
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ToolOnRightClick( wxCommandEvent& event ); virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars(); void AdjustScrollBars();
void Affiche_Status_Box(); /* Affichage des coord curseur, zoom .. */ virtual void Affiche_Status_Box(); /* Affichage des coord curseur, zoom .. */
void DisplayUnitsMsg(); void DisplayUnitsMsg();
/* Handlers for block commands */ /* Handlers for block commands */
......
...@@ -152,10 +152,8 @@ set(PCBNEW_SRCS ...@@ -152,10 +152,8 @@ set(PCBNEW_SRCS
) )
set(PCBNEW_EXTRA_SRCS set(PCBNEW_EXTRA_SRCS
../share/drawframe.cpp
../share/setpage.cpp ../share/setpage.cpp
../share/wxprint.cpp ../share/wxprint.cpp)
../share/zoom.cpp)
if(WIN32) if(WIN32)
if(MINGW) if(MINGW)
......
...@@ -338,3 +338,60 @@ GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide() ...@@ -338,3 +338,60 @@ GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
return guide; 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 ) ...@@ -530,26 +530,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed ) 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: case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY ); OnZoom( ID_ZOOM_IN_KEY );
oldpos = curpos = GetScreen()->m_Curseur; 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