From 628be5d1c1d0532229f0fb60bb442cd010dd1e48 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Wed, 5 Dec 2007 17:56:57 +0000 Subject: [PATCH] chasing a bug --- change_log.txt | 9 +++++++++ common/base_screen.cpp | 3 +++ include/fctsys.h | 7 +++++++ makefile.gtk | 2 +- pcbnew/basepcbframe.cpp | 3 +++ pcbnew/controle.cpp | 20 +++++++++++++++++++- pcbnew/dialog_drc.cpp | 2 -- share/drawframe.cpp | 5 +++++ share/zoom.cpp | 9 +++++++++ todo.txt | 8 ++++++++ 10 files changed, 64 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index 9597583613..0a42764b24 100644 --- a/change_log.txt +++ b/change_log.txt @@ -4,6 +4,15 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. + +2007-Dec-4 UPDATE Dick Hollenbeck +================================================================================ ++pcbnew + added the D() macro to fctsys.h to ease conditional debug printf()s. + worked on http://sourceforge.net/tracker/index.php?func=detail&aid=1844960&group_id=145591&atid=762476 + but could not resolve it in 1/2 day. + + 2007-Dec-4 UPDATE Dick Hollenbeck ================================================================================ +pcbnew diff --git a/common/base_screen.cpp b/common/base_screen.cpp index 7dcb277c6d..33b26cccdf 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -112,6 +112,9 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos ) { wxPoint curpos; + D(printf("curpos=%d,%d GetZoom=%d, mDrawOrg=%d,%d\n", + curpos.x, curpos.y, GetZoom(), m_DrawOrg.x, m_DrawOrg.y );) + curpos.x = ScreenPos.x * GetZoom(); curpos.y = ScreenPos.y * GetZoom(); diff --git a/include/fctsys.h b/include/fctsys.h index 68c727763e..e5e3926665 100644 --- a/include/fctsys.h +++ b/include/fctsys.h @@ -66,6 +66,13 @@ #define STRING_DIR_SEP wxT( "/" ) #endif +#ifdef DEBUG +#define D(x) x +#else +#define D(x) // nothing +#endif + + #define UNIX_STRING_DIR_SEP wxT( "/" ) #define WIN_STRING_DIR_SEP wxT( "\\" ) diff --git a/makefile.gtk b/makefile.gtk index cbec5064c7..a163c79909 100644 --- a/makefile.gtk +++ b/makefile.gtk @@ -1,6 +1,6 @@ MAKEGTK = $(MAKE) -f makefile.gtk -KICAD_SUBDIRS = common 3d-viewer pcbnew eeschema eeschema/plugins cvpcb kicad gerbview +KICAD_SUBDIRS = common 3d-viewer pcbnew #eeschema eeschema/plugins cvpcb kicad gerbview KICAD_SUBDIRS_BIN = eeschema eeschema/plugins pcbnew cvpcb kicad gerbview KICAD_SUBDIRS_RES = internat modules template library KICAD_SUBDIRS_HELP = help diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 8978a68c64..f0344edd35 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -119,6 +119,9 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos ) DrawPanel->MouseToCursorSchema(); DrawPanel->CursorOn( &dc ); } + + D(printf("CursorGoto end x=%d, y=%d\n", + m_CurrentScreen->m_Curseur.x, m_CurrentScreen->m_Curseur.y );) } diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index 631bd2cba4..e9802aebd7 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -223,6 +223,9 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode ) void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) /*****************************************************************/ { + D(printf("GeneralControle x=%d, y=%d\n", + m_CurrentScreen->m_Curseur.x, m_CurrentScreen->m_Curseur.y );) + wxSize delta; int zoom = GetScreen()->GetZoom(); wxPoint curpos, oldpos; @@ -256,7 +259,12 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) SetTitle( GetScreen()->m_FileName ); } + D(printf("GeneralControleA Mouse.x=%d, Mouse.y=%d\n", + Mouse.x, Mouse.y );) + curpos = DrawPanel->CursorRealPosition( Mouse ); + + D(printf("GeneralControleB curpos.x=%d, curpos.y=%d\n", curpos.x, curpos.y );) oldpos = GetScreen()->m_Curseur; @@ -272,7 +280,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) printf( "delta.x=%d delta.y=%d grid.x=%d, grid.y=%d, zoom=%d\n", delta.x, delta.y, GetScreen()->GetGrid().x, GetScreen()->GetGrid().y, zoom ); #endif - + + switch( g_KeyPressed ) { case EDA_PANNING_UP_KEY: @@ -339,9 +348,16 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) break; } + D(printf("GeneralControle2 x=%d, y=%d\n", + m_CurrentScreen->m_Curseur.x, m_CurrentScreen->m_Curseur.y );) + /* Put cursor in new position, according to the zoom keys (if any) */ GetScreen()->m_Curseur = curpos; + D(printf("GeneralControle3 x=%d, y=%d\n", + m_CurrentScreen->m_Curseur.x, m_CurrentScreen->m_Curseur.y );) + + /* Put cursor on grid or a pad centre if requested * But if the tool DELETE is active the cursor is left off grid * this is better to reach items to delete off grid @@ -383,7 +399,9 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) // If we are not in delete function, put cursor on grid if( keep_on_grid ) + { PutOnGrid( &GetScreen()->m_Curseur ); + } break; } diff --git a/pcbnew/dialog_drc.cpp b/pcbnew/dialog_drc.cpp index d65ad5ae86..3b38324e55 100644 --- a/pcbnew/dialog_drc.cpp +++ b/pcbnew/dialog_drc.cpp @@ -884,8 +884,6 @@ void DrcDialog::OnPopupMenu( wxCommandEvent& event ) { int source = event.GetId(); - printf( "source=%d\n", source ); - const DRC_ITEM* item = 0; wxPoint pos; diff --git a/share/drawframe.cpp b/share/drawframe.cpp index 38484c451c..2a524afe8b 100644 --- a/share/drawframe.cpp +++ b/share/drawframe.cpp @@ -584,6 +584,9 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type ) * replacé au centre de l'ecran */ { + D(printf("OnZoom x=%d, y=%d\n", + m_CurrentScreen->m_Curseur.x, m_CurrentScreen->m_Curseur.y );) + if( DrawPanel == NULL ) return; @@ -604,7 +607,9 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type ) case ID_ZOOM_PLUS_BUTT: if( zoom_type == ID_ZOOM_PLUS_BUTT ) m_CurrentScreen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); + m_CurrentScreen->SetPreviousZoom(); + Recadre_Trace( move_mouse_cursor ); break; diff --git a/share/zoom.cpp b/share/zoom.cpp index 61537d1150..b052a176ce 100644 --- a/share/zoom.cpp +++ b/share/zoom.cpp @@ -47,13 +47,22 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse ) */ { PutOnGrid( &m_CurrentScreen->m_Curseur ); + AdjustScrollBars(); ReDrawPanel(); + + D(printf("~ReDrawPanel x=%d, y=%d\n", + m_CurrentScreen->m_Curseur.x, m_CurrentScreen->m_Curseur.y );) /* Move the mouse cursor to the on grid graphic cursor position */ if( ToMouse == TRUE ) + { DrawPanel->MouseToCursorSchema(); + + D(printf("~MouseToCursorSchema x=%d, y=%d\n", + m_CurrentScreen->m_Curseur.x, m_CurrentScreen->m_Curseur.y );) + } } diff --git a/todo.txt b/todo.txt index 8f2fd8789e..ff20aee43c 100644 --- a/todo.txt +++ b/todo.txt @@ -70,3 +70,11 @@ asked by: Dick Hollenbeck asked by: jp Charras ================================================================================ Use the collector classes in eeschema. + + +2007-Dec-5 Assigned To: charras +asked by: Dick +================================================================================ +http://sourceforge.net/tracker/index.php?func=detail&aid=1844960&group_id=145591&atid=762476 +Notice my appended note to this bug report as well. +