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
......@@ -346,7 +346,7 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
wxSize clientSize = m_FrameSize;
wxPoint clientPosition;
int default_value = -1;
// Ugly fix for a problem found in recent linux version
// where default value is broken
#ifdef __WXGTK__
......@@ -361,7 +361,7 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
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->Move( 0, 0 );
......@@ -369,28 +369,28 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
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 );
clientSize.x -= m_VToolBar->GetDimension();
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 );
clientSize.x -= m_AuxVToolBar->GetDimension();
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 );
clientSize.x -= m_OptionsToolBar->GetDimension( );
m_OptionsToolBar->Move( 0, clientPosition.y );
clientPosition.x += m_OptionsToolBar->GetDimension( );
clientPosition.x += m_OptionsToolBar->GetDimension( );
}
if( DrawPanel )
{
DrawPanel->SetSize( clientPosition.x, clientPosition.y,
......
......@@ -19,13 +19,13 @@
// Helper class to handle the client Device Context
KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel )
: wxClientDC(aDrawPanel)
KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel* aDrawPanel ) :
wxClientDC( aDrawPanel )
{
GRResetPenAndBrush( this );
SetBackgroundMode( wxTRANSPARENT );
#ifdef WX_ZOOM
double scale = aDrawPanel->GetScreen()->GetScalingFactor();
double scale = aDrawPanel->GetScreen()->GetScalingFactor();
SetUserScale( scale, scale );
wxPoint origin = aDrawPanel->GetScreen()->m_DrawOrg;
SetLogicalOrigin( origin.x, origin.y );
......@@ -33,7 +33,8 @@ KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel )
aDrawPanel->SetBoundaryBox();
}
KicadGraphicContext::~KicadGraphicContext( )
KicadGraphicContext::~KicadGraphicContext()
{
}
......@@ -48,16 +49,16 @@ static bool s_IgnoreNextLeftButtonRelease = false;
// Events used by WinEDA_DrawPanel
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
EVT_MOUSEWHEEL( WinEDA_DrawPanel::OnMouseWheel )
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent )
EVT_PAINT( WinEDA_DrawPanel::OnPaint )
EVT_SIZE( WinEDA_DrawPanel::OnSize )
EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan )
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
EVT_MOUSEWHEEL( WinEDA_DrawPanel::OnMouseWheel )
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent )
EVT_PAINT( WinEDA_DrawPanel::OnPaint )
EVT_SIZE( WinEDA_DrawPanel::OnSize )
EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan )
END_EVENT_TABLE()
/***********************************************************************/
......@@ -69,7 +70,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
wxScrolledWindow( parent, id, pos, size,
wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE )
{
m_Parent = parent;
m_Parent = parent;
wxASSERT( m_Parent );
m_ScrollButt_unit = 40;
......@@ -98,7 +99,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
m_AutoPAN_Request = false;
m_Block_Enable = false;
m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW;
m_CursorLevel = 0;
m_CursorLevel = 0;
m_PrintIsMirrored = false;
}
......@@ -112,6 +113,7 @@ WinEDA_DrawPanel::~WinEDA_DrawPanel()
BASE_SCREEN* WinEDA_DrawPanel::GetScreen()
{
WinEDA_DrawFrame* parentFrame = m_Parent;
return parentFrame->GetBaseScreen();
}
......@@ -191,7 +193,6 @@ wxRealPoint WinEDA_DrawPanel::GetGrid()
}
/** Calculate the cursor position in internal units.
* @return position (in internal units)
* @param ScreenPos = absolute position in pixels
......@@ -310,7 +311,7 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition()
{
#ifdef WX_ZOOM
wxCoord x, y;
INSTALL_DC ( DC, this );
INSTALL_DC( DC, this );
x = DC.LogicalToDeviceX( GetScreen()->m_Curseur.x );
y = DC.LogicalToDeviceY( GetScreen()->m_Curseur.y );
......@@ -332,11 +333,12 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void )
wxSize size;
wxPoint realpos;
size = GetClientSize() / 2;
size = GetClientSize() / 2;
realpos = CalcUnscrolledPosition( wxPoint( size.x, size.y ) );
GetScreen()->Unscale( realpos );
#ifdef WX_ZOOM
// wxCoord x, y;
// INSTALL_DC( DC, this );
// realpos.x = DC.DeviceToLogicalX( realpos.x );
......@@ -537,6 +539,7 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC )
#if wxUSE_GRAPHICS_CONTEXT
// note: wxUSE_GRAPHICS_CONTEXT must be set to 1 in wxWidgets
// see setup.h in wx Widgets.
// wxWidgets configure can need option --enable-graphics_ctx
......@@ -555,16 +558,18 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
#ifdef USE_GCDC_IN_KICAD
wxPaintDC pDC( this );
// 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
paintDC.GetGraphicsContext()->Translate(0.5, 0.5);
paintDC.GetGraphicsContext()->Translate( 0.5, 0.5 );
#else
INSTALL_PAINTDC( paintDC, this );
#endif
EDA_Rect tmp;
wxRect PaintClipBox;
wxPoint org;
EDA_Rect tmp;
wxRect PaintClipBox;
wxPoint org;
tmp = m_ClipBox;
......@@ -575,7 +580,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
// get the union of all rectangles in the update region, 'upd'
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",
PaintClipBox.x,
PaintClipBox.y,
......@@ -590,9 +595,9 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
#ifdef WX_ZOOM
wxLogDebug( wxT( "1) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) " \
"m_ClipBox=(%d, %d, %d, %d)\n" ), PaintClipBox.x,
PaintClipBox.y, PaintClipBox.width, PaintClipBox.height,
org.x, org.y, m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y,
m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
PaintClipBox.y, PaintClipBox.width, PaintClipBox.height,
org.x, org.y, m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y,
m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
wxSize drawing_size = GetScreen()->ReturnPageSize() * 2;
m_ClipBox.m_Pos.x = 0;
......@@ -602,9 +607,9 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
wxLogDebug( wxT( "2) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) " \
"m_ClipBox=(%d, %d, %d, %d)\n" ), PaintClipBox.x,
PaintClipBox.y, PaintClipBox.width, PaintClipBox.height,
org.x, org.y, m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y,
m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
PaintClipBox.y, PaintClipBox.width, PaintClipBox.height,
org.x, org.y, m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y,
m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
#else
PaintClipBox.Offset( org );
m_ClipBox.SetX( PaintClipBox.GetX() );
......@@ -614,9 +619,9 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
#endif
// 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",
PaintClipBox.x,
PaintClipBox.y,
......@@ -686,34 +691,60 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
/** Function DrawBackGround
* @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
* - the grid is drawn only if the zoom level allows a good visibility
* - 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();
int ii, jj, xg, yg, color;
int ii, jj, xg, yg;
wxRealPoint screen_grid_size;
bool drawgrid = false;
wxSize size;
wxPoint org;
color = g_GridColor;
GRSetDrawMode( DC, GR_COPY );
/* The grid must be visible. this is possible only is grid value
* and zoom value are sufficient
*/
drawgrid = m_Parent->m_Draw_Grid;
screen_grid_size = screen->GetGridSize();
wxRealPoint dgrid = screen_grid_size;
wxRealPoint dgrid = screen_grid_size;
screen->Scale( dgrid ); // dgrid = grid size in pixels
// if the grid size is small ( < 5 pixels) do not display all points
if( dgrid.x < 5 )
{
......@@ -721,7 +752,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
dgrid.x *= 2;
}
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 )
{
......@@ -729,7 +760,8 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
dgrid.y *= 2;
}
if( dgrid.y < 5 )
drawgrid = false; // The grid is too small
return; // The grid is too small
GetViewStart( &org.x, &org.y );
GetScrollPixelsPerUnit( &ii, &jj );
......@@ -756,98 +788,105 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
size.SetHeight( DC->DeviceToLogicalYRel( size.GetHeight() ) );
#endif
if( drawgrid )
{
m_Parent->PutOnGrid( &org );
GRSetColorPen( DC, color );
int xpos, ypos;
m_Parent->PutOnGrid( &org );
GRSetColorPen( DC, g_GridColor );
int xpos, ypos;
// Draw grid: the best algorithm depend on the platform.
// under macOSX, the first method is better
// under window, the second method is better
// Under linux, to be tested (could be depend on linux versions
// so perhaps could be necessary to set this option at run time.
// Draw grid: the best algorithm depend on the platform.
// under macOSX, the first method is better
// under window, the second method is better
// Under linux, to be tested (could be depend on linux versions
// so perhaps could be necessary to set this option at run time.
#if 0
// Use a pixel based draw to display grid
// There is a lot of calls, so the cost is hight
// and grid is slowly drawn on some platforms
#if defined ( __WXMAC__ )
wxWindowUpdateLocker(this); // under macOSX: drawings are faster with this
#endif
for( ii = 0; ; ii++ )
{
xg = wxRound(ii * screen_grid_size.x);
if( xg > size.x )
break;
xpos = org.x + xg;
xpos = GRMapX( xpos );
for( jj = 0; ; jj++ )
{
yg = wxRound(jj * screen_grid_size.y);
if( yg > size.y )
break;
ypos = org.y + yg;
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
// 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.
// under MACOSX, is very slow
wxSize screenSize = GetClientSize();
ii = 1;
xg = wxRound(ii * screen_grid_size.x);
int x0pos = GRMapX( org.x + xg);
// Use a pixel based draw to display grid
// There is a lot of calls, so the cost is hight
// and grid is slowly drawn on some platforms
#if defined( __WXMAC__ )
wxWindowUpdateLocker( this ); // under macOSX: drawings are faster with this
#endif
for( ii = 0; ; ii++ )
{
xg = wxRound( ii * screen_grid_size.x );
if( xg > size.x )
break;
xpos = org.x + xg;
xpos = GRMapX( xpos );
for( jj = 0; ; jj++ )
{
yg = wxRound(jj * screen_grid_size.y);
yg = wxRound( jj * screen_grid_size.y );
if( yg > size.y )
break;
ypos = org.y + yg;
DC->DrawPoint( x0pos, GRMapY( ypos ) );
DC->DrawPoint( xpos, GRMapY( ypos ) );
}
ypos = GRMapY(org.y);
for( ii = 2; ; ii++ )
{
xg = wxRound(ii * screen_grid_size.x);
if( xg > size.x )
break;
xpos = GRMapX( org.x + xg );
DC->Blit( xpos, ypos, 1, screenSize.y, DC, x0pos, ypos );
}
#endif
}
/* Draw axis */
if( m_Parent->m_Draw_Axis )
#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
* 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();
int x0pos;
/* skip the grid columns outside the area to redraw
* (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
{
/* Draw the Y axis */
GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
0, screen->ReturnPageSize().y, 0, Color );
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++ )
{
yg = wxRound( jj * screen_grid_size.y );
if( yg > size.y )
break;
ypos = org.y + yg;
DC->DrawPoint( x0pos, GRMapY( ypos ) );
}
/* Draw the X axis */
GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
screen->ReturnPageSize().x, 0, 0, Color );
ypos = GRMapY( org.y );
for( ; ; ii++ )
{
xg = wxRound( ii * screen_grid_size.x );
if( xg > size.x )
break;
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 );
}
DrawAuxiliaryAxis( DC, GR_COPY );
#endif
}
/** m_Draw_Auxiliary_Axis
/** function DrawAuxiliaryAxis
* Draw the Auxiliary Axis, used in pcbnew which as origin coordinates
* for gerber and excellon files
* @param DC = current Device Context
*/
void WinEDA_DrawPanel::DrawAuxiliaryAxis( wxDC* DC, int drawmode )
{
if( !m_Parent->m_Draw_Auxiliary_Axis
|| ( m_Parent->m_Auxiliary_Axis_Position.x == 0
&& m_Parent->m_Auxiliary_Axis_Position.y == 0 ) )
if( m_Parent->m_Auxiliary_Axis_Position == wxPoint( 0, 0 ) )
return;
int Color = DARKRED;
......@@ -910,7 +949,7 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
wxSize size = GetClientSize();
if( ( size.x < event.GetX() ) || ( size.y < event.GetY() )
|| ( event.GetX() <= 0) || ( event.GetY() <= 0 ) )
|| ( event.GetX() <= 0) || ( event.GetY() <= 0 ) )
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this );
......@@ -931,11 +970,11 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
if( m_IgnoreMouseEvents )
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. */
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|| !rect.Contains( event.GetPosition() ) )
|| !rect.Contains( event.GetPosition() ) )
{
#if 0
wxLogDebug( wxT( "OnMouseWheel() position(%d, %d) " ) \
......@@ -963,7 +1002,7 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
else
cmd.SetId( ID_POPUP_ZOOM_IN );
}
else if ( event.GetWheelRotation() < 0 )
else if( event.GetWheelRotation() < 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
cmd.SetId( ID_PAN_DOWN );
......@@ -992,10 +1031,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
*/
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5
/* Count the drag events. Used to filter mouse moves before starting a
* block command. A block command can be started only if MinDragEventCount >
* MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND in order to avoid spurious block
* commands. */
/* Count the drag events. Used to filter mouse moves before starting a
* block command. A block command can be started only if MinDragEventCount >
* MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND in order to avoid spurious block
* commands. */
static int MinDragEventCount;
if( event.Leaving() || event.Entering() )
{
......@@ -1057,7 +1096,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
INSTALL_DC( DC, this );
int kbstat = 0;
int kbstat = 0;
DC.SetBackground( *wxBLACK_BRUSH );
......@@ -1073,7 +1112,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
g_MouseOldButtons = localrealbutt;
// 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 );
......@@ -1104,7 +1143,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
}
if( event.ButtonUp( 2 )
&& (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) )
&& (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) )
{
// The middle button has been released, with no block command:
// We use it for a zoom center at cursor position command
......@@ -1154,7 +1193,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
{
if( ( screen->m_BlockLocate.m_Command == BLOCK_IDLE )
|| ( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) )
|| ( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) )
{
screen->m_BlockLocate.SetOrigin( m_CursorStartPos );
}
......@@ -1168,14 +1207,15 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
}
}
else if( ( m_CanStartBlock >= 0 )
&& ( event.LeftIsDown() || event.MiddleIsDown() )
&& ManageCurseur == NULL
&& ForceCloseManageCurseur == NULL )
&& ( event.LeftIsDown() || event.MiddleIsDown() )
&& ManageCurseur == NULL
&& ForceCloseManageCurseur == NULL )
{
// Mouse is dragging: if no block in progress, start a block
// command.
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ // Start a block command
{
// Start a block command
int cmd_type = kbstat;
if( event.MiddleIsDown() )
......@@ -1218,8 +1258,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
bool BlockIsSmall =
( ABS( screen->Scale( screen->m_BlockLocate.GetWidth() ) )
< BLOCK_MINSIZE_LIMIT)
&& ( ABS( screen->Scale( screen->m_BlockLocate.GetHeight() ) )
< BLOCK_MINSIZE_LIMIT);
&& ( ABS( screen->Scale( screen->m_BlockLocate.GetHeight() ) )
< BLOCK_MINSIZE_LIMIT);
if( (screen->m_BlockLocate.m_State
!= STATE_NO_BLOCK) && BlockIsSmall )
......@@ -1275,8 +1315,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
{
long key, localkey;
bool escape = false;
long key, localkey;
bool escape = false;
wxPoint pos;
key = localkey = event.GetKeyCode();
......@@ -1304,7 +1344,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
if( event.ShiftDown() && (key > 256) )
localkey |= GR_KB_SHIFT;
INSTALL_DC(DC, this );
INSTALL_DC( DC, this );
BASE_SCREEN* Screen = GetScreen();
......@@ -1334,7 +1374,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
#endif
/* Compute absolute mouse position in pixel units (i.e. considering the
current scroll) : */
* current scroll) : */
Screen->m_MousePositionInPixels = pos;
/* Compute absolute mouse position in user units: */
......@@ -1350,7 +1390,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
void WinEDA_DrawPanel::OnPan( wxCommandEvent& event )
{
int x, y;
int x, y;
GetViewStart( &x, &y ); // x and y are in scroll units, not in pixels
......@@ -1374,7 +1414,7 @@ void WinEDA_DrawPanel::OnPan( wxCommandEvent& event )
default:
wxLogDebug( wxT( "Unknown ID %d in WinEDA_DrawPanel::OnPan()." ),
event.GetId() );
event.GetId() );
}
Scroll( x, y );
......
......@@ -97,8 +97,31 @@ public:
int aPrintMask,
bool aPrintMirrorMode,
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 );
/** 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 OnActivate( wxActivateEvent& event );
/* 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,20 +258,12 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1:
#if !defined(KICAD_AUIMANAGER)
if( m_OptionsToolBar->GetToolState( id ) ) // show aux V toolbar
// (Microwave tool)
ReCreateAuxVToolbar();
else
// show auxiliary Vertical toolbar (Microwave tool)
m_AuxVToolBar->Show(m_OptionsToolBar->GetToolState( id ));
{
delete m_AuxVToolBar;
m_AuxVToolBar = NULL;
}
{
wxSizeEvent SizeEv( GetSize() );
OnSize( SizeEv );
wxSizeEvent SizeEv( GetSize() );
OnSize( SizeEv );
}
#else
m_auimgr.GetPane( wxT( "m_AuxVToolBar" ) ).Show( m_OptionsToolBar->GetToolState( id ) );
......
......@@ -255,8 +255,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
ReCreateVToolbar();
ReCreateOptToolbar();
if( m_show_microwave_tools )
ReCreateAuxVToolbar();
ReCreateAuxVToolbar();
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
......@@ -303,7 +302,12 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#else
if( m_AuxVToolBar )
m_AuxVToolBar->Show(m_show_microwave_tools);
#endif
}
......@@ -416,5 +420,5 @@ void WinEDA_PcbFrame::SaveSettings()
config->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption );
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()
#if !defined(KICAD_AUIMANAGER)
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
m_AuxVToolBar ? true : false );
(m_AuxVToolBar && m_AuxVToolBar->IsShown()) ? true : false );
#else
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
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