GerbView rendering bug fix and other minor improvements.

* Fix rendering bug in GerbView caused by wxDC scaling change caused by
  setting the wxDC clipping region.
* Eliminate the need to have optional background erasing as the change
  above fixed that problem as well.
* Default cursor handling improvements.
This commit is contained in:
Wayne Stambaugh 2011-02-08 09:48:38 -05:00
parent a86385bf90
commit e01f89670b
18 changed files with 209 additions and 237 deletions

View File

@ -307,4 +307,5 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
screen->m_BlockLocate.m_Command = BLOCK_IDLE; screen->m_BlockLocate.m_Command = BLOCK_IDLE;
Panel->GetParent()->DisplayToolMsg( wxEmptyString ); Panel->GetParent()->DisplayToolMsg( wxEmptyString );
Panel->SetCursor( Panel->GetDefaultCursor() );
} }

View File

@ -31,8 +31,7 @@ void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event )
if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD ) if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
{ {
if( GetScreen()->IsBlockActive() ) if( GetScreen()->IsBlockActive() )
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = DrawPanel->SetCursor( wxCursor( DrawPanel->GetDefaultCursor() ) );
DrawPanel->m_PanelDefaultCursor ) );
DrawPanel->UnManageCursor(); DrawPanel->UnManageCursor();
} }

View File

@ -388,10 +388,9 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
// Keep default cursor in toolbars // Keep default cursor in toolbars
SetCursor( wxNullCursor ); SetCursor( wxNullCursor );
// Change Cursor in DrawPanel only // Change DrawPanel cursor if requested.
if( DrawPanel ) if( DrawPanel && aCursor >= 0 )
{ {
DrawPanel->m_PanelDefaultCursor = aCursor;
DrawPanel->SetCursor( aCursor ); DrawPanel->SetCursor( aCursor );
} }

View File

