Loading 3d-viewer/3d_frame.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -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 ) Loading Loading @@ -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; Loading @@ -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: Loading 3d-viewer/3d_toolbar.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -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(); Loading CHANGELOG.txt +15 −0 Original line number Diff line number Diff line Loading @@ -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 Loading common/drawframe.cpp +9 −75 Original line number Diff line number Diff line Loading @@ -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 */ /*******************************************************/ Loading Loading @@ -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 */ /*****************************/ Loading common/drawpanel.cpp +23 −12 Original line number Diff line number Diff line Loading @@ -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 ) Loading @@ -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; Loading Loading @@ -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() ) if( ( size.x < event.GetX() ) || ( size.y < event.GetY() ) || ( event.GetX() <= 0) || ( event.GetY() <= 0 ) ) m_Parent->OnZoom( ID_POPUP_ZOOM_CENTER ); { wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER ); cmd.SetEventObject( this ); GetEventHandler()->ProcessEvent( cmd ); } } Loading @@ -918,7 +919,14 @@ 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; Loading @@ -927,7 +935,7 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event ) 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() ) Loading Loading @@ -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 ); } Loading Loading
3d-viewer/3d_frame.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -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 ) Loading Loading @@ -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; Loading @@ -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: Loading
3d-viewer/3d_toolbar.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -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(); Loading
CHANGELOG.txt +15 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
common/drawframe.cpp +9 −75 Original line number Diff line number Diff line Loading @@ -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 */ /*******************************************************/ Loading Loading @@ -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 */ /*****************************/ Loading
common/drawpanel.cpp +23 −12 Original line number Diff line number Diff line Loading @@ -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 ) Loading @@ -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; Loading Loading @@ -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() ) if( ( size.x < event.GetX() ) || ( size.y < event.GetY() ) || ( event.GetX() <= 0) || ( event.GetY() <= 0 ) ) m_Parent->OnZoom( ID_POPUP_ZOOM_CENTER ); { wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER ); cmd.SetEventObject( this ); GetEventHandler()->ProcessEvent( cmd ); } } Loading @@ -918,7 +919,14 @@ 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; Loading @@ -927,7 +935,7 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event ) 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() ) Loading Loading @@ -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 ); } Loading