Loading share/drawpanel.cpp +161 −129 Original line number Original line Diff line number Diff line Loading @@ -13,10 +13,10 @@ #include "macros.h" #include "macros.h" #include "id.h" #include "id.h" // defines locaux // Local defines #define CURSOR_SIZE 12 // Cursor size in pixels #define CURSOR_SIZE 12 // Cursor size in pixels // table des evenements captes par un WinEDA_DrawPanel // Events used by WinEDA_DrawPanel BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving ) EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving ) EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent ) EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent ) Loading @@ -32,9 +32,9 @@ BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) WinEDA_DrawPanel::Process_Popup_Zoom ) WinEDA_DrawPanel::Process_Popup_Zoom ) END_EVENT_TABLE() END_EVENT_TABLE() /***********************************************************/ /************************************************************************/ /* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */ /* WinEDA_DrawPanel basic functions (WinEDA_DrawPanel is the main panel)*/ /***********************************************************/ /************************************************************************/ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size ) : const wxPoint& pos, const wxSize& size ) : Loading Loading @@ -185,8 +185,10 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC ) wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos ) wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos ) /*********************************************************************/ /*********************************************************************/ /* retourne la position absolue en pixels de la position rel_pos, /** Function CalcAbsolutePosition * donn�e en position relative scroll�e (en pixel) * @return absolute position in pixels, considering the scroll amount * @param rel_pos = relative position (screen position) in pixel * ( relative position = position in the panel draw area on screen ) */ */ { { wxPoint pos; wxPoint pos; Loading @@ -196,11 +198,11 @@ wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos ) #else #else int ii, jj; int ii, jj; GetViewStart( &pos.x, &pos.y ); GetViewStart( &pos.x, &pos.y ); // pos is the origin in scroll units GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj ); pos.x *= ii; pos.x *= ii; pos.y *= jj; pos.y *= jj; // pos is the origin in pixel units pos.x += rel_pos.x; pos.x += rel_pos.x; pos.y += rel_pos.y; pos.y += rel_pos.y; Loading @@ -213,8 +215,9 @@ wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos ) wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) /**********************************************************************/ /**********************************************************************/ /* Retourne la position en unites utilisateur du pointeur souris /** CursorRealPosition (used to calculate the cursor position in internal units) * ScreenPos = position pointeur en coord absolue ecran * @return position (in internal units) * @param ScreenPos = absolute position in pixels */ */ { { wxPoint curpos; wxPoint curpos; Loading @@ -229,9 +232,10 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) /********************************************************/ /********************************************************/ /* retourne TRUE si le point de coord physique ref_pos /** Funcion IsPointOnDisplay * est visible sur l'ecran, c'est a dire: * @param ref_pos is the position to test in pixels, relative to the panel. * si ref_pos est sur la partie du schema ou pcb affichee a l'ecran * @return TRUE if ref_pos is a point currently visible on screen * FALSE if ref_pos is out of screen */ */ { { wxPoint pos; wxPoint pos; Loading Loading @@ -268,8 +272,9 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) wxPoint WinEDA_DrawPanel::CursorScreenPosition() wxPoint WinEDA_DrawPanel::CursorScreenPosition() /********************************************************/ /********************************************************/ /* retourne la position sur l'ecran,en pixels, du curseur /** CursorScreenPosition * Orgine = coord absolue 0,0; * @return relative position in pixels of du curseur * ( relative position = position in the panel draw area on screen ) */ */ { { wxPoint curpos = GetScreen()->m_Curseur; wxPoint curpos = GetScreen()->m_Curseur; Loading @@ -287,6 +292,10 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition() /*********************************************************/ /*********************************************************/ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition() wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition() /*********************************************************/ /*********************************************************/ /** Function GetScreenCenterRealPosition() * @return position (in internal units) of the current area centre showed on screen */ { { wxSize size; wxSize size; wxPoint realpos; wxPoint realpos; Loading Loading @@ -345,6 +354,13 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse ) /********************************************************/ /********************************************************/ void WinEDA_DrawPanel::OnActivate( wxActivateEvent& event ) void WinEDA_DrawPanel::OnActivate( wxActivateEvent& event ) /********************************************************/ /********************************************************/ /** * Called on window activation. * init the member m_CanStartBlock to avoid a block start command * on activation (because a left mouse buton can be pressed and no block command wanted * This happens when enter on a hierarchycat sheet on double click */ { { m_CanStartBlock = -1; // Block Command can't start m_CanStartBlock = -1; // Block Command can't start event.Skip(); event.Skip(); Loading Loading @@ -415,6 +431,10 @@ void WinEDA_DrawPanel::OnSize( wxSizeEvent& event ) /******************************************/ /******************************************/ void WinEDA_DrawPanel::SetBoundaryBox() void WinEDA_DrawPanel::SetBoundaryBox() /******************************************/ /******************************************/ /** Function SetBoundaryBox() * set the m_ClipBox member to the current displayed rectangle dimensions */ { { BASE_SCREEN* Screen = GetScreen();; BASE_SCREEN* Screen = GetScreen();; Loading Loading @@ -562,9 +582,12 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg ) void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) /***********************************************/ /***********************************************/ /* Trace les axes X et Y et la grille /** Function DrawBackGround * La grille n'est affichee que si elle peut etre facilement visible * @param DC = current Device Context * La grille passe toujours par le centre de l'ecran * Draws X , Y axis * draws the grid * - the grid is drawn only if the zoom level allows a good visibility * - the grid is always centered on the screen centre */ */ { { int Color = BLUE; int Color = BLUE; Loading @@ -581,7 +604,9 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY ); /* le pas d'affichage doit etre assez grand pour avoir une grille visible */ /* The grid must be visible. this is possible only is grid value * and zoom value are sufficient */ drawgrid = m_Parent->m_Draw_Grid; drawgrid = m_Parent->m_Draw_Grid; pas_grille_affichee = screen->GetGrid(); pas_grille_affichee = screen->GetGrid(); Loading @@ -593,7 +618,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ii *= 2; ii *= 2; } } if( ii < 5 ) if( ii < 5 ) drawgrid = FALSE; // grille trop petite drawgrid = FALSE; // The gris is small ii = pas_grille_affichee.y / zoom; ii = pas_grille_affichee.y / zoom; if( ii < 5 ) if( ii < 5 ) Loading @@ -602,7 +627,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ii *= 2; ii *= 2; } } if( ii < 5 ) if( ii < 5 ) drawgrid = FALSE; // grille trop petite drawgrid = FALSE; // The gris is small GetViewStart( &org.x, &org.y ); GetViewStart( &org.x, &org.y ); GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj ); Loading Loading @@ -681,6 +706,11 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) /********************************************************************/ /********************************************************************/ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode ) void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode ) /********************************************************************/ /********************************************************************/ /** m_Draw_Auxiliary_Axis * Draw the Auxiliary Axis, used in pcbnew which as origin coordinates * for gerber and excellon files */ { { if( m_Parent->m_Auxiliary_Axis_Position.x == 0 if( m_Parent->m_Auxiliary_Axis_Position.x == 0 && m_Parent->m_Auxiliary_Axis_Position.y == 0 ) && m_Parent->m_Auxiliary_Axis_Position.y == 0 ) Loading Loading @@ -770,7 +800,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) m_CanStartBlock = -1; m_CanStartBlock = -1; } } if( ManageCurseur == NULL ) // Pas de commande en cours if( ManageCurseur == NULL ) // No command in progress m_AutoPAN_Request = FALSE; m_AutoPAN_Request = FALSE; if( m_Parent->m_FrameIsActive ) if( m_Parent->m_FrameIsActive ) Loading Loading @@ -862,13 +892,12 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) g_MouseOldButtons = localrealbutt; g_MouseOldButtons = localrealbutt; // Appel des fonctions li�es au Double Click ou au Click // Calling Double Click and Click functions : if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) { { m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels ); m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels ); IgnoreNextLeftButtonRelease = true; IgnoreNextLeftButtonRelease = true; } } else if( event.LeftUp() ) else if( event.LeftUp() ) { { if( screen->BlockLocate.m_State==STATE_NO_BLOCK && !IgnoreNextLeftButtonRelease ) if( screen->BlockLocate.m_State==STATE_NO_BLOCK && !IgnoreNextLeftButtonRelease ) Loading @@ -885,9 +914,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) } } /* Calling the general function on mouse changes (and pseudo key commands) */ /* Appel de la fonction generale de gestion des mouvements souris * et commandes clavier */ m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels ); m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels ); Loading Loading @@ -953,10 +980,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) if( event.ButtonUp( 1 ) || event.ButtonUp( 2 ) ) if( event.ButtonUp( 1 ) || event.ButtonUp( 2 ) ) { { /* Relachement du bouton: fin de delimitation de block. /* Release the mouse button: end of block. * La commande peut etre terminee (DELETE) ou continuer par le placement * The command can finish (DELETE) or have a next command * du block ainsi delimite (MOVE, COPY). * (MOVE, COPY). * Cependant bloc est annule si sa taille est trop petite * However the block command is cancelled if the block size is small */ */ bool BlockIsSmall = bool BlockIsSmall = ( ABS( screen->BlockLocate.GetWidth() / GetZoom() ) < 3) ( ABS( screen->BlockLocate.GetWidth() / GetZoom() ) < 3) Loading Loading @@ -985,8 +1012,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) } } } } // Arret de block sur un double click ( qui peut provoquer un move block // End of block command on a double click // si on d�place la souris dans ce double click // To avoid an unwanted block move command if the move is moved while double click if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) { { if( screen->BlockLocate.m_Command != BLOCK_IDLE ) if( screen->BlockLocate.m_Command != BLOCK_IDLE ) Loading Loading @@ -1066,8 +1093,8 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) } } } } #if wxCHECK_VERSION(2, 8, 0) /* some key commands use the mouse position: refresh it */ /* some key commands use the mouse position: refresh it */ #if wxCHECK_VERSION( 2, 8, 0 ) wxPoint mouse_pos = wxGetMousePosition(); // Get the mouse position on screen wxPoint mouse_pos = wxGetMousePosition(); // Get the mouse position on screen wxPoint win_pos = GetScreenPosition(); // get the draw area (panel)position on screen wxPoint win_pos = GetScreenPosition(); // get the draw area (panel)position on screen mouse_pos -= win_pos; // mouse_pos = is the mouse position relative to the panel mouse_pos -= win_pos; // mouse_pos = is the mouse position relative to the panel Loading @@ -1077,8 +1104,13 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) /* Compute absolute m_MousePosition in user units: */ /* Compute absolute m_MousePosition in user units: */ Screen->m_MousePosition = CursorRealPosition( Screen->m_MousePositionInPixels ); Screen->m_MousePosition = CursorRealPosition( Screen->m_MousePositionInPixels ); #else #else /* if wxGetMousePosition() does not exist, * m_Cursor should be ok, use it to calculate the cursor position on screen */ Screen->m_MousePositionInPixels = CursorScreenPosition(); #endif #endif m_Parent->GeneralControle( &DC, Screen->m_MousePositionInPixels ); m_Parent->GeneralControle( &DC, Screen->m_MousePositionInPixels ); Loading Loading
share/drawpanel.cpp +161 −129 Original line number Original line Diff line number Diff line Loading @@ -13,10 +13,10 @@ #include "macros.h" #include "macros.h" #include "id.h" #include "id.h" // defines locaux // Local defines #define CURSOR_SIZE 12 // Cursor size in pixels #define CURSOR_SIZE 12 // Cursor size in pixels // table des evenements captes par un WinEDA_DrawPanel // Events used by WinEDA_DrawPanel BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving ) EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving ) EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent ) EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent ) Loading @@ -32,9 +32,9 @@ BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) WinEDA_DrawPanel::Process_Popup_Zoom ) WinEDA_DrawPanel::Process_Popup_Zoom ) END_EVENT_TABLE() END_EVENT_TABLE() /***********************************************************/ /************************************************************************/ /* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */ /* WinEDA_DrawPanel basic functions (WinEDA_DrawPanel is the main panel)*/ /***********************************************************/ /************************************************************************/ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size ) : const wxPoint& pos, const wxSize& size ) : Loading Loading @@ -185,8 +185,10 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC ) wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos ) wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos ) /*********************************************************************/ /*********************************************************************/ /* retourne la position absolue en pixels de la position rel_pos, /** Function CalcAbsolutePosition * donn�e en position relative scroll�e (en pixel) * @return absolute position in pixels, considering the scroll amount * @param rel_pos = relative position (screen position) in pixel * ( relative position = position in the panel draw area on screen ) */ */ { { wxPoint pos; wxPoint pos; Loading @@ -196,11 +198,11 @@ wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos ) #else #else int ii, jj; int ii, jj; GetViewStart( &pos.x, &pos.y ); GetViewStart( &pos.x, &pos.y ); // pos is the origin in scroll units GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj ); pos.x *= ii; pos.x *= ii; pos.y *= jj; pos.y *= jj; // pos is the origin in pixel units pos.x += rel_pos.x; pos.x += rel_pos.x; pos.y += rel_pos.y; pos.y += rel_pos.y; Loading @@ -213,8 +215,9 @@ wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos ) wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) /**********************************************************************/ /**********************************************************************/ /* Retourne la position en unites utilisateur du pointeur souris /** CursorRealPosition (used to calculate the cursor position in internal units) * ScreenPos = position pointeur en coord absolue ecran * @return position (in internal units) * @param ScreenPos = absolute position in pixels */ */ { { wxPoint curpos; wxPoint curpos; Loading @@ -229,9 +232,10 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) /********************************************************/ /********************************************************/ /* retourne TRUE si le point de coord physique ref_pos /** Funcion IsPointOnDisplay * est visible sur l'ecran, c'est a dire: * @param ref_pos is the position to test in pixels, relative to the panel. * si ref_pos est sur la partie du schema ou pcb affichee a l'ecran * @return TRUE if ref_pos is a point currently visible on screen * FALSE if ref_pos is out of screen */ */ { { wxPoint pos; wxPoint pos; Loading Loading @@ -268,8 +272,9 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) wxPoint WinEDA_DrawPanel::CursorScreenPosition() wxPoint WinEDA_DrawPanel::CursorScreenPosition() /********************************************************/ /********************************************************/ /* retourne la position sur l'ecran,en pixels, du curseur /** CursorScreenPosition * Orgine = coord absolue 0,0; * @return relative position in pixels of du curseur * ( relative position = position in the panel draw area on screen ) */ */ { { wxPoint curpos = GetScreen()->m_Curseur; wxPoint curpos = GetScreen()->m_Curseur; Loading @@ -287,6 +292,10 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition() /*********************************************************/ /*********************************************************/ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition() wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition() /*********************************************************/ /*********************************************************/ /** Function GetScreenCenterRealPosition() * @return position (in internal units) of the current area centre showed on screen */ { { wxSize size; wxSize size; wxPoint realpos; wxPoint realpos; Loading Loading @@ -345,6 +354,13 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse ) /********************************************************/ /********************************************************/ void WinEDA_DrawPanel::OnActivate( wxActivateEvent& event ) void WinEDA_DrawPanel::OnActivate( wxActivateEvent& event ) /********************************************************/ /********************************************************/ /** * Called on window activation. * init the member m_CanStartBlock to avoid a block start command * on activation (because a left mouse buton can be pressed and no block command wanted * This happens when enter on a hierarchycat sheet on double click */ { { m_CanStartBlock = -1; // Block Command can't start m_CanStartBlock = -1; // Block Command can't start event.Skip(); event.Skip(); Loading Loading @@ -415,6 +431,10 @@ void WinEDA_DrawPanel::OnSize( wxSizeEvent& event ) /******************************************/ /******************************************/ void WinEDA_DrawPanel::SetBoundaryBox() void WinEDA_DrawPanel::SetBoundaryBox() /******************************************/ /******************************************/ /** Function SetBoundaryBox() * set the m_ClipBox member to the current displayed rectangle dimensions */ { { BASE_SCREEN* Screen = GetScreen();; BASE_SCREEN* Screen = GetScreen();; Loading Loading @@ -562,9 +582,12 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg ) void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) /***********************************************/ /***********************************************/ /* Trace les axes X et Y et la grille /** Function DrawBackGround * La grille n'est affichee que si elle peut etre facilement visible * @param DC = current Device Context * La grille passe toujours par le centre de l'ecran * Draws X , Y axis * draws the grid * - the grid is drawn only if the zoom level allows a good visibility * - the grid is always centered on the screen centre */ */ { { int Color = BLUE; int Color = BLUE; Loading @@ -581,7 +604,9 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY ); /* le pas d'affichage doit etre assez grand pour avoir une grille visible */ /* The grid must be visible. this is possible only is grid value * and zoom value are sufficient */ drawgrid = m_Parent->m_Draw_Grid; drawgrid = m_Parent->m_Draw_Grid; pas_grille_affichee = screen->GetGrid(); pas_grille_affichee = screen->GetGrid(); Loading @@ -593,7 +618,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ii *= 2; ii *= 2; } } if( ii < 5 ) if( ii < 5 ) drawgrid = FALSE; // grille trop petite drawgrid = FALSE; // The gris is small ii = pas_grille_affichee.y / zoom; ii = pas_grille_affichee.y / zoom; if( ii < 5 ) if( ii < 5 ) Loading @@ -602,7 +627,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ii *= 2; ii *= 2; } } if( ii < 5 ) if( ii < 5 ) drawgrid = FALSE; // grille trop petite drawgrid = FALSE; // The gris is small GetViewStart( &org.x, &org.y ); GetViewStart( &org.x, &org.y ); GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj ); Loading Loading @@ -681,6 +706,11 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) /********************************************************************/ /********************************************************************/ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode ) void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode ) /********************************************************************/ /********************************************************************/ /** m_Draw_Auxiliary_Axis * Draw the Auxiliary Axis, used in pcbnew which as origin coordinates * for gerber and excellon files */ { { if( m_Parent->m_Auxiliary_Axis_Position.x == 0 if( m_Parent->m_Auxiliary_Axis_Position.x == 0 && m_Parent->m_Auxiliary_Axis_Position.y == 0 ) && m_Parent->m_Auxiliary_Axis_Position.y == 0 ) Loading Loading @@ -770,7 +800,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) m_CanStartBlock = -1; m_CanStartBlock = -1; } } if( ManageCurseur == NULL ) // Pas de commande en cours if( ManageCurseur == NULL ) // No command in progress m_AutoPAN_Request = FALSE; m_AutoPAN_Request = FALSE; if( m_Parent->m_FrameIsActive ) if( m_Parent->m_FrameIsActive ) Loading Loading @@ -862,13 +892,12 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) g_MouseOldButtons = localrealbutt; g_MouseOldButtons = localrealbutt; // Appel des fonctions li�es au Double Click ou au Click // Calling Double Click and Click functions : if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) { { m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels ); m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels ); IgnoreNextLeftButtonRelease = true; IgnoreNextLeftButtonRelease = true; } } else if( event.LeftUp() ) else if( event.LeftUp() ) { { if( screen->BlockLocate.m_State==STATE_NO_BLOCK && !IgnoreNextLeftButtonRelease ) if( screen->BlockLocate.m_State==STATE_NO_BLOCK && !IgnoreNextLeftButtonRelease ) Loading @@ -885,9 +914,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) } } /* Calling the general function on mouse changes (and pseudo key commands) */ /* Appel de la fonction generale de gestion des mouvements souris * et commandes clavier */ m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels ); m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels ); Loading Loading @@ -953,10 +980,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) if( event.ButtonUp( 1 ) || event.ButtonUp( 2 ) ) if( event.ButtonUp( 1 ) || event.ButtonUp( 2 ) ) { { /* Relachement du bouton: fin de delimitation de block. /* Release the mouse button: end of block. * La commande peut etre terminee (DELETE) ou continuer par le placement * The command can finish (DELETE) or have a next command * du block ainsi delimite (MOVE, COPY). * (MOVE, COPY). * Cependant bloc est annule si sa taille est trop petite * However the block command is cancelled if the block size is small */ */ bool BlockIsSmall = bool BlockIsSmall = ( ABS( screen->BlockLocate.GetWidth() / GetZoom() ) < 3) ( ABS( screen->BlockLocate.GetWidth() / GetZoom() ) < 3) Loading Loading @@ -985,8 +1012,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) } } } } // Arret de block sur un double click ( qui peut provoquer un move block // End of block command on a double click // si on d�place la souris dans ce double click // To avoid an unwanted block move command if the move is moved while double click if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) { { if( screen->BlockLocate.m_Command != BLOCK_IDLE ) if( screen->BlockLocate.m_Command != BLOCK_IDLE ) Loading Loading @@ -1066,8 +1093,8 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) } } } } #if wxCHECK_VERSION(2, 8, 0) /* some key commands use the mouse position: refresh it */ /* some key commands use the mouse position: refresh it */ #if wxCHECK_VERSION( 2, 8, 0 ) wxPoint mouse_pos = wxGetMousePosition(); // Get the mouse position on screen wxPoint mouse_pos = wxGetMousePosition(); // Get the mouse position on screen wxPoint win_pos = GetScreenPosition(); // get the draw area (panel)position on screen wxPoint win_pos = GetScreenPosition(); // get the draw area (panel)position on screen mouse_pos -= win_pos; // mouse_pos = is the mouse position relative to the panel mouse_pos -= win_pos; // mouse_pos = is the mouse position relative to the panel Loading @@ -1077,8 +1104,13 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) /* Compute absolute m_MousePosition in user units: */ /* Compute absolute m_MousePosition in user units: */ Screen->m_MousePosition = CursorRealPosition( Screen->m_MousePositionInPixels ); Screen->m_MousePosition = CursorRealPosition( Screen->m_MousePositionInPixels ); #else #else /* if wxGetMousePosition() does not exist, * m_Cursor should be ok, use it to calculate the cursor position on screen */ Screen->m_MousePositionInPixels = CursorScreenPosition(); #endif #endif m_Parent->GeneralControle( &DC, Screen->m_MousePositionInPixels ); m_Parent->GeneralControle( &DC, Screen->m_MousePositionInPixels ); Loading