@ -58,8 +58,7 @@ END_EVENT_TABLE()
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
const wxPoint& pos, const wxSize& size ) : const wxPoint& pos, const wxSize& size ) :
wxScrolledWindow( parent, id, pos, size, wxScrolledWindow( parent, id, pos, size, wxBORDER | wxHSCROLL | wxVSCROLL )
wxBORDER | wxHSCROLL | wxVSCROLL | wxNO_FULL_REPAINT_ON_RESIZE )
{ {
m_Parent = parent; m_Parent = parent;
wxASSERT( m_Parent ); wxASSERT( m_Parent );
@ -82,7 +81,6 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_AbortEnable = m_AbortRequest = false; m_AbortEnable = m_AbortRequest = false;
m_AutoPAN_Enable = TRUE; m_AutoPAN_Enable = TRUE;
m_IgnoreMouseEvents = 0; m_IgnoreMouseEvents = 0;
m_DisableEraseBG = false;
ManageCurseur = NULL; ManageCurseur = NULL;
ForceCloseManageCurseur = NULL; ForceCloseManageCurseur = NULL;
@ -92,11 +90,11 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
m_Block_Enable = false; m_Block_Enable = false;
m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW; m_defaultCursor = m_cursor = wxCURSOR_ARROW;
m_CursorLevel = 0; m_CursorLevel = 0;
m_PrintIsMirrored = false; m_PrintIsMirrored = false;
wxLog::AddTraceMask( KICAD_TRACE_COORDS ); // wxLog::AddTraceMask( KICAD_TRACE_COORDS );
} }
@ -517,8 +515,7 @@ void EDA_DRAW_PANEL::OnPaint( wxPaintEvent& event )
wxRect region = GetUpdateRegion().GetBox(); wxRect region = GetUpdateRegion().GetBox();
SetClipBox( paintDC, &region ); SetClipBox( paintDC, &region );
wxDCClipper dcclip( paintDC, m_ClipBox ); ReDraw( &paintDC, true );
ReDraw( &paintDC, m_DisableEraseBG ? false : true );
} }
@ -549,8 +546,15 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
GRResetPenAndBrush( DC ); GRResetPenAndBrush( DC );
DC->SetBackground( *wxBLACK_BRUSH ); DC->SetBackground( *wxBLACK_BRUSH );
DC->SetBackgroundMode( wxTRANSPARENT ); DC->SetBackgroundMode( wxSOLID );
m_Parent->RedrawActiveWindow( DC, erasebg ); m_Parent->RedrawActiveWindow( DC, erasebg );
// Verfies that the clipping is working correctly. If these two sets of numbers are
// not the same or really close. The clipping algorithms are broken.
wxLogTrace( KICAD_TRACE_COORDS,
wxT( "Clip box: (%d, %d, %d, %d), Draw extents (%d, %d, %d, %d)" ),
m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
DC->MinX(), DC->MinY(), DC->MaxX(), DC->MaxY() );
} }
@ -1088,7 +1092,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
else else
{ {
m_AutoPAN_Request = TRUE; m_AutoPAN_Request = TRUE;
SetCursor( m_PanelCursor = wxCURSOR_SIZING ); SetCursor( m_cursor = wxCURSOR_SIZING );
} }
} }
} }
@ -1116,18 +1120,18 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
} }
SetCursor( m_PanelCursor = m_PanelDefaultCursor ); SetCursor( m_cursor = m_defaultCursor );
} }
else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END ) else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END )
{ {
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
m_Parent->HandleBlockEnd( &DC ); m_Parent->HandleBlockEnd( &DC );
SetCursor( m_PanelCursor = m_PanelDefaultCursor ); SetCursor( m_cursor = m_defaultCursor );
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE ) if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
{ {
m_AutoPAN_Request = TRUE; m_AutoPAN_Request = TRUE;
SetCursor( m_PanelCursor = wxCURSOR_HAND ); SetCursor( wxCURSOR_HAND );
} }
} }
} }
@ -1163,7 +1167,6 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event ) void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
{ {
long key, localkey; long key, localkey;
bool escape = false;
wxPoint pos; wxPoint pos;
key = localkey = event.GetKeyCode(); key = localkey = event.GetKeyCode();
@ -1180,7 +1183,13 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
return; return;
case WXK_ESCAPE: case WXK_ESCAPE:
escape = m_AbortRequest = TRUE; m_AbortRequest = true;
if( ManageCurseur && ForceCloseManageCurseur )
UnManageCursor( -1, m_defaultCursor );
else
UnManageCursor( 0, m_cursor, wxEmptyString );
break; break;
} }
@ -1204,21 +1213,6 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
g_KeyPressed = localkey; g_KeyPressed = localkey;
if( escape )
{
if( ManageCurseur && ForceCloseManageCurseur )
{
SetCursor( m_PanelCursor = m_PanelDefaultCursor );
ForceCloseManageCurseur( this, &DC );
SetCursor( m_PanelCursor = m_PanelDefaultCursor );
}
else
{
m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW;
m_Parent->SetToolID( 0, m_PanelCursor, wxEmptyString );
}
}
// Some key commands use the current mouse position: refresh it. // Some key commands use the current mouse position: refresh it.
pos = wxGetMousePosition() - GetScreenPosition(); pos = wxGetMousePosition() - GetScreenPosition();
@ -1293,6 +1287,8 @@ void EDA_DRAW_PANEL::UnManageCursor( int id, int cursor, const wxString& title )
{ {
INSTALL_UNBUFFERED_DC( dc, this ); INSTALL_UNBUFFERED_DC( dc, this );
ForceCloseManageCurseur( this, &dc ); ForceCloseManageCurseur( this, &dc );
ManageCurseur = NULL;
ForceCloseManageCurseur = NULL;
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
} }

View File

@ -33,7 +33,7 @@ void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer )
*/ */
INSTALL_DC( dc, DrawPanel ); INSTALL_DC( dc, DrawPanel );
DrawPanel->SetClipBox( dc ); DrawPanel->SetClipBox( dc );
DrawPanel->ReDraw( &dc, DrawPanel->m_DisableEraseBG ? false : true ); DrawPanel->ReDraw( &dc, true );
#else #else
DrawPanel->Refresh(); DrawPanel->Refresh();
DrawPanel->Update(); DrawPanel->Update();

View File

@ -187,7 +187,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
block->ClearItemsList(); block->ClearItemsList();
} }
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
@ -324,7 +324,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
} }
if( zoom_command ) if( zoom_command )
@ -419,7 +419,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: /* Window Zoom */
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC ); DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
DrawPanel->SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor ); DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() );
Window_Zoom( GetScreen()->m_BlockLocate ); Window_Zoom( GetScreen()->m_BlockLocate );
break; break;
@ -489,7 +489,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
} }
} }

View File

@ -184,7 +184,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->Refresh( true ); DrawPanel->Refresh( true );
} }
@ -273,7 +273,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
DrawPanel->Refresh( true ); DrawPanel->Refresh( true );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
} }

View File

