Commit cfd86856 authored by charras's avatar charras

pcbnew:fixed muwave toolbar not working in AUI option.

fixed a grid refresh problem when using fast algo in drawpanel.cpp
parent cae96bce
...@@ -361,7 +361,7 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv ) ...@@ -361,7 +361,7 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
MsgPanel->SetSize( 0, clientSize.y, clientSize.x, m_MsgFrameHeight ); MsgPanel->SetSize( 0, clientSize.y, clientSize.x, m_MsgFrameHeight );
} }
if( m_AuxiliaryToolBar ) // Resize the auxilary horizontal tool bar. if( m_AuxiliaryToolBar && m_AuxiliaryToolBar->IsShown() ) // Resize the auxilary horizontal tool bar.
{ {
m_AuxiliaryToolBar->SetSize( clientSize.x, default_value); m_AuxiliaryToolBar->SetSize( clientSize.x, default_value);
m_AuxiliaryToolBar->Move( 0, 0 ); m_AuxiliaryToolBar->Move( 0, 0 );
...@@ -369,21 +369,21 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv ) ...@@ -369,21 +369,21 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
clientPosition.y = m_AuxiliaryToolBar->GetDimension(); clientPosition.y = m_AuxiliaryToolBar->GetDimension();
} }
if( m_VToolBar ) // Resize the main right vertical tool bar. if( m_VToolBar && m_VToolBar->IsShown() ) // Resize the main right vertical tool bar.
{ {
m_VToolBar->SetSize(default_value, clientSize.y ); m_VToolBar->SetSize(default_value, clientSize.y );
clientSize.x -= m_VToolBar->GetDimension(); clientSize.x -= m_VToolBar->GetDimension();
m_VToolBar->Move( clientSize.x, clientPosition.y ); m_VToolBar->Move( clientSize.x, clientPosition.y );
} }
if( m_AuxVToolBar ) // Resize the auxiliary right vertical toolbar. if( m_AuxVToolBar && m_AuxVToolBar->IsShown() ) // Resize the auxiliary right vertical toolbar.
{ {
m_AuxVToolBar->SetSize( default_value, clientSize.y ); m_AuxVToolBar->SetSize( default_value, clientSize.y );
clientSize.x -= m_AuxVToolBar->GetDimension(); clientSize.x -= m_AuxVToolBar->GetDimension();
m_AuxVToolBar->Move( clientSize.x, clientPosition.y ); m_AuxVToolBar->Move( clientSize.x, clientPosition.y );
} }
if( m_OptionsToolBar ) // Resize the main left vertical tool bar. if( m_OptionsToolBar && m_OptionsToolBar->IsShown() ) // Resize the main left vertical tool bar.
{ {
m_OptionsToolBar->SetSize( default_value, clientSize.y ); m_OptionsToolBar->SetSize( default_value, clientSize.y );
clientSize.x -= m_OptionsToolBar->GetDimension( ); clientSize.x -= m_OptionsToolBar->GetDimension( );
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
// Helper class to handle the client Device Context // Helper class to handle the client Device Context
KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel ) KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel* aDrawPanel ) :
: wxClientDC(aDrawPanel) wxClientDC( aDrawPanel )
{ {
GRResetPenAndBrush( this ); GRResetPenAndBrush( this );
SetBackgroundMode( wxTRANSPARENT ); SetBackgroundMode( wxTRANSPARENT );
...@@ -33,7 +33,8 @@ KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel ) ...@@ -33,7 +33,8 @@ KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel )
aDrawPanel->SetBoundaryBox(); aDrawPanel->SetBoundaryBox();
} }
KicadGraphicContext::~KicadGraphicContext( )
KicadGraphicContext::~KicadGraphicContext()
{ {
} }
...@@ -48,16 +49,16 @@ static bool s_IgnoreNextLeftButtonRelease = false; ...@@ -48,16 +49,16 @@ static bool s_IgnoreNextLeftButtonRelease = false;
// Events used by WinEDA_DrawPanel // Events used by WinEDA_DrawPanel
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow ) BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving ) EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
EVT_MOUSEWHEEL( WinEDA_DrawPanel::OnMouseWheel ) EVT_MOUSEWHEEL( WinEDA_DrawPanel::OnMouseWheel )
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent ) EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent ) EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent ) EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent )
EVT_PAINT( WinEDA_DrawPanel::OnPaint ) EVT_PAINT( WinEDA_DrawPanel::OnPaint )
EVT_SIZE( WinEDA_DrawPanel::OnSize ) EVT_SIZE( WinEDA_DrawPanel::OnSize )
EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll ) EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate ) EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan ) EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan )
END_EVENT_TABLE() END_EVENT_TABLE()
/***********************************************************************/ /***********************************************************************/
...@@ -112,6 +113,7 @@ WinEDA_DrawPanel::~WinEDA_DrawPanel() ...@@ -112,6 +113,7 @@ WinEDA_DrawPanel::~WinEDA_DrawPanel()
BASE_SCREEN* WinEDA_DrawPanel::GetScreen() BASE_SCREEN* WinEDA_DrawPanel::GetScreen()
{ {
WinEDA_DrawFrame* parentFrame = m_Parent; WinEDA_DrawFrame* parentFrame = m_Parent;
return parentFrame->GetBaseScreen(); return parentFrame->GetBaseScreen();
} }
...@@ -191,7 +193,6 @@ wxRealPoint WinEDA_DrawPanel::GetGrid() ...@@ -191,7 +193,6 @@ wxRealPoint WinEDA_DrawPanel::GetGrid()
} }
/** Calculate the cursor position in internal units. /** Calculate the cursor position in internal units.
* @return position (in internal units) * @return position (in internal units)
* @param ScreenPos = absolute position in pixels * @param ScreenPos = absolute position in pixels
...@@ -310,7 +311,7 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition() ...@@ -310,7 +311,7 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition()
{ {
#ifdef WX_ZOOM #ifdef WX_ZOOM
wxCoord x, y; wxCoord x, y;
INSTALL_DC ( DC, this ); INSTALL_DC( DC, this );
x = DC.LogicalToDeviceX( GetScreen()->m_Curseur.x ); x = DC.LogicalToDeviceX( GetScreen()->m_Curseur.x );
y = DC.LogicalToDeviceY( GetScreen()->m_Curseur.y ); y = DC.LogicalToDeviceY( GetScreen()->m_Curseur.y );
...@@ -337,6 +338,7 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void ) ...@@ -337,6 +338,7 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void )
GetScreen()->Unscale( realpos ); GetScreen()->Unscale( realpos );
#ifdef WX_ZOOM #ifdef WX_ZOOM
// wxCoord x, y; // wxCoord x, y;
// INSTALL_DC( DC, this ); // INSTALL_DC( DC, this );
// realpos.x = DC.DeviceToLogicalX( realpos.x ); // realpos.x = DC.DeviceToLogicalX( realpos.x );
...@@ -537,6 +539,7 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC ) ...@@ -537,6 +539,7 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC )
#if wxUSE_GRAPHICS_CONTEXT #if wxUSE_GRAPHICS_CONTEXT
// note: wxUSE_GRAPHICS_CONTEXT must be set to 1 in wxWidgets // note: wxUSE_GRAPHICS_CONTEXT must be set to 1 in wxWidgets
// see setup.h in wx Widgets. // see setup.h in wx Widgets.
// wxWidgets configure can need option --enable-graphics_ctx // wxWidgets configure can need option --enable-graphics_ctx
...@@ -555,10 +558,12 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event ) ...@@ -555,10 +558,12 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
#ifdef USE_GCDC_IN_KICAD #ifdef USE_GCDC_IN_KICAD
wxPaintDC pDC( this ); wxPaintDC pDC( this );
// Following line should be disabled on MSW and OS X // Following line should be disabled on MSW and OS X
wxGCDC paintDC( pDC ); wxGCDC paintDC( pDC );
// Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187 // Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187
paintDC.GetGraphicsContext()->Translate(0.5, 0.5); paintDC.GetGraphicsContext()->Translate( 0.5, 0.5 );
#else #else
INSTALL_PAINTDC( paintDC, this ); INSTALL_PAINTDC( paintDC, this );
#endif #endif
...@@ -575,7 +580,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event ) ...@@ -575,7 +580,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
// get the union of all rectangles in the update region, 'upd' // get the union of all rectangles in the update region, 'upd'
PaintClipBox = upd.GetBox(); PaintClipBox = upd.GetBox();
#if 0 && defined (DEBUG) #if 0 && defined(DEBUG)
printf( "1) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) m_ClipBox=(%d, %d, %d, %d)\n", printf( "1) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) m_ClipBox=(%d, %d, %d, %d)\n",
PaintClipBox.x, PaintClipBox.x,
PaintClipBox.y, PaintClipBox.y,
...@@ -614,9 +619,9 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event ) ...@@ -614,9 +619,9 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
#endif #endif
// Be sure the drawpanel clipbox is bigger than the region to repair: // Be sure the drawpanel clipbox is bigger than the region to repair:
m_ClipBox.Inflate(1); // Give it one pixel more in each direction m_ClipBox.Inflate( 1 ); // Give it one pixel more in each direction
#if 0 && defined (DEBUG) #if 0 && defined(DEBUG)
printf( "2) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) m_ClipBox=(%d, %d, %d, %d)\n", printf( "2) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) m_ClipBox=(%d, %d, %d, %d)\n",
PaintClipBox.x, PaintClipBox.x,
PaintClipBox.y, PaintClipBox.y,
...@@ -686,34 +691,60 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg ) ...@@ -686,34 +691,60 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
/** Function DrawBackGround /** Function DrawBackGround
* @param DC = current Device Context * @param DC = current Device Context
* Draws X , Y axis * Draws (if allowed) :
* the grid
* X and Y axis
* X and Y auxiliary axis
*/
void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
{
int axis_color = BLUE;
BASE_SCREEN* screen = GetScreen();
GRSetDrawMode( DC, GR_COPY );
if( m_Parent->m_Draw_Grid )
DrawGrid( DC );
/* Draw axis */
if( m_Parent->m_Draw_Axis )
{
/* Draw the Y axis */
GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
0, screen->ReturnPageSize().y, 0, axis_color );
/* Draw the X axis */
GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
screen->ReturnPageSize().x, 0, 0, axis_color );
}
if( m_Parent->m_Draw_Auxiliary_Axis )
DrawAuxiliaryAxis( DC, GR_COPY );
}
/** Function DrawGrid
* @param DC = current Device Context
* draws the grid * draws the grid
* - the grid is drawn only if the zoom level allows a good visibility * - the grid is drawn only if the zoom level allows a good visibility
* - the grid is always centered on the screen center * - the grid is always centered on the screen center
*/ */
void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
{ {
int Color = BLUE;
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
int ii, jj, xg, yg, color; int ii, jj, xg, yg;
wxRealPoint screen_grid_size; wxRealPoint screen_grid_size;
bool drawgrid = false;
wxSize size; wxSize size;
wxPoint org; wxPoint org;
color = g_GridColor;
GRSetDrawMode( DC, GR_COPY );
/* The grid must be visible. this is possible only is grid value /* The grid must be visible. this is possible only is grid value
* and zoom value are sufficient * and zoom value are sufficient
*/ */
drawgrid = m_Parent->m_Draw_Grid;
screen_grid_size = screen->GetGridSize(); screen_grid_size = screen->GetGridSize();
wxRealPoint dgrid = screen_grid_size; wxRealPoint dgrid = screen_grid_size;
screen->Scale( dgrid ); // dgrid = grid size in pixels screen->Scale( dgrid ); // dgrid = grid size in pixels
// if the grid size is small ( < 5 pixels) do not display all points // if the grid size is small ( < 5 pixels) do not display all points
if( dgrid.x < 5 ) if( dgrid.x < 5 )
{ {
...@@ -721,7 +752,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -721,7 +752,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
dgrid.x *= 2; dgrid.x *= 2;
} }
if( dgrid.x < 5 ) if( dgrid.x < 5 )
drawgrid = false; // The grid is too small: do not show it return; // The grid is too small: do not show it
if( dgrid.y < 5 ) if( dgrid.y < 5 )
{ {
...@@ -729,7 +760,8 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -729,7 +760,8 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
dgrid.y *= 2; dgrid.y *= 2;
} }
if( dgrid.y < 5 ) if( dgrid.y < 5 )
drawgrid = false; // The grid is too small return; // The grid is too small
GetViewStart( &org.x, &org.y ); GetViewStart( &org.x, &org.y );
GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj );
...@@ -756,10 +788,8 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -756,10 +788,8 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
size.SetHeight( DC->DeviceToLogicalYRel( size.GetHeight() ) ); size.SetHeight( DC->DeviceToLogicalYRel( size.GetHeight() ) );
#endif #endif
if( drawgrid )
{
m_Parent->PutOnGrid( &org ); m_Parent->PutOnGrid( &org );
GRSetColorPen( DC, color ); GRSetColorPen( DC, g_GridColor );
int xpos, ypos; int xpos, ypos;
...@@ -770,84 +800,93 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -770,84 +800,93 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
// so perhaps could be necessary to set this option at run time. // so perhaps could be necessary to set this option at run time.
#if 0 #if 0
// Use a pixel based draw to display grid // Use a pixel based draw to display grid
// There is a lot of calls, so the cost is hight // There is a lot of calls, so the cost is hight
// and grid is slowly drawn on some platforms // and grid is slowly drawn on some platforms
#if defined ( __WXMAC__ ) #if defined( __WXMAC__ )
wxWindowUpdateLocker(this); // under macOSX: drawings are faster with this wxWindowUpdateLocker( this ); // under macOSX: drawings are faster with this
#endif #endif
for( ii = 0; ; ii++ ) for( ii = 0; ; ii++ )
{ {
xg = wxRound(ii * screen_grid_size.x); xg = wxRound( ii * screen_grid_size.x );
if( xg > size.x ) if( xg > size.x )
break; break;
xpos = org.x + xg; xpos = org.x + xg;
xpos = GRMapX( xpos ); xpos = GRMapX( xpos );
for( jj = 0; ; jj++ ) for( jj = 0; ; jj++ )
{ {
yg = wxRound(jj * screen_grid_size.y); yg = wxRound( jj * screen_grid_size.y );
if( yg > size.y ) if( yg > size.y )
break; break;
ypos = org.y + yg; ypos = org.y + yg;
DC->DrawPoint( xpos, GRMapY( ypos ) ); DC->DrawPoint( xpos, GRMapY( ypos ) );
} }
} }
#else // Currently on test: Use a fast way to draw the grid
// But this is fast only if the Blit function is fast. Not true on all platforms #else
// a grid column is drawn; and then copied to others grid columns
// this is possible because the grid is drawn only after clearing the screen. /* Currently on test: Use a fast way to draw the grid
// under MACOSX, is very slow * But this is fast only if the Blit function is fast. Not true on all platforms
* a grid column is drawn; and then copied to others grid columns
* this is possible because the grid is drawn only after clearing the screen.
*
* A first grid column is drawn, and after duplicated using the Blit function
* (copy from a screen area to an other screen area)
* the screen area source is the first column drawn.
*/
wxSize screenSize = GetClientSize(); wxSize screenSize = GetClientSize();
ii = 1; int x0pos;
xg = wxRound(ii * screen_grid_size.x); /* skip the grid columns outside the area to redraw
int x0pos = GRMapX( org.x + xg); * (it is not always the first pixel column when redraw a sub area of the screen)
* this is mandatory because we cannot write outside this sub area
* and therefore cannot use a column ouside this area as the column to duplicate
* this ugly way to found the first suitable column is due to the fact
* the function that reverses the GRMapX function does dot exist.
*/
for( ii = 1; ; ii++ ) // Do not draw the column 0 because it is not easily visible
{
xg = wxRound( ii * screen_grid_size.x );
if( xg > size.x )
return; // out of screen (should not occur)
x0pos = GRMapX( org.x + xg );
if( x0pos > m_ClipBox.GetOrigin().x) // First column in active screen area found.
break;
}
for( jj = 0; ; jj++ ) for( jj = 0; ; jj++ )
{ {
yg = wxRound(jj * screen_grid_size.y); yg = wxRound( jj * screen_grid_size.y );
if( yg > size.y ) if( yg > size.y )
break; break;
ypos = org.y + yg; ypos = org.y + yg;
DC->DrawPoint( x0pos, GRMapY( ypos ) ); DC->DrawPoint( x0pos, GRMapY( ypos ) );
} }
ypos = GRMapY(org.y); ypos = GRMapY( org.y );
for( ii = 2; ; ii++ ) for( ; ; ii++ )
{ {
xg = wxRound(ii * screen_grid_size.x); xg = wxRound( ii * screen_grid_size.x );
if( xg > size.x ) if( xg > size.x )
break; break;
xpos = GRMapX( org.x + xg ); xpos = GRMapX( org.x + xg );
if( xpos > m_ClipBox.GetEnd().x) // end of active area reached.
break;
DC->Blit( xpos, ypos, 1, screenSize.y, DC, x0pos, ypos ); DC->Blit( xpos, ypos, 1, screenSize.y, DC, x0pos, ypos );
} }
#endif
}
/* Draw axis */ #endif
if( m_Parent->m_Draw_Axis )
{
/* Draw the Y axis */
GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
0, screen->ReturnPageSize().y, 0, Color );
/* Draw the X axis */
GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
screen->ReturnPageSize().x, 0, 0, Color );
}
DrawAuxiliaryAxis( DC, GR_COPY );
} }
/** m_Draw_Auxiliary_Axis /** function DrawAuxiliaryAxis
* Draw the Auxiliary Axis, used in pcbnew which as origin coordinates * Draw the Auxiliary Axis, used in pcbnew which as origin coordinates
* for gerber and excellon files * for gerber and excellon files
* @param DC = current Device Context
*/ */
void WinEDA_DrawPanel::DrawAuxiliaryAxis( wxDC* DC, int drawmode ) void WinEDA_DrawPanel::DrawAuxiliaryAxis( wxDC* DC, int drawmode )
{ {
if( !m_Parent->m_Draw_Auxiliary_Axis if( m_Parent->m_Auxiliary_Axis_Position == wxPoint( 0, 0 ) )
|| ( m_Parent->m_Auxiliary_Axis_Position.x == 0
&& m_Parent->m_Auxiliary_Axis_Position.y == 0 ) )
return; return;
int Color = DARKRED; int Color = DARKRED;
...@@ -931,7 +970,7 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event ) ...@@ -931,7 +970,7 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
if( m_IgnoreMouseEvents ) if( m_IgnoreMouseEvents )
return; return;
wxRect rect = wxRect( wxPoint( 0, 0), GetClientSize() ); wxRect rect = wxRect( wxPoint( 0, 0 ), GetClientSize() );
/* Ignore scroll events if the cursor is outside the drawing area. */ /* Ignore scroll events if the cursor is outside the drawing area. */
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled() if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
...@@ -963,7 +1002,7 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event ) ...@@ -963,7 +1002,7 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
else else
cmd.SetId( ID_POPUP_ZOOM_IN ); cmd.SetId( ID_POPUP_ZOOM_IN );
} }
else if ( event.GetWheelRotation() < 0 ) else if( event.GetWheelRotation() < 0 )
{ {
if( event.ShiftDown() && !event.ControlDown() ) if( event.ShiftDown() && !event.ControlDown() )
cmd.SetId( ID_PAN_DOWN ); cmd.SetId( ID_PAN_DOWN );
...@@ -1073,7 +1112,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1073,7 +1112,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
g_MouseOldButtons = localrealbutt; g_MouseOldButtons = localrealbutt;
// Calling Double Click and Click functions : // 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 );
...@@ -1175,7 +1214,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1175,7 +1214,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
// Mouse is dragging: if no block in progress, start a block // Mouse is dragging: if no block in progress, start a block
// command. // command.
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ // Start a block command {
// Start a block command
int cmd_type = kbstat; int cmd_type = kbstat;
if( event.MiddleIsDown() ) if( event.MiddleIsDown() )
...@@ -1304,7 +1344,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) ...@@ -1304,7 +1344,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
if( event.ShiftDown() && (key > 256) ) if( event.ShiftDown() && (key > 256) )
localkey |= GR_KB_SHIFT; localkey |= GR_KB_SHIFT;
INSTALL_DC(DC, this ); INSTALL_DC( DC, this );
BASE_SCREEN* Screen = GetScreen(); BASE_SCREEN* Screen = GetScreen();
...@@ -1334,7 +1374,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) ...@@ -1334,7 +1374,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
#endif #endif
/* Compute absolute mouse position in pixel units (i.e. considering the /* Compute absolute mouse position in pixel units (i.e. considering the
current scroll) : */ * current scroll) : */
Screen->m_MousePositionInPixels = pos; Screen->m_MousePositionInPixels = pos;
/* Compute absolute mouse position in user units: */ /* Compute absolute mouse position in user units: */
......
...@@ -97,8 +97,31 @@ public: ...@@ -97,8 +97,31 @@ public:
int aPrintMask, int aPrintMask,
bool aPrintMirrorMode, bool aPrintMirrorMode,
void* aData ); void* aData );
/** Function DrawBackGround
* @param DC = current Device Context
* Draws (if allowed) :
* the grid
* X and Y axis
* X and Y auxiliary axis
*/
void DrawBackGround( wxDC* DC ); void DrawBackGround( wxDC* DC );
/** Function DrawGrid
* @param DC = current Device Context
* draws the grid
* - the grid is drawn only if the zoom level allows a good visibility
* - the grid is always centered on the screen center
*/
void DrawGrid( wxDC* DC );
/** function DrawAuxiliaryAxis
* Draw the Auxiliary Axis, used in pcbnew which as origin coordinates
* for gerber and excellon files
* @param DC = current Device Context
*/
void DrawAuxiliaryAxis( wxDC* DC, int drawmode ); void DrawAuxiliaryAxis( wxDC* DC, int drawmode );
void OnActivate( wxActivateEvent& event ); void OnActivate( wxActivateEvent& event );
/* Mouse and keys events */ /* Mouse and keys events */
......
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canoncical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/cmake"
# The command to remove a file.
RM = "/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E remove -f
# The program to use to edit the cache.
CMAKE_EDIT_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/ccmake"
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/jerry/Repositories/kicad/kicad
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/jerry/Repositories/kicad/kicad
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
"/Applications/CMake 2.8-0.app/Contents/bin/ccmake" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast
# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip
# Special rule for the target install/strip
install/strip/fast: install/strip
.PHONY : install/strip/fast
# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"binary\" \"resources\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
cd /Users/jerry/Repositories/kicad/kicad && $(CMAKE_COMMAND) -E cmake_progress_start /Users/jerry/Repositories/kicad/kicad/CMakeFiles /Users/jerry/Repositories/kicad/kicad/internat/CMakeFiles/progress.marks
cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 internat/all
$(CMAKE_COMMAND) -E cmake_progress_start /Users/jerry/Repositories/kicad/kicad/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 internat/clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 internat/preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 internat/preinstall
.PHONY : preinstall/fast
# clear depends
depend:
cd /Users/jerry/Repositories/kicad/kicad && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... install"
@echo "... install/local"
@echo "... install/strip"
@echo "... list_install_components"
@echo "... rebuild_cache"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
cd /Users/jerry/Repositories/kicad/kicad && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
...@@ -258,19 +258,11 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -258,19 +258,11 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1: case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1:
#if !defined(KICAD_AUIMANAGER) #if !defined(KICAD_AUIMANAGER)
if( m_OptionsToolBar->GetToolState( id ) ) // show aux V toolbar // show auxiliary Vertical toolbar (Microwave tool)
// (Microwave tool) m_AuxVToolBar->Show(m_OptionsToolBar->GetToolState( id ));
ReCreateAuxVToolbar();
else
{
delete m_AuxVToolBar;
m_AuxVToolBar = NULL;
}
{ {
wxSizeEvent SizeEv( GetSize() ); wxSizeEvent SizeEv( GetSize() );
OnSize( SizeEv ); OnSize( SizeEv );
} }
#else #else
......
...@@ -255,7 +255,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -255,7 +255,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
ReCreateVToolbar(); ReCreateVToolbar();
ReCreateOptToolbar(); ReCreateOptToolbar();
if( m_show_microwave_tools )
ReCreateAuxVToolbar(); ReCreateAuxVToolbar();
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
...@@ -303,7 +302,12 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -303,7 +302,12 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update(); m_auimgr.Update();
#else
if( m_AuxVToolBar )
m_AuxVToolBar->Show(m_show_microwave_tools);
#endif #endif
} }
...@@ -416,5 +420,5 @@ void WinEDA_PcbFrame::SaveSettings() ...@@ -416,5 +420,5 @@ void WinEDA_PcbFrame::SaveSettings()
config->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption ); config->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption );
config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption ); config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption );
config->Write( SHOW_MICROWAVE_TOOLS, ( m_AuxVToolBar ) ? true : false ); config->Write( SHOW_MICROWAVE_TOOLS, ( m_AuxVToolBar && m_AuxVToolBar->IsShown() ) ? true : false );
} }
...@@ -275,7 +275,7 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -275,7 +275,7 @@ void WinEDA_PcbFrame::SetToolbars()
#if !defined(KICAD_AUIMANAGER) #if !defined(KICAD_AUIMANAGER)
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
m_AuxVToolBar ? true : false ); (m_AuxVToolBar && m_AuxVToolBar->IsShown()) ? true : false );
#else #else
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
m_auimgr.GetPane(wxT("m_AuxVToolBar")).IsShown() ); m_auimgr.GetPane(wxT("m_AuxVToolBar")).IsShown() );
......
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canoncical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/cmake"
# The command to remove a file.
RM = "/Applications/CMake 2.8-0.app/Contents/bin/cmake" -E remove -f
# The program to use to edit the cache.
CMAKE_EDIT_COMMAND = "/Applications/CMake 2.8-0.app/Contents/bin/ccmake"
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/jerry/Repositories/kicad/kicad
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/jerry/Repositories/kicad/kicad
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
"/Applications/CMake 2.8-0.app/Contents/bin/ccmake" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast
# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip
# Special rule for the target install/strip
install/strip/fast: install/strip
.PHONY : install/strip/fast
# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"binary\" \"resources\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
"/Applications/CMake 2.8-0.app/Contents/bin/cmake" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
cd /Users/jerry/Repositories/kicad/kicad && $(CMAKE_COMMAND) -E cmake_progress_start /Users/jerry/Repositories/kicad/kicad/CMakeFiles /Users/jerry/Repositories/kicad/kicad/template/CMakeFiles/progress.marks
cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 template/all
$(CMAKE_COMMAND) -E cmake_progress_start /Users/jerry/Repositories/kicad/kicad/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 template/clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 template/preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
cd /Users/jerry/Repositories/kicad/kicad && $(MAKE) -f CMakeFiles/Makefile2 template/preinstall
.PHONY : preinstall/fast
# clear depends
depend:
cd /Users/jerry/Repositories/kicad/kicad && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... install"
@echo "... install/local"
@echo "... install/strip"
@echo "... list_install_components"
@echo "... rebuild_cache"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
cd /Users/jerry/Repositories/kicad/kicad && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
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