Commit 4a489895 authored by stambaughw's avatar stambaughw

More zoom clean ups and code cleaning.

parent 63724083
......@@ -27,8 +27,7 @@
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA3D_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA3D_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_END_COMMAND_3D,
WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_MENU( wxID_EXIT, WinEDA3D_DrawFrame::Exit3DFrame )
......@@ -172,7 +171,7 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
switch( event.GetId() )
{
case ID_ZOOM_PAGE_BUTT:
case ID_ZOOM_PAGE:
for( ii = 0; ii < 4; ii++ )
g_Parm_3D_Visu.m_Rot[ii] = 0.0;
......@@ -181,17 +180,17 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 );
break;
case ID_ZOOM_IN_BUTT:
case ID_ZOOM_IN:
g_Parm_3D_Visu.m_Zoom /= 1.2;
if( g_Parm_3D_Visu.m_Zoom <= 0.01 )
g_Parm_3D_Visu.m_Zoom = 0.01;
break;
case ID_ZOOM_OUT_BUTT:
case ID_ZOOM_OUT:
g_Parm_3D_Visu.m_Zoom *= 1.2;
break;
case ID_ZOOM_REDRAW_BUTT:
case ID_ZOOM_REDRAW:
break;
default:
......
......@@ -39,16 +39,16 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
#endif
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ),
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, BITMAP( zoom_in_xpm ),
_( "Zoom in" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ),
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, BITMAP( zoom_out_xpm ),
_( "Zoom out" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( zoom_redraw_xpm ),
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, BITMAP( zoom_redraw_xpm ),
_( "Redraw view" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP( zoom_auto_xpm ),
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, BITMAP( zoom_auto_xpm ),
_( "Zoom auto" ) );
m_HToolBar->AddSeparator();
......
......@@ -5,6 +5,21 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2009-Jan-07 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++all
* Don't pan or zoom on mouse wheel events when the cursor is not in the
drawing area.
* Reduce all zoom code to a single zoom command handler.
* Eliminate redundant zoom command identifiers.
* Move pop up zoom command handler from DrawPanel to DrawFrame.
* Change hot key zoom handlers to use command events.
* Added DrawFrame event table to replace COMMON_EVENTS_DRAWFRAME macro.
* Added locale path relative to binary path for development purposes.
* Minor code clean ups and duplicate header removal in files that were
updated.
2009-Jan-04 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++all
......
......@@ -15,6 +15,15 @@
#include <wx/fontdlg.h>
BEGIN_EVENT_TABLE( WinEDA_DrawFrame, WinEDA_BasicFrame )
EVT_MOUSEWHEEL( WinEDA_DrawFrame::OnMouseEvent )
EVT_MENU_OPEN( WinEDA_DrawFrame::OnMenuOpen )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
WinEDA_DrawFrame::OnZoom )
END_EVENT_TABLE()
/*******************************************************/
/* Constructeur de WinEDA_DrawFrame: la fenetre generale */
/*******************************************************/
......@@ -533,81 +542,6 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
}
/********************************************/
void WinEDA_DrawFrame::OnZoom( int zoom_type )
/********************************************/
/* 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;
BASE_SCREEN* screen = GetBaseScreen();
bool move_mouse_cursor = FALSE;
int x, y;
wxPoint old_pos;
DrawPanel->GetViewStart( &x, &y );
old_pos = GetBaseScreen()->m_Curseur;
switch( zoom_type )
{
case ID_POPUP_ZOOM_IN:
case ID_ZOOM_IN_KEY:
move_mouse_cursor = TRUE;
// fall thru
case ID_ZOOM_IN_BUTT:
if( zoom_type == ID_ZOOM_IN_BUTT )
GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
screen->SetPreviousZoom();
Recadre_Trace( move_mouse_cursor );
break;
case ID_POPUP_ZOOM_OUT:
case ID_ZOOM_OUT_KEY:
move_mouse_cursor = TRUE;
// fall thru
case ID_ZOOM_OUT_BUTT:
if( zoom_type == ID_ZOOM_OUT_BUTT )
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
screen->SetNextZoom();
Recadre_Trace( move_mouse_cursor );
break;
case ID_POPUP_ZOOM_REDRAW:
case ID_ZOOM_REDRAW_KEY:
case ID_ZOOM_REDRAW_BUTT:
DrawPanel->Refresh();
break;
case ID_POPUP_ZOOM_CENTER:
case ID_ZOOM_CENTER_KEY:
Recadre_Trace( TRUE );
break;
case ID_ZOOM_PAGE_BUTT:
case ID_ZOOM_AUTO:
case ID_POPUP_ZOOM_AUTO:
Zoom_Automatique( FALSE );
break;
default:
wxMessageBox( wxT( "WinEDA_DrawFrame::OnZoom switch Error" ) );
break;
}
Affiche_Status_Box();
}
/*****************************/
/* default virtual fonctions */
/*****************************/
......
......@@ -33,8 +33,6 @@ BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
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 )
......@@ -50,7 +48,6 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE )
{
m_Parent = parent;
m_Ident = m_Parent->m_Ident;
m_Scroll_unit = 1;
m_ScrollButt_unit = 40;
......@@ -902,10 +899,14 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
// Auto pan if mouse is leave working aera:
wxSize size = GetClientSize();
if( ( size.x < event.GetX() )
|| ( size.y < event.GetY() )
|| ( event.GetX() <= 0) || ( event.GetY() <= 0 ) )
m_Parent->OnZoom( ID_POPUP_ZOOM_CENTER );
if( ( size.x < event.GetX() ) || ( size.y < event.GetY() )
|| ( event.GetX() <= 0) || ( event.GetY() <= 0 ) )
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd );
}
}
......@@ -918,16 +919,23 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
*/
void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
{
if( event.GetWheelRotation() == 0 )
wxRect rect = GetRect();
wxLogDebug( wxT( "OnMouseWheel() cursor position: (%d, %d)." ),
event.m_x, event.m_y );
/* Ignore scroll events if the cursor is outside the drawing area. */
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|| !rect.Contains( event.GetPosition() ) )
{
event.Skip();
return;
}
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
// This is a zoom in ou out command
// This is a zoom in or out command
if( event.GetWheelRotation() > 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
......@@ -1073,8 +1081,11 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
{
// The middle button has been relached, with no block command:
// We use it for a zoom center command
g_KeyPressed = localkey = EDA_ZOOM_CENTER_FROM_MOUSE;
// We use it for a zoom center at cursor position command
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED,
ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd );
}
......
This diff is collapsed.
......@@ -118,98 +118,128 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect )
/*****************************************************************/
void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event )
/*****************************************************************/
/* Handle only the Popup command zoom and grid level
*/
void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
{
int id = event.GetId();
if( DrawPanel == NULL )
{
wxLogDebug( wxT( "No DrawPanel object definedin " \
"WinEDA_DrawFrame::OnZoom()." ) );
return;
}
bool zoom_at_cursor = false;
int id = event.GetId();
BASE_SCREEN* screen = GetBaseScreen();
switch( id )
{
case ID_POPUP_ZOOM_IN:
zoom_at_cursor = true;
// fall thru
case ID_ZOOM_IN:
if( id == ID_ZOOM_IN )
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
screen->SetPreviousZoom();
Recadre_Trace( zoom_at_cursor );
break;
case ID_POPUP_ZOOM_OUT:
zoom_at_cursor = true;
// fall thru
case ID_ZOOM_OUT:
if( id == ID_ZOOM_OUT )
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
screen->SetNextZoom();
Recadre_Trace( zoom_at_cursor );
break;
case ID_ZOOM_REDRAW:
DrawPanel->Refresh();
break;
case ID_POPUP_ZOOM_CENTER:
case ID_POPUP_ZOOM_AUTO:
case ID_POPUP_ZOOM_REDRAW:
m_Parent->OnZoom( id );
Recadre_Trace( true );
break;
case ID_ZOOM_PAGE:
Zoom_Automatique( false );
break;
case ID_POPUP_ZOOM_SELECT:
break;
case ID_POPUP_CANCEL:
MouseToCursorSchema();
DrawPanel->MouseToCursorSchema();
break;
case ID_POPUP_ZOOM_LEVEL_1:
GetScreen()->SetZoom( 1 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 1 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_2:
GetScreen()->SetZoom( 2 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 2 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_4:
GetScreen()->SetZoom( 4 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 4 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_8:
GetScreen()->SetZoom( 8 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 8 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_16:
GetScreen()->SetZoom( 16 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 16 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_32:
GetScreen()->SetZoom( 32 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 32 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_64:
GetScreen()->SetZoom( 64 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 64 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_128:
GetScreen()->SetZoom( 128 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 128 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_256:
GetScreen()->SetZoom( 256 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 256 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_512:
GetScreen()->SetZoom( 512 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 512 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_1024:
GetScreen()->SetZoom( 1024 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 1024 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_2048:
GetScreen()->SetZoom( 2048 );
m_Parent->Recadre_Trace( TRUE );
screen->SetZoom( 2048 );
Recadre_Trace( true );
break;
default:
DisplayError( this,
wxT( "WinEDA_DrawPanel::Process_Popup_Zoom() ID error" ) );
break;
wxLogDebug( wxT( "WinEDA_DrawFram::OnZoom() unhandled ID %d" ), id );
return;
}
m_Parent->Affiche_Status_Box();
Affiche_Status_Box();
}
void WinEDA_DrawPanel::OnPopupGridSelect( wxCommandEvent& event )
......@@ -239,15 +269,14 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
zoom_center_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_IN, _( "Zoom in" ), zoom_in_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_OUT, _( "Zoom out" ), zoom_out_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_AUTO, _( "Zoom auto" ),
zoom_auto_xpm );
ADD_MENUITEM( MasterMenu, ID_ZOOM_PAGE, _( "Zoom auto" ), zoom_auto_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_REDRAW, _( "Redraw view" ),
ADD_MENUITEM( MasterMenu, ID_ZOOM_REDRAW, _( "Redraw view" ),
zoom_redraw_xpm );
/* Create the basic zoom list: */
......@@ -299,29 +328,3 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
MasterMenu->AppendSeparator();
ADD_MENUITEM( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), cancel_xpm );
}
/**********************************************************/
void WinEDA_DrawFrame::Process_Zoom( wxCommandEvent& event )
/**********************************************************/
/* Handle the Zoom commands from the zoom tools in the main toolbar.
* Calls the active window Zoom function
*/
{
int id = event.GetId();
switch( id )
{
case ID_ZOOM_IN_BUTT:
case ID_ZOOM_OUT_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;
}
}
......@@ -16,12 +16,10 @@
/* Construction de la table des evenements pour WinEDA_DrawFrame */
/*****************************************************************/
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_DrawFrame )
EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )
EVT_SIZE( WinEDA_DrawFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DisplayFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DisplayFrame::OnZoom )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame )
END_EVENT_TABLE()
......@@ -119,19 +117,19 @@ void WinEDA_DisplayFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ),
_( "zoom + (F1)" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ),
_( "zoom - (F2)" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ),
_( "redraw (F3)" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "1:1 zoom" ) );
......@@ -183,6 +181,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
int flagcurseur = 0;
int zoom = GetScreen()->GetZoom();
wxPoint curpos, oldpos;
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur;
......@@ -199,24 +199,28 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed )
{
case WXK_F1:
OnZoom( ID_ZOOM_IN_KEY );
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
curpos = GetScreen()->m_Curseur;
break;
case WXK_F2:
OnZoom( ID_ZOOM_OUT_KEY );
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
curpos = GetScreen()->m_Curseur;
break;
case WXK_F3:
OnZoom( ID_ZOOM_REDRAW_KEY );
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
break;
case WXK_F4:
OnZoom( ID_ZOOM_CENTER_KEY );
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
curpos = GetScreen()->m_Curseur;
break;
......
......@@ -57,8 +57,7 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop!
screen->AddToDrawList( this );
g_ItemToRepeat = this;
if( frame->m_Ident == SCHEMATIC_FRAME )
frame->SaveCopyInUndoList( this, IS_NEW );
frame->SaveCopyInUndoList( this, IS_NEW );
}
m_Flags = 0;
......
......@@ -244,21 +244,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
case 0:
break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = screen->m_Curseur;
break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP:
MousePositionInPixels.y -= delta.y;
......@@ -355,21 +340,6 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
case 0:
break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = screen->m_Curseur;
break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP:
MousePositionInPixels.y -= delta.y;
......@@ -465,21 +435,6 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
case 0:
break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = screen->m_Curseur;
break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP:
MousePositionInPixels.y -= delta.y;
......
......@@ -4,8 +4,6 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
#include "libcmp.h"
......@@ -145,6 +143,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive
*/
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
bool ItemInEdit = GetScreen()->GetCurItem()
&& GetScreen()->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
......@@ -172,7 +173,6 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
default:
case HK_NOT_FOUND:
return;
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
......@@ -183,19 +183,23 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_ZOOM_IN:
OnZoom( ID_ZOOM_IN_KEY );
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
OnZoom( ID_ZOOM_OUT_KEY );
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
OnZoom( ID_ZOOM_REDRAW_KEY );
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
OnZoom( ID_ZOOM_CENTER_KEY );
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_UNDO:
......@@ -413,6 +417,9 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive
*/
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
bool ItemInEdit = GetScreen()->GetCurItem()
&& GetScreen()->GetCurItem()->m_Flags;
bool RefreshToolBar = FALSE; // We must refresh tool bar when the undo/redo tool state is modified
......@@ -451,19 +458,23 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_ZOOM_IN:
OnZoom( ID_ZOOM_IN_KEY );
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
OnZoom( ID_ZOOM_OUT_KEY );
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
OnZoom( ID_ZOOM_REDRAW_KEY );
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
OnZoom( ID_ZOOM_CENTER_KEY );
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_UNDO:
......
......@@ -20,13 +20,11 @@
/*****************************/
/* class WinEDA_LibeditFrame */
/*****************************/
BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME
BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame )
EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_LibeditFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_LibeditFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_LibeditFrame::OnZoom )
// Tools et boutons de Libedit:
......
......@@ -168,7 +168,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
wxMenu* viewMenu = new wxMenu;
msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_IN);
item = new wxMenuItem( viewMenu, ID_ZOOM_IN_BUTT,
item = new wxMenuItem( viewMenu, ID_ZOOM_IN,
msg, _( "Zoom in" ),
wxITEM_NORMAL );
item->SetBitmap( zoom_in_xpm );
......@@ -176,13 +176,13 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_OUT );
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT_BUTT,
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT,
msg, _( "Zoom out" ),
wxITEM_NORMAL );
item->SetBitmap( zoom_out_xpm );
viewMenu->Append( item );
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE_BUTT,
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE,
_( "Zoom auto" ), _( "Zoom auto" ),
wxITEM_NORMAL );
item->SetBitmap( zoom_auto_xpm );
......@@ -192,7 +192,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_REDRAW );
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW_BUTT,
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW,
msg, _( "Zoom auto" ),
wxITEM_NORMAL );
item->SetBitmap( zoom_redraw_xpm );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,6 @@
/****************************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
......@@ -14,8 +13,6 @@
#include "protos.h"
#define BITMAP wxBitmap
#include "bitmaps.h"
#include "id.h"
......@@ -24,126 +21,138 @@
void WinEDA_ViewlibFrame::ReCreateHToolbar()
/****************************************************/
{
int ii;
EDA_LibComponentStruct * RootLibEntry = NULL, * CurrentLibEntry = NULL;
bool asdeMorgan = FALSE, state;
if ( (g_CurrentViewLibraryName != wxEmptyString) && (g_CurrentViewComponentName != wxEmptyString) )
{
RootLibEntry = FindLibPart(g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(), FIND_ROOT);
if ( RootLibEntry && LookForConvertPart(RootLibEntry) > 1 )
asdeMorgan = TRUE;
CurrentLibEntry = FindLibPart(g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(), FIND_ALIAS);
}
if ( m_HToolBar == NULL )
{
m_HToolBar = new WinEDA_Toolbar(TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE);
SetToolBar(m_HToolBar);
// Set up toolbar
m_HToolBar->AddTool(ID_LIBVIEW_SELECT_LIB, wxEmptyString,
BITMAP(library_xpm),
_("Select library to browse"));
m_HToolBar->AddTool(ID_LIBVIEW_SELECT_PART, wxEmptyString,
BITMAP(add_component_xpm),
_("Select part to browse"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_LIBVIEW_PREVIOUS, wxEmptyString,
BITMAP(lib_previous_xpm),
_("Display previous part"));
m_HToolBar->AddTool(ID_LIBVIEW_NEXT, wxEmptyString,
BITMAP(lib_next_xpm),
_("Display next part"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_ZOOM_IN_BUTT, wxEmptyString,
BITMAP(zoom_in_xpm),
_("Zoom in"));
m_HToolBar->AddTool(ID_ZOOM_OUT_BUTT, wxEmptyString,
BITMAP(zoom_out_xpm),
_("Zoom out"));
m_HToolBar->AddTool(ID_ZOOM_REDRAW_BUTT, wxEmptyString,
BITMAP(zoom_redraw_xpm),
_("Redraw view"));
m_HToolBar->AddTool(ID_ZOOM_PAGE_BUTT, wxEmptyString,
BITMAP(zoom_auto_xpm),
_("Best zoom"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
BITMAP(morgan1_xpm),
_("Show as \"De Morgan\" normal part"), wxITEM_CHECK);
m_HToolBar->AddTool(ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
BITMAP(morgan2_xpm),
_("Show as \"De Morgan\" convert part"), wxITEM_CHECK);
m_HToolBar->AddSeparator();
SelpartBox = new WinEDAChoiceBox(m_HToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxDefaultPosition, wxSize(150,-1));
m_HToolBar->AddControl(SelpartBox);
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_LIBVIEW_VIEWDOC, wxEmptyString, BITMAP(datasheet_xpm),
_("View component documents") );
m_HToolBar->EnableTool(ID_LIBVIEW_VIEWDOC, FALSE);
if ( m_Semaphore ) // The lib browser is called from a "load component" command
{
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, wxEmptyString,
BITMAP(export_xpm),
_("Insert component in schematic") );
}
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
m_HToolBar->Realize();
}
// Must be AFTER Realize():
m_HToolBar->ToggleTool(ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT,
(g_ViewConvert <= 1) ? TRUE : FALSE);
m_HToolBar->ToggleTool(ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
(g_ViewConvert >= 2) ? TRUE : FALSE );
m_HToolBar->EnableTool(ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, asdeMorgan);
m_HToolBar->EnableTool(ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan);
int jj = 1;
if( RootLibEntry ) jj = MAX(RootLibEntry->m_UnitCount, 1);
SelpartBox->Clear();
for ( ii = 0; ii < jj ; ii ++ )
{
wxString msg;
msg.Printf( _("Part %c"), 'A' + ii);
SelpartBox->Append(msg);
}
SelpartBox->SetSelection(0);
state = FALSE;
if ( CurrentLibEntry && jj > 1 ) state = TRUE;
SelpartBox->Enable(state);
state = FALSE;
if( CurrentLibEntry && (CurrentLibEntry->m_DocFile != wxEmptyString) )
state = TRUE;
m_HToolBar->EnableTool(ID_LIBVIEW_VIEWDOC, state);
int ii;
EDA_LibComponentStruct* RootLibEntry = NULL, * CurrentLibEntry = NULL;
bool asdeMorgan = FALSE, state;
if( (g_CurrentViewLibraryName != wxEmptyString)
&& (g_CurrentViewComponentName != wxEmptyString) )
{
RootLibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(),
FIND_ROOT );
if( RootLibEntry && LookForConvertPart( RootLibEntry ) > 1 )
asdeMorgan = TRUE;
CurrentLibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(),
FIND_ALIAS );
}
if( m_HToolBar == NULL )
{
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN,
this,
ID_H_TOOLBAR,
TRUE );
SetToolBar( m_HToolBar );
// Set up toolbar
m_HToolBar->AddTool( ID_LIBVIEW_SELECT_LIB, wxEmptyString,
wxBitmap( library_xpm ),
_( "Select library to browse" ) );
m_HToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
wxBitmap( add_component_xpm ),
_( "Select part to browse" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString,
wxBitmap( lib_previous_xpm ),
_( "Display previous part" ) );
m_HToolBar->AddTool( ID_LIBVIEW_NEXT, wxEmptyString,
wxBitmap( lib_next_xpm ),
_( "Display next part" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ),
_( "Zoom in" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ),
_( "Zoom out" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ),
_( "Redraw view" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "Best zoom" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
wxBitmap( morgan1_xpm ),
_( "Show as \"De Morgan\" normal part" ),
wxITEM_CHECK );
m_HToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
wxBitmap( morgan2_xpm ),
_( "Show as \"De Morgan\" convert part" ),
wxITEM_CHECK );
m_HToolBar->AddSeparator();
SelpartBox =
new WinEDAChoiceBox( m_HToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxDefaultPosition, wxSize( 150, -1 ) );
m_HToolBar->AddControl( SelpartBox );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString,
wxBitmap( datasheet_xpm ),
_( "View component documents" ) );
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, FALSE );
if( m_Semaphore ) // The lib browser is called from a "load component" command
{
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
wxEmptyString,
wxBitmap( export_xpm ),
_( "Insert component in schematic" ) );
}
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
m_HToolBar->Realize();
}
// Must be AFTER Realize():
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT,
(g_ViewConvert <= 1) ? TRUE : FALSE );
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
(g_ViewConvert >= 2) ? TRUE : FALSE );
m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, asdeMorgan );
m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan );
int jj = 1;
if( RootLibEntry )
jj = MAX( RootLibEntry->m_UnitCount, 1 );
SelpartBox->Clear();
for( ii = 0; ii < jj; ii++ )
{
wxString msg;
msg.Printf( _( "Part %c" ), 'A' + ii );
SelpartBox->Append( msg );
}
SelpartBox->SetSelection( 0 );
state = FALSE;
if( CurrentLibEntry && jj > 1 )
state = TRUE;
SelpartBox->Enable( state );
state = FALSE;
if( CurrentLibEntry && (CurrentLibEntry->m_DocFile != wxEmptyString) )
state = TRUE;
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, state );
}
/****************************************************/
void WinEDA_ViewlibFrame::ReCreateVToolbar()
/****************************************************/
{
}
......@@ -18,25 +18,24 @@
/*****************************/
/* class WinEDA_ViewlibFrame */
/*****************************/
BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ViewlibFrame::OnSize )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ViewlibFrame::OnSize )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DrawFrame::OnZoom )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList )
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList )
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList )
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList )
END_EVENT_TABLE()
......@@ -153,8 +152,8 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
if( DrawPanel )
{
DrawPanel->SetSize( m_LibListSize.x + m_CmpListSize.x, 0,
size.x - Vtoolbar_size.x - m_LibListSize.x - m_CmpListSize.x,
size.y );
size.x - Vtoolbar_size.x - m_LibListSize.x - m_CmpListSize.x,
size.y );
}
if( m_LibList )
......@@ -195,7 +194,7 @@ int WinEDA_ViewlibFrame::BestZoom()
size = DrawPanel->GetClientSize();
size -= wxSize( 100, 100 ); // reserve a 100 mils margin
ii = (double) itemsize.x / size.x;
ii = itemsize.x / size.x;
jj = itemsize.y / size.y;
bestzoom = MAX( ii, jj ) + 1;
......
......@@ -71,21 +71,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed )
{
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = GetScreen()->m_Curseur;
break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP:
Mouse.y -= delta.y;
......
......@@ -21,13 +21,11 @@
/* class WinEDA_GerberFrame for GerbView*/
/****************************************/
BEGIN_EVENT_TABLE( WinEDA_GerberFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME
BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_GerberFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_GerberFrame::OnZoom )
EVT_TOOL( ID_LOAD_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_APPEND_FILE, WinEDA_GerberFrame::Files_io )
......
......@@ -84,6 +84,9 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
*/
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if( (hotkey & GR_KB_CTRL) != 0 )
hotkey += 'A' - 1;
......@@ -99,34 +102,35 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
default:
case HK_NOT_FOUND:
return;
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_Gerbview_Hokeys_Descr );
break;
case HK_ZOOM_IN:
OnZoom( ID_ZOOM_IN_KEY );
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
OnZoom( ID_ZOOM_OUT_KEY );
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
OnZoom( ID_ZOOM_REDRAW_KEY );
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
OnZoom( ID_ZOOM_CENTER_KEY );
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break;
case HK_SWITCH_UNITS:
g_UnitMetric = (g_UnitMetric == INCHES ) ? MILLIMETRE : INCHES;
break;
......
This diff is collapsed.
......@@ -40,7 +40,6 @@ WX_DECLARE_OBJARRAY( GRID_TYPE, GridArray );
class WinEDA_DrawPanel : public wxScrolledWindow
{
public:
int m_Ident;
WinEDA_DrawFrame* m_Parent;
EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the visible area in internal units)
wxPoint m_CursorStartPos; // utile dans controles du mouvement curseur
......@@ -114,7 +113,6 @@ public:
void AddMenuZoom( wxMenu* MasterMenu );
bool OnRightClick( wxMouseEvent& event );
void Process_Popup_Zoom( wxCommandEvent& event );
void OnPopupGridSelect( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
......
......@@ -223,8 +223,6 @@ enum main_id {
ID_POPUP_ZOOM_OUT,
ID_POPUP_ZOOM_SELECT,
ID_POPUP_ZOOM_CENTER,
ID_POPUP_ZOOM_AUTO,
ID_POPUP_ZOOM_REDRAW,
ID_POPUP_ZOOM_LEVEL_1,
ID_POPUP_ZOOM_LEVEL_2,
ID_POPUP_ZOOM_LEVEL_4,
......@@ -370,21 +368,10 @@ enum main_id {
ID_TO_LIBRARY,
ID_TO_LIBVIEW,
ID_ZOOM_IN_BUTT, // Gestion zoom: id consecutifs
ID_ZOOM_OUT_BUTT,
ID_ZOOM_REDRAW_BUTT,
ID_ZOOM_PAGE_BUTT,
ID_ZOOM_WINDOW_BUTT,
ID_ZOOM_IN_KEY,
ID_ZOOM_OUT_KEY,
ID_ZOOM_REDRAW_KEY,
ID_ZOOM_CENTER_KEY,
ID_ZOOM_AUTO,
ID_ZOOM_UNUSED0,
ID_ZOOM_UNUSED1,
ID_ZOOM_UNUSED2,
ID_ZOOM_UNUSED3,
ID_ZOOM_ENDLIST,
ID_ZOOM_IN, // Gestion zoom: id consecutifs
ID_ZOOM_OUT,
ID_ZOOM_REDRAW,
ID_ZOOM_PAGE,
/* Panning command event IDs. */
ID_PAN_UP,
......
......@@ -174,8 +174,6 @@ public:
class WinEDA_DrawFrame : public WinEDA_BasicFrame
{
public:
WinEDA_DrawPanel* DrawPanel; // Draw area
WinEDA_MsgPanel* MsgPanel; // Zone d'affichage de caracteristiques
......@@ -260,7 +258,7 @@ public:
// void OnChar(wxKeyEvent& event);
void SetToolbarBgColor( int color_num );
void OnZoom( int zoom_type );
virtual void OnZoom( wxCommandEvent& event );
void OnGrid( int grid_type );
void Recadre_Trace( bool ToMouse );
void PutOnGrid( wxPoint* coord ); /* set the coordiante "coord" to the nearest grid coordinate */
......@@ -314,13 +312,9 @@ public:
/* interprocess communication */
void OnSockRequest( wxSocketEvent& evt );
void OnSockRequestServer( wxSocketEvent& evt );
};
#define COMMON_EVENTS_DRAWFRAME \
EVT_MOUSEWHEEL( WinEDA_DrawFrame::OnMouseEvent ) \
EVT_MENU_OPEN( WinEDA_DrawFrame::OnMenuOpen ) \
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
DECLARE_EVENT_TABLE();
};
/****************************************************/
......
......@@ -23,7 +23,6 @@
/*******************************/
BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame )
COMMON_EVENTS_DRAWFRAME
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection )
......
......@@ -891,7 +891,7 @@ EDA_Rect MODULE::GetBoundingBox()
/*******************************************************/
void MODULE::Display_Infos( WinEDA_DrawFrame* frame )
void MODULE::Display_Infos( WinEDA_BasePcbFrame* frame )
/*******************************************************/
{
int nbpad;
......
......@@ -195,7 +195,7 @@ public:
* about this object into the frame's message panel.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
void Display_Infos( WinEDA_BasePcbFrame* frame );
/**
......
......@@ -530,21 +530,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed )
{
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
oldpos = curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
oldpos = curpos = GetScreen()->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
oldpos = curpos = GetScreen()->m_Curseur;
break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP:
Mouse.y -= delta.y;
......
......@@ -4,8 +4,6 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
#include "id.h"
......@@ -172,6 +170,9 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
*/
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
bool PopupOn = (GetCurItem() && GetCurItem()->m_Flags);
bool ItemFree = (GetCurItem()==0 || GetCurItem()->m_Flags==0);
......@@ -269,19 +270,23 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_ZOOM_IN:
OnZoom( ID_ZOOM_IN_KEY );
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
OnZoom( ID_ZOOM_OUT_KEY );
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
OnZoom( ID_ZOOM_REDRAW_KEY );
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
OnZoom( ID_ZOOM_CENTER_KEY );
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
......@@ -534,6 +539,9 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
if( hotkey == 0 )
return;
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a';
......@@ -564,19 +572,23 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_ZOOM_IN:
OnZoom( ID_ZOOM_IN_KEY );
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
OnZoom( ID_ZOOM_OUT_KEY );
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
OnZoom( ID_ZOOM_REDRAW_KEY );
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
OnZoom( ID_ZOOM_CENTER_KEY );
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
}
}
......
......@@ -18,8 +18,7 @@
/********************************/
/* class WinEDA_ModuleEditFrame */
/********************************/
BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME
BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection )
......@@ -29,8 +28,7 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, wxFrame )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_ModuleEditFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ModuleEditFrame::OnZoom )
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB,
WinEDA_ModuleEditFrame::Process_Special_Functions )
......
......@@ -19,7 +19,6 @@
/*******************************/
BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
COMMON_EVENTS_DRAWFRAME
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest )
......@@ -29,8 +28,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
EVT_SIZE( WinEDA_PcbFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_PcbFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_PcbFrame::OnZoom )
EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io )
......
......@@ -104,20 +104,20 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Module_Editor_Hokeys_Descr,
HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Module_Editor_Hokeys_Descr,
HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Module_Editor_Hokeys_Descr,
HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) );
......
......@@ -260,20 +260,20 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Board_Editor_Hokeys_Descr,
HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, wxBitmap( zoom_in_xpm ),
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Board_Editor_Hokeys_Descr,
HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Board_Editor_Hokeys_Descr,
HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString,
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) );
......@@ -286,9 +286,9 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
_( "Read netlist" ) );
_( "Read netlist" ) );
m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ),
_( "Pcb Design Rules Check" ) );
_( "Pcb Design Rules Check" ) );
m_HToolBar->AddSeparator();
......@@ -370,14 +370,14 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString,
wxBitmap( show_zone_xpm ), wxNullBitmap,
_( "Show filled areas in zones" ) );
wxBitmap( show_zone_xpm ), wxNullBitmap,
_( "Show filled areas in zones" ) );
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString,
wxBitmap( show_zone_disable_xpm ), wxNullBitmap,
_( "Do not show filled areas in zones" ));
wxBitmap( show_zone_disable_xpm ), wxNullBitmap,
_( "Do not show filled areas in zones" ));
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString,
wxBitmap( show_zone_outline_only_xpm ), wxNullBitmap,
_( "Show outlines of filled areas only in zones" ) );
wxBitmap( show_zone_outline_only_xpm ), wxNullBitmap,
_( "Show outlines of filled areas only in zones" ) );
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
......@@ -573,8 +573,8 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
// Set up toolbar
m_AuxiliaryToolBar->AddSeparator();
m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint( -1, -1 ),
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 20, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_SelTrackWidthBox_Changed = TRUE;
......
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