@ -134,8 +134,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
default: default:
// Stop the current command and deselect the current tool // Stop the current command and deselect the current tool
DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor = wxCURSOR_ARROW; DrawPanel->UnManageCursor( 0, DrawPanel->GetDefaultCursor() );
DrawPanel->UnManageCursor( 0, DrawPanel->m_PanelCursor );
break; break;
} }
@ -794,8 +793,7 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
if( screen->IsBlockActive() ) if( screen->IsBlockActive() )
{ {
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = DrawPanel->SetCursor( wxCursor( DrawPanel->GetDefaultCursor() ) );
DrawPanel->m_PanelDefaultCursor ) );
screen->ClearBlockCommand(); screen->ClearBlockCommand();
// Stop the current command (if any) but keep the current tool // Stop the current command (if any) but keep the current tool

View File

@ -64,12 +64,9 @@ void WinEDA_GerberFrame::PrintPage( wxDC* aDC, int aPrintMasklayer,
} }
/*******************************************************************/
void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*******************************************************************/
/* Redraws the full screen, including axis and grid /* Redraws the full screen, including axis and grid
*/ */
void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{ {
PCB_SCREEN* screen = (PCB_SCREEN*) GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) GetScreen();
@ -78,8 +75,6 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
wxBusyCursor dummy; wxBusyCursor dummy;
GRSetDrawMode( DC, GR_COPY );
int drawMode = -1; int drawMode = -1;
switch ( GetDisplayMode() ) switch ( GetDisplayMode() )
@ -96,9 +91,9 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
drawMode = GR_OR; drawMode = GR_OR;
break; break;
} }
GetBoard()->Draw( DrawPanel, DC,
drawMode, // this needs to be GR_COPY or GR_OR, set from a toggle button. // Draw according to the current setting. This needs to be GR_COPY or GR_OR.
wxPoint( 0, 0 ) ); GetBoard()->Draw( DrawPanel, DC, drawMode, wxPoint( 0, 0 ) );
// Draw the "background" now, i.e. grid and axis after gerber layers // Draw the "background" now, i.e. grid and axis after gerber layers
// because most of time the actual background is erased by succesive drawings of each gerber // because most of time the actual background is erased by succesive drawings of each gerber
@ -146,20 +141,12 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
aDC->GetDeviceOrigin( &dev_org.x, &dev_org.y ); aDC->GetDeviceOrigin( &dev_org.x, &dev_org.y );
aDC->GetLogicalOrigin( &logical_org.x, &logical_org.y ); aDC->GetLogicalOrigin( &logical_org.x, &logical_org.y );
aDC->GetUserScale( &dc_scalex, &dc_scaley ); aDC->GetUserScale( &dc_scalex, &dc_scaley );
if( aDrawMode != -1 )
{
aDC->SetUserScale( 1.0, 1.0 );
aDC->SetDeviceOrigin( 0, 0 );
aDC->SetLogicalOrigin( 0, 0 );
}
#endif #endif
aPanel->GetClientSize( &bitmapWidth, &bitmapHeight ); aPanel->GetClientSize( &bitmapWidth, &bitmapHeight );
wxBitmap* layerBitmap = NULL; wxBitmap* layerBitmap;
wxBitmap* screenBitmap = NULL; wxBitmap* screenBitmap;
wxMemoryDC layerDC; // used sequentially for each gerber layer wxMemoryDC layerDC; // used sequentially for each gerber layer
wxMemoryDC screenDC; wxMemoryDC screenDC;
@ -168,24 +155,27 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
layerBitmap = new wxBitmap( bitmapWidth, bitmapHeight ); layerBitmap = new wxBitmap( bitmapWidth, bitmapHeight );
screenBitmap = new wxBitmap( bitmapWidth, bitmapHeight ); screenBitmap = new wxBitmap( bitmapWidth, bitmapHeight );
layerDC.SelectObject( *layerBitmap ); layerDC.SelectObject( *layerBitmap );
aPanel->DoPrepareDC( layerDC );
layerDC.SetBackground( bgBrush ); layerDC.SetBackground( bgBrush );
layerDC.SetBackgroundMode( wxSOLID );
layerDC.Clear(); layerDC.Clear();
aPanel->DrawBackGround( &layerDC );
screenDC.SelectObject( *screenBitmap ); screenDC.SelectObject( *screenBitmap );
screenDC.SetBackground( bgBrush ); screenDC.SetBackground( bgBrush );
screenDC.SetBackgroundMode( wxSOLID );
screenDC.Clear(); screenDC.Clear();
aPanel->DoPrepareDC(layerDC);
aPanel->DrawBackGround( &layerDC );
plotDC = &layerDC;
} }
bool doBlit = false; // this flag requests an image transfert to actual screen when true. bool doBlit = false; // this flag requests an image transfert to actual screen when true.
for( int layer = 0; layer < 32; layer++ ) for( int layer = 0; layer < 32; layer++ )
{ {
if( !GetBoard()->IsLayerVisible( layer ) ) if( !GetBoard()->IsLayerVisible( layer ) )
continue; continue;
GERBER_IMAGE* gerber = g_GERBER_List[layer]; GERBER_IMAGE* gerber = g_GERBER_List[layer];
if( gerber == NULL ) // Graphic layer not yet used if( gerber == NULL ) // Graphic layer not yet used
continue; continue;
@ -193,10 +183,9 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
{ {
// Draw each layer into a bitmap first. Negative Gerber // Draw each layer into a bitmap first. Negative Gerber
// layers are drawn in background color. // layers are drawn in background color.
if( gerber->HasNegativeItems() ) if( gerber->HasNegativeItems() && doBlit )
{
if( doBlit )
{ {
#if AVOID_BLIT_SCALE_BUG #if AVOID_BLIT_SCALE_BUG
layerDC.SetUserScale( 1.0, 1.0 ); layerDC.SetUserScale( 1.0, 1.0 );
layerDC.SetDeviceOrigin( 0, 0 ); layerDC.SetDeviceOrigin( 0, 0 );
@ -204,36 +193,36 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
#endif #endif
if( aDrawMode == GR_COPY ) if( aDrawMode == GR_COPY )
{ {
// Use the layer bitmap itself as a mask when blitting. // Use the layer bitmap itself as a mask when blitting. The bitmap
// The bitmap cannot be referenced by a device context // cannot be referenced by a device context when setting the mask.
// when setting the mask.
layerDC.SelectObject( wxNullBitmap ); layerDC.SelectObject( wxNullBitmap );
layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor ) ); layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor ) );
layerDC.SelectObject( *layerBitmap ); layerDC.SelectObject( *layerBitmap );
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxCOPY, true ); screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxCOPY, true );
} }
else if( aDrawMode == GR_OR ) else if( aDrawMode == GR_OR )
{ {
// On Linux with a large screen, this version is much faster and without flicker, // On Linux with a large screen, this version is much faster and without
// but gives a PCBNEW look where layer colors blend together. Plus it works // flicker, but gives a PCBNEW look where layer colors blend together.
// only because the background color is black. But it may be more useable for some. // Plus it works only because the background color is black. But it may
// The difference is due in part because of the cpu cycles needed to create the // be more useable for some. The difference is due in part because of
// monochromatic bitmap above, and the extra time needed to do bit indexing // the cpu cycles needed to create the monochromatic bitmap above, and
// into the monochromatic bitmap on the blit above. // the extra time needed to do bit indexing into the monochromatic bitmap
// on the blit above.
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxOR ); screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxOR );
} }
} }
doBlit = false; doBlit = false;
layerDC.Clear(); layerDC.Clear();
} }
}
#if AVOID_BLIT_SCALE_BUG #if AVOID_BLIT_SCALE_BUG
layerDC.SetUserScale( dc_scalex, dc_scaley ); layerDC.SetUserScale( dc_scalex, dc_scaley );
layerDC.SetDeviceOrigin( dev_org.x, dev_org.y ); layerDC.SetDeviceOrigin( dev_org.x, dev_org.y );
layerDC.SetLogicalOrigin( logical_org.x, logical_org.y ); layerDC.SetLogicalOrigin( logical_org.x, logical_org.y );
#endif #endif
if( gerber->m_ImageNegative ) if( gerber->m_ImageNegative )
{ {
// Draw background negative (i.e. in graphic layer color) for negative images. // Draw background negative (i.e. in graphic layer color) for negative images.
@ -252,32 +241,37 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
} }
int dcode_highlight = 0; int dcode_highlight = 0;
if( layer == m_PcbFrame->GetScreen()->m_Active_Layer ) if( layer == m_PcbFrame->GetScreen()->m_Active_Layer )
dcode_highlight = gerber->m_Selected_Tool; dcode_highlight = gerber->m_Selected_Tool;
int layerdrawMode = GR_COPY; int layerdrawMode = GR_COPY;
if( aDrawMode == GR_OR && !gerber->HasNegativeItems() ) if( aDrawMode == GR_OR && !gerber->HasNegativeItems() )
layerdrawMode = GR_OR; layerdrawMode = GR_OR;
for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = item->Next() )
{ {
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item; GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer() != layer ) if( gerb_item->GetLayer() != layer )
continue; continue;
int drawMode = layerdrawMode; int drawMode = layerdrawMode;
if( dcode_highlight && dcode_highlight == gerb_item->m_DCode ) if( dcode_highlight && dcode_highlight == gerb_item->m_DCode )
drawMode |= GR_SURBRILL; drawMode |= GR_SURBRILL;
gerb_item->Draw( aPanel, plotDC, drawMode ); gerb_item->Draw( aPanel, plotDC, drawMode );
doBlit = true; doBlit = true;
} }
} }
if( doBlit && aDrawMode != -1 ) // Blit is used only if aDrawMode >= 0 if( doBlit && aDrawMode != -1 ) // Blit is used only if aDrawMode >= 0
{ {
// this is the last transfert to screenDC // this is the last transfert to screenDC. If there are no negative items, this is
// If there are no negative items, this is the only one // the only one
#if AVOID_BLIT_SCALE_BUG #if AVOID_BLIT_SCALE_BUG
if( aDrawMode != -1 ) if( aDrawMode != -1 )
{ {
@ -290,25 +284,28 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
{ {
layerDC.SelectObject( wxNullBitmap ); layerDC.SelectObject( wxNullBitmap );
layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor ) ); layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor ) );
layerDC.SelectObject( *layerBitmap ); layerDC.SelectObject( *layerBitmap );
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxCOPY, true ); screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxCOPY, true );
} }
else if( aDrawMode == GR_OR ) else if( aDrawMode == GR_OR )
{
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxOR, false ); screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxOR, false );
} }
}
if( aDrawMode != -1 ) if( aDrawMode != -1 )
{ {
aDC->Blit( 0, 0, bitmapWidth, bitmapHeight, &screenDC, 0, 0, wxCOPY ); aDC->Blit( 0, 0, bitmapWidth, bitmapHeight, &screenDC, 0, 0, wxCOPY );
#if AVOID_BLIT_SCALE_BUG #if AVOID_BLIT_SCALE_BUG
// Restore scale and offsets values: // Restore scale and offsets values:
aDC->SetUserScale( dc_scalex, dc_scaley ); aDC->SetUserScale( dc_scalex, dc_scaley );
aDC->SetDeviceOrigin( dev_org.x, dev_org.y ); aDC->SetDeviceOrigin( dev_org.x, dev_org.y );
aDC->SetLogicalOrigin( logical_org.x, logical_org.y ); aDC->SetLogicalOrigin( logical_org.x, logical_org.y );
#endif #endif
layerDC.SelectObject( wxNullBitmap );
screenDC.SelectObject( wxNullBitmap );
delete layerBitmap; delete layerBitmap;
delete screenBitmap; delete screenBitmap;
} }
@ -328,11 +325,14 @@ void WinEDA_GerberFrame::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item; GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( GetBoard()->IsLayerVisible( gerb_item->GetLayer() ) == false ) if( GetBoard()->IsLayerVisible( gerb_item->GetLayer() ) == false )
continue; continue;
if( gerb_item->m_DCode <= 0 ) if( gerb_item->m_DCode <= 0 )
continue; continue;
@ -354,6 +354,7 @@ void WinEDA_GerberFrame::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
width = MIN( gerb_item->m_Size.x, gerb_item->m_Size.y ); width = MIN( gerb_item->m_Size.x, gerb_item->m_Size.y );
orient = TEXT_ORIENT_HORIZ; orient = TEXT_ORIENT_HORIZ;
if( gerb_item->m_Flashed ) if( gerb_item->m_Flashed )
{ {
// A reasonnable size for text is width/3 because most of time this text has 3 chars. // A reasonnable size for text is width/3 because most of time this text has 3 chars.
@ -362,6 +363,7 @@ void WinEDA_GerberFrame::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
else // this item is a line else // this item is a line
{ {
wxPoint delta = gerb_item->m_Start - gerb_item->m_End; wxPoint delta = gerb_item->m_Start - gerb_item->m_End;
if( abs( delta.x ) < abs( delta.y ) ) if( abs( delta.x ) < abs( delta.y ) )
orient = TEXT_ORIENT_VERT; orient = TEXT_ORIENT_VERT;
// A reasonnable size for text is width/2 because text needs margin below and above it. // A reasonnable size for text is width/2 because text needs margin below and above it.
@ -371,8 +373,7 @@ void WinEDA_GerberFrame::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
int color = g_ColorsSettings.GetItemColor( DCODES_VISIBLE ); int color = g_ColorsSettings.GetItemColor( DCODES_VISIBLE );
DrawGraphicText( DrawPanel, aDC, DrawGraphicText( DrawPanel, aDC, pos, (EDA_Colors) color, Line,
pos, (EDA_Colors) color, Line,
orient, wxSize( width, width ), orient, wxSize( width, width ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
0, false, false ); 0, false, false );

View File

@ -108,7 +108,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
SetToolID( 0, 0, wxEmptyString ); SetToolID( 0, 0, wxEmptyString );
else else
DrawPanel->SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor ); DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() );
break; break;
default: default:

View File

@ -175,7 +175,7 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
} }
} }
Zoom_Automatique( false ); Zoom_Automatique( true );
GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq();
g_SaveTime = time( NULL ); g_SaveTime = time( NULL );

View File

@ -42,18 +42,15 @@ EVT_MENU( wxID_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io ) EVT_MENU( ID_MENU_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io ) EVT_MENU( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_GEN_PLOT, WinEDA_GerberFrame::ToPlotter ) EVT_MENU( ID_GEN_PLOT, WinEDA_GerberFrame::ToPlotter )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, WinEDA_GerberFrame::ExportDataInPcbnewFormat )
WinEDA_GerberFrame::ExportDataInPcbnewFormat )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_GerberFrame::OnFileHistory ) EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_GerberFrame::OnFileHistory )
EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions )
// menu Preferences // menu Preferences
EVT_MENU( ID_CONFIG_REQ, EVT_MENU( ID_CONFIG_REQ, WinEDA_GerberFrame::Process_Config )
WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_CONFIG_SAVE, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_CONFIG_SAVE,
WinEDA_GerberFrame::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START,
ID_PREFERENCES_HOTKEY_END, ID_PREFERENCES_HOTKEY_END,
WinEDA_GerberFrame::Process_Config ) WinEDA_GerberFrame::Process_Config )
@ -62,21 +59,15 @@ EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_MENU( ID_GERBVIEW_OPTIONS_SETUP, WinEDA_GerberFrame::InstallGerberOptionsDialog ) EVT_MENU( ID_GERBVIEW_OPTIONS_SETUP, WinEDA_GerberFrame::InstallGerberOptionsDialog )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EDA_DRAW_FRAME::SetLanguage )
EDA_DRAW_FRAME::SetLanguage )
// menu Postprocess // menu Postprocess
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, WinEDA_GerberFrame::Process_Special_Functions )
WinEDA_GerberFrame::Process_Special_Functions ) EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, WinEDA_GerberFrame::Process_Special_Functions )
WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE,
WinEDA_GerberFrame::Process_Special_Functions )
// menu Miscellaneous // menu Miscellaneous
EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE, EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE, WinEDA_GerberFrame::Process_Special_Functions )
WinEDA_GerberFrame::Process_Special_Functions )
// Menu Help // Menu Help
EVT_MENU( ID_GENERAL_HELP, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( ID_GENERAL_HELP, EDA_DRAW_FRAME::GetKicadHelp )
@ -96,33 +87,25 @@ EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_TOOL,
// Vertical toolbar: // Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT, EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
// Pop up menu // Pop up menu
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
WinEDA_GerberFrame::Process_Special_Functions )
// Option toolbar // Option toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, WinEDA_GerberFrame::OnSelectOptionToolbar )
WinEDA_GerberFrame::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH,
WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, WinEDA_GerberFrame::OnSelectOptionToolbar )
WinEDA_GerberFrame::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_0, WinEDA_GerberFrame::OnSelectDisplayMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_0, EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_1, WinEDA_GerberFrame::OnSelectDisplayMode )
WinEDA_GerberFrame::OnSelectDisplayMode ) EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_2, WinEDA_GerberFrame::OnSelectDisplayMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_1,
WinEDA_GerberFrame::OnSelectDisplayMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_2,
WinEDA_GerberFrame::OnSelectDisplayMode )
END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
const wxString& title, const wxString& title,
@ -171,13 +154,9 @@ END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father
LoadSettings(); LoadSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
if( GetDisplayMode() == 1 || GetDisplayMode() == 2 )
DrawPanel->m_DisableEraseBG = true;
ReCreateMenuBar(); ReCreateMenuBar();
ReCreateHToolbar(); ReCreateHToolbar();
// ReCreateVToolbar(); // Currently: no right vertical toolbar
ReCreateOptToolbar(); ReCreateOptToolbar();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
@ -256,6 +235,7 @@ int WinEDA_GerberFrame::BestZoom()
EDA_Rect bbox; EDA_Rect bbox;
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;
bbox = ( (GERBER_DRAW_ITEM*) item )->GetBoundingBox();
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {
@ -263,11 +243,10 @@ int WinEDA_GerberFrame::BestZoom()
bbox.Merge( gerb_item->GetBoundingBox() ); bbox.Merge( gerb_item->GetBoundingBox() );
} }
bbox.Inflate( wxRound( GetScreen()->GetGridSize().x * 2 ),
wxRound( GetScreen()->GetGridSize().y * 2 ) );
wxSize size = DrawPanel->GetClientSize(); wxSize size = DrawPanel->GetClientSize();
x = bbox.GetWidth() / (double) size.x;
y = bbox.GetHeight() / (double) size.y; x = (double) bbox.GetWidth() / (double) size.x;
y = (double) bbox.GetHeight() / (double) size.y;
GetScreen()->m_Curseur = bbox.Centre(); GetScreen()->m_Curseur = bbox.Centre();
int best_zoom = wxRound( MAX( x, y ) * (double) GetScreen()->m_ZoomScalar ); int best_zoom = wxRound( MAX( x, y ) * (double) GetScreen()->m_ZoomScalar );
@ -433,13 +412,16 @@ void WinEDA_GerberFrame::syncLayerBox()
m_SelLayerBox->SetSelection( getActiveLayer() ); m_SelLayerBox->SetSelection( getActiveLayer() );
int dcodeSelected = -1; int dcodeSelected = -1;
GERBER_IMAGE* gerber = g_GERBER_List[getActiveLayer()]; GERBER_IMAGE* gerber = g_GERBER_List[getActiveLayer()];
if( gerber ) if( gerber )
dcodeSelected = gerber->m_Selected_Tool; dcodeSelected = gerber->m_Selected_Tool;
if( m_DCodeSelector ) if( m_DCodeSelector )
{ {
m_DCodeSelector->SetDCodeSelection( dcodeSelected ); m_DCodeSelector->SetDCodeSelection( dcodeSelected );
m_DCodeSelector->Enable( gerber != NULL ); m_DCodeSelector->Enable( gerber != NULL );
} }
UpdateTitleAndInfo(); UpdateTitleAndInfo();
} }
@ -586,21 +568,19 @@ void WinEDA_GerberFrame::OnSelectDisplayMode( wxCommandEvent& event )
{ {
case ID_TB_OPTIONS_SHOW_GBR_MODE_0: case ID_TB_OPTIONS_SHOW_GBR_MODE_0:
SetDisplayMode( 0 ); SetDisplayMode( 0 );
DrawPanel->m_DisableEraseBG = false;
break; break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_1: case ID_TB_OPTIONS_SHOW_GBR_MODE_1:
SetDisplayMode( 1 ); SetDisplayMode( 1 );
DrawPanel->m_DisableEraseBG = true;
break; break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_2: case ID_TB_OPTIONS_SHOW_GBR_MODE_2:
SetDisplayMode( 2 ); SetDisplayMode( 2 );
DrawPanel->m_DisableEraseBG = true;
break; break;
} }
SetToolbars(); SetToolbars();
if( GetDisplayMode() != oldMode ) if( GetDisplayMode() != oldMode )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }

View File

@ -19,6 +19,8 @@ class EDA_DRAW_PANEL : public wxScrolledWindow
{ {
private: private:
EDA_DRAW_FRAME* m_Parent; EDA_DRAW_FRAME* m_Parent;
int m_cursor; ///< Current mouse cursor shape id.
int m_defaultCursor; ///< The default mouse cursor shape id.
public: public:
EDA_Rect m_ClipBox; // the clipbox used in screen EDA_Rect m_ClipBox; // the clipbox used in screen
@ -35,10 +37,6 @@ public:
bool m_AbortEnable; // TRUE if abort button or menu to bool m_AbortEnable; // TRUE if abort button or menu to
// be displayed // be displayed
bool m_DisableEraseBG; // if true: do not allow background erasure
// (used to reduce flicker in Gerbview )
bool m_AutoPAN_Enable; // TRUE to allow auto pan bool m_AutoPAN_Enable; // TRUE to allow auto pan
bool m_AutoPAN_Request; // TRUE to request an auto pan bool m_AutoPAN_Request; // TRUE to request an auto pan
// (will be made only if // (will be made only if
@ -57,10 +55,6 @@ public:
// because arcs are oriented, and // because arcs are oriented, and
// in mirror mode, orientations are // in mirror mode, orientations are
// reversed // reversed
int m_PanelDefaultCursor; // Current mouse cursor default
// shape id for this window
int m_PanelCursor; // Current mouse cursor shape id
// for this window
int m_CursorLevel; // Index for cursor redraw in XOR int m_CursorLevel; // Index for cursor redraw in XOR
// mode // mode
@ -190,7 +184,10 @@ public:
* <p> * <p>
* If \a aRect is NULL, then the entire visible area of the screen is used as the clip * If \a aRect is NULL, then the entire visible area of the screen is used as the clip
* area. The clip box is used when drawing to determine which objects are not visible * area. The clip box is used when drawing to determine which objects are not visible
* and do not need to be drawn. * and do not need to be drawn. Note that this is not the same as setting the device
* context clipping with wxDC::SetClippingRegion(). This is the rectangle used by the
* drawing functions in gr_basic.cpp used to determine if the item to draw is off screen
* and therefore not drawn.
* </p> * </p>
* @param aDC The device context use for drawing with the correct scale and * @param aDC The device context use for drawing with the correct scale and
* offsets already configured. See DoPrepareDC(). * offsets already configured. See DoPrepareDC().
@ -255,17 +252,25 @@ public:
// remove the grid cursor from the display // remove the grid cursor from the display
void CursorOff( wxDC* DC ); void CursorOff( wxDC* DC );
// display the grid cursor // display the grid cursor
void CursorOn( wxDC* DC ); void CursorOn( wxDC* DC );
/** /**
* Release managed cursor. * Release managed cursor.
* *
* Check to see if the cursor is being managed for block or editing * Check to see if the cursor is being managed for block or editing commands and release it.
* commands and release it. * @param aId The command ID to restore or -1 to keep the current command ID.
* @param aCursorId The wxWidgets stock cursor ID to set the cursor to or -1 to keep the
* current cursor.
* @param aTitle The tool message to display in the status bar or wxEmptyString to clear
* the message.
*/ */
void UnManageCursor( int id = -1, int cursor = -1, void UnManageCursor( int aId = -1, int aCursorId = -1,
const wxString& title = wxEmptyString ); const wxString& aTitle = wxEmptyString );
int GetDefaultCursor() const { return m_defaultCursor; }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -98,7 +98,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
break; break;
default: // Abort a current command (if any) default: // Abort a current command (if any)
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->UnManageCursor( 0, DrawPanel->GetDefaultCursor() );
break; break;
} }

View File

@ -93,12 +93,9 @@ static bool InstallBlockCmdFrame( WinEDA_BasePcbFrame* parent, const wxString& t
nocmd = dlg.ShowModal(); nocmd = dlg.ShowModal();
parent->GetScreen()->m_Curseur = oldpos; parent->GetScreen()->m_Curseur = oldpos;
parent->DrawPanel->MouseToCursorSchema(); parent->DrawPanel->MouseToCursorSchema();
parent->DrawPanel->m_IgnoreMouseEvents = false; parent->DrawPanel->m_IgnoreMouseEvents = false;
parent->DrawPanel->SetCursor( parent->DrawPanel->GetDefaultCursor() );
parent->DrawPanel->SetCursor( parent->DrawPanel->m_PanelCursor =
parent->DrawPanel->m_PanelDefaultCursor );
return nocmd ? false : true; return nocmd ? false : true;
} }
@ -255,8 +252,7 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
} }
DisplayToolMsg( wxEmptyString ); DisplayToolMsg( wxEmptyString );
DrawPanel->SetCursor( DrawPanel->m_PanelCursor = DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() );
DrawPanel->m_PanelDefaultCursor );
} }

View File

@ -195,8 +195,7 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
wxEmptyString );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
@ -281,9 +280,7 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
SetToolID( m_ID_current_state, SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->m_PanelDefaultCursor,
wxEmptyString );
} }

View File

@ -133,7 +133,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
else else
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor ); SetCursor( DrawPanel->GetDefaultCursor() );
break; break;
default: // Finish (abort) the command default: // Finish (abort) the command

View File

@ -27,7 +27,7 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
if( fn != wxEmptyString ) if( fn != wxEmptyString )
{ {
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->UnManageCursor( 0, DrawPanel->GetDefaultCursor() );
::wxSetWorkingDirectory( ::wxPathOnly( fn ) ); ::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
LoadOnePcbFile( fn ); LoadOnePcbFile( fn );
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
@ -45,7 +45,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
wxString msg; wxString msg;
// If an edition is in progress, stop it // If an edition is in progress, stop it
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->UnManageCursor( 0, DrawPanel->GetDefaultCursor() );
switch( id ) switch( id )
{ {