Start the process of removing the legacy draw panel.

This commit is contained in:
Jeff Young 2019-05-30 10:16:05 +01:00
parent 4842c73530
commit edc8438ef0
46 changed files with 112 additions and 1475 deletions

View File

@ -46,7 +46,7 @@ void EDA_DOCKART::DrawBorder( wxDC& aDC, wxWindow* aWindow, const wxRect& aRect,
{ {
art->DrawBorder( aDC, aWindow, r ); art->DrawBorder( aDC, aWindow, r );
} }
else if( aPane.name == "DrawFrame" || aPane.name == "DrawFrameGal" ) else if( aPane.name == "DrawFrame" )
{ {
// We don't want to re-write the layout manager, so we give the canvas a single-pixel // We don't want to re-write the layout manager, so we give the canvas a single-pixel
// border and then fill in the top and left with the canvas background colour. // border and then fill in the top and left with the canvas background colour.

View File

@ -237,7 +237,8 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
{ {
EDA_BASE_FRAME::CommonSettingsChanged(); EDA_BASE_FRAME::CommonSettingsChanged();
wxConfigBase* settings = Pgm().CommonSettings(); wxConfigBase* settings = Pgm().CommonSettings();
KIGFX::VIEW_CONTROLS* viewControls = GetGalCanvas()->GetViewControls();
int autosaveInterval; int autosaveInterval;
settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval ); settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval );
@ -249,13 +250,13 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
bool option; bool option;
settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option ); settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option );
m_canvas->SetEnableMousewheelPan( option ); viewControls->EnableMousewheelPan( option );
settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option ); settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option );
m_canvas->SetEnableZoomNoCenter( option ); viewControls->EnableCursorWarping( !option );
settings->Read( ENBL_AUTO_PAN_KEY, &option ); settings->Read( ENBL_AUTO_PAN_KEY, &option );
m_canvas->SetEnableAutoPan( option ); viewControls->EnableAutoPan( option );
m_galDisplayOptions.ReadCommonConfig( *settings, this ); m_galDisplayOptions.ReadCommonConfig( *settings, this );
} }
@ -392,12 +393,6 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
} }
double EDA_DRAW_FRAME::GetZoom()
{
return GetScreen()->GetZoom();
}
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg ) void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
{ {
m_toolMsg = msg; m_toolMsg = msg;
@ -582,26 +577,10 @@ void EDA_DRAW_FRAME::UpdateMsgPanel()
} }
// FIXME: There needs to be a better way for child windows to load preferences.
// This function pushes four preferences from a parent window to a child window
// i.e. from eeschema to the schematic symbol editor
void EDA_DRAW_FRAME::PushPreferences( const EDA_DRAW_PANEL* aParentCanvas )
{
m_canvas->SetEnableZoomNoCenter( aParentCanvas->GetEnableZoomNoCenter() );
m_canvas->SetEnableAutoPan( aParentCanvas->GetEnableAutoPan() );
}
void EDA_DRAW_FRAME::UseGalCanvas() void EDA_DRAW_FRAME::UseGalCanvas()
{ {
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas(); EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
// Display the same view after canvas switching
KIGFX::VIEW_CONTROLS* viewControls = galCanvas->GetViewControls();
viewControls->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() );
galCanvas->SetEvtHandlerEnabled( true ); galCanvas->SetEvtHandlerEnabled( true );
galCanvas->StartDrawing(); galCanvas->StartDrawing();
@ -752,12 +731,6 @@ void EDA_DRAW_FRAME::SetScrollCenterPosition( const wxPoint& aPoint )
//-----</BASE_SCREEN API moved here >-------------------------------------------- //-----</BASE_SCREEN API moved here >--------------------------------------------
void EDA_DRAW_FRAME::RefreshCrossHair( const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC* aDC )
{
wxFAIL_MSG( "Obsolete; use CallMouseCapture() directly" );
}
bool EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid ) bool EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid )
{ {
bool key_handled = false; bool key_handled = false;
@ -884,12 +857,6 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
} }
void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
{
wxFAIL_MSG( "Obsolete! Should go through COMMON_TOOLS." );
}
// Find the first child dialog. // Find the first child dialog.
wxWindow* findDialog( wxWindowList& aList ) wxWindow* findDialog( wxWindowList& aList )
{ {

View File

@ -253,7 +253,8 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
{ {
EDA_BASE_FRAME::CommonSettingsChanged(); EDA_BASE_FRAME::CommonSettingsChanged();
wxConfigBase* settings = Pgm().CommonSettings(); wxConfigBase* settings = Pgm().CommonSettings();
KIGFX::VIEW_CONTROLS* viewControls = GetGalCanvas()->GetViewControls();
int autosaveInterval; int autosaveInterval;
settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval ); settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval );
@ -265,13 +266,13 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
bool option; bool option;
settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option ); settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option );
m_canvas->SetEnableMousewheelPan( option ); viewControls->EnableMousewheelPan( option );
settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option ); settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option );
m_canvas->SetEnableZoomNoCenter( option ); viewControls->EnableCursorWarping( !option );
settings->Read( ENBL_AUTO_PAN_KEY, &option ); settings->Read( ENBL_AUTO_PAN_KEY, &option );
m_canvas->SetEnableAutoPan( option ); viewControls->EnableAutoPan( option );
m_galDisplayOptions.ReadCommonConfig( *settings, this ); m_galDisplayOptions.ReadCommonConfig( *settings, this );
} }
@ -396,68 +397,40 @@ void EDA_DRAW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMod
void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event ) void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
{ {
int* clientData; wxCHECK_RET( m_gridSelectBox, "m_gridSelectBox uninitialized" );
int eventId = ID_POPUP_GRID_LEVEL_100;
if( event.GetEventType() == wxEVT_CHOICE ) int id = m_gridSelectBox->GetCurrentSelection() + ID_POPUP_GRID_FIRST;
if( id == ID_POPUP_GRID_SEPARATOR )
{ {
if( m_gridSelectBox == NULL ) // Should not happen // wxWidgets will check the separator, which we don't want.
return; // Re-check the current grid.
wxUpdateUIEvent dummy;
/* OnUpdateSelectGrid( dummy );
* Don't use wxCommandEvent::GetClientData() here. It always
* returns NULL in GTK. This solution is not as elegant but
* it works.
*/
int index = m_gridSelectBox->GetSelection();
wxASSERT( index != wxNOT_FOUND );
// GerbView does not support custom grid
if( m_Ident != FRAME_GERBER )
{
if( index == int( m_gridSelectBox->GetCount() - 2 ) )
{
// this is the separator
wxUpdateUIEvent dummy;
OnUpdateSelectGrid( dummy );
return;
}
else if( index == int( m_gridSelectBox->GetCount() - 1 ) )
{
wxUpdateUIEvent dummy;
OnUpdateSelectGrid( dummy );
wxCommandEvent dummy2;
OnGridSettings( dummy2 );
return;
}
}
clientData = (int*) m_gridSelectBox->wxItemContainer::GetClientData( index );
if( clientData != NULL )
eventId = *clientData;
} }
else else if( id == ID_POPUP_GRID_SETTINGS )
{ {
eventId = event.GetId(); // wxWidgets will check the Grid Settings... entry, which we don't want.
// R-check the current grid.
wxUpdateUIEvent dummy;
OnUpdateSelectGrid( dummy );
// Now run the Grid Settings... dialog
wxCommandEvent dummy2;
OnGridSettings( dummy2 );
}
else if( id >= ID_POPUP_GRID_FIRST && id < ID_POPUP_GRID_SEPARATOR )
{
m_toolManager->RunAction( ACTIONS::gridPreset, true, id );
} }
int idx = eventId - ID_POPUP_GRID_LEVEL_1000; UpdateStatusBar();
m_galCanvas->Refresh();
// Notify GAL
TOOL_MANAGER* mgr = GetToolManager();
if( mgr )
mgr->RunAction( "common.Control.gridPreset", true, idx );
m_canvas->Refresh();
} }
void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event ) void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
{ {
if( m_zoomSelectBox == NULL ) wxCHECK_RET( m_zoomSelectBox, "m_zoomSelectBox uninitialized" );
return; // Should not happen!
int id = m_zoomSelectBox->GetCurrentSelection(); int id = m_zoomSelectBox->GetCurrentSelection();
@ -534,13 +507,7 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
void EDA_DRAW_FRAME::SetNoToolSelected() void EDA_DRAW_FRAME::SetNoToolSelected()
{ {
// Select the ID_NO_TOOL_SELECTED id tool (Idle tool) // Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
SetToolID( ID_NO_TOOL_SELECTED, GetGalCanvas()->GetDefaultCursor(), wxEmptyString );
int defaultCursor = wxCURSOR_DEFAULT;
// Change GAL canvas cursor if requested.
defaultCursor = GetGalCanvas()->GetDefaultCursor();
SetToolID( ID_NO_TOOL_SELECTED, defaultCursor, wxEmptyString );
} }
@ -601,8 +568,7 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
if( m_LastGridSizeId < 0 ) if( m_LastGridSizeId < 0 )
m_LastGridSizeId = 0; m_LastGridSizeId = 0;
m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry, m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry, long( DEFAULT_MAX_UNDO_ITEMS ) );
long( DEFAULT_MAX_UNDO_ITEMS ) );
aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L ); aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L );
@ -630,8 +596,7 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
} }
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper, void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
const wxString& textLower,
COLOR4D color, int pad ) COLOR4D color, int pad )
{ {
if( m_messagePanel == NULL ) if( m_messagePanel == NULL )
@ -678,23 +643,6 @@ void EDA_DRAW_FRAME::UpdateMsgPanel()
} }
// FIXME: There needs to be a better way for child windows to load preferences.
// This function pushes four preferences from a parent window to a child window
// i.e. from eeschema to the schematic symbol editor
void EDA_DRAW_FRAME::PushPreferences( const EDA_DRAW_PANEL* aParentCanvas )
{
m_canvas->SetEnableZoomNoCenter( aParentCanvas->GetEnableZoomNoCenter() );
m_canvas->SetEnableAutoPan( aParentCanvas->GetEnableAutoPan() );
}
// I am not seeing a problem with this size yet:
static const double MAX_AXIS = INT_MAX - 100;
#define VIRT_MIN (-MAX_AXIS/2.0) ///< min X or Y coordinate in virtual space
#define VIRT_MAX (MAX_AXIS/2.0) ///< max X or Y coordinate in virtual space
void EDA_DRAW_FRAME::UseGalCanvas() void EDA_DRAW_FRAME::UseGalCanvas()
{ {
KIGFX::GAL* gal = GetGalCanvas()->GetGAL(); KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
@ -704,23 +652,11 @@ void EDA_DRAW_FRAME::UseGalCanvas()
gal->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) ); gal->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) );
gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) ); gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) );
// Transfer EDA_DRAW_PANEL settings
KIGFX::VIEW_CONTROLS* viewControls = GetGalCanvas()->GetViewControls();
viewControls->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() );
m_canvas->SetEvtHandlerEnabled( false ); m_canvas->SetEvtHandlerEnabled( false );
GetGalCanvas()->SetEvtHandlerEnabled( true ); GetGalCanvas()->SetEvtHandlerEnabled( true );
GetGalCanvas()->StartDrawing(); GetGalCanvas()->StartDrawing();
// Switch panes
// JEY TODO: drop down to a single pane....
m_auimgr.GetPane( "DrawFrame" ).Show( false );
m_auimgr.GetPane( "DrawFrameGal" ).Show( true );
m_auimgr.Update();
// Reset current tool on switch(); // Reset current tool on switch();
SetNoToolSelected(); SetNoToolSelected();
} }
@ -870,38 +806,6 @@ void EDA_DRAW_FRAME::SetScrollCenterPosition( const wxPoint& aPoint )
//-----</BASE_SCREEN API moved here >-------------------------------------------- //-----</BASE_SCREEN API moved here >--------------------------------------------
void EDA_DRAW_FRAME::RefreshCrossHair( const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC* aDC )
{
wxPoint newpos = GetCrossHairPosition();
// Redraw the crosshair if it moved
if( aOldPos != newpos )
{
SetCrossHairPosition( aOldPos, false );
m_canvas->CrossHairOff( aDC );
SetCrossHairPosition( newpos, false );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )
{
#ifdef USE_WX_OVERLAY
wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC );
oDC.Clear();
m_canvas->CallMouseCapture( aDC, aEvtPos, false );
#else
m_canvas->CallMouseCapture( aDC, aEvtPos, true );
#endif
}
#ifdef USE_WX_OVERLAY
else
{
m_overlay.Reset();
}
#endif
}
}
bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename, bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
const wxString& wildcard, const wxString& ext, const wxString& wildcard, const wxString& ext,
bool isDirectory ) bool isDirectory )
@ -1084,71 +988,6 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
} }
void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
{
int maxZoomIds;
double zoom;
wxString msg;
BASE_SCREEN* screen = m_canvas->GetScreen();
msg = AddHotkeyName( _( "Center" ), m_hotkeysDescrList, HK_ZOOM_CENTER );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_CENTER, msg, KiBitmap( zoom_center_on_screen_xpm ) );
msg = AddHotkeyName( _( "Zoom In" ), m_hotkeysDescrList, HK_ZOOM_IN );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_IN, msg, KiBitmap( zoom_in_xpm ) );
msg = AddHotkeyName( _( "Zoom Out" ), m_hotkeysDescrList, HK_ZOOM_OUT );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_OUT, msg, KiBitmap( zoom_out_xpm ) );
msg = AddHotkeyName( _( "Redraw View" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_REDRAW, msg, KiBitmap( zoom_redraw_xpm ) );
msg = AddHotkeyName( _( "Zoom to Fit" ), m_hotkeysDescrList, HK_ZOOM_AUTO );
AddMenuItem( MasterMenu, ID_POPUP_ZOOM_PAGE, msg, KiBitmap( zoom_fit_in_page_xpm ) );
wxMenu* zoom_choice = new wxMenu;
AddMenuItem( MasterMenu, zoom_choice,
ID_POPUP_ZOOM_SELECT, _( "Zoom" ),
KiBitmap( zoom_selection_xpm ) );
zoom = screen->GetZoom();
maxZoomIds = ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START;
maxZoomIds = ( (size_t) maxZoomIds < screen->m_ZoomList.size() ) ?
maxZoomIds : screen->m_ZoomList.size();
// Populate zoom submenu.
for( int i = 0; i < maxZoomIds; i++ )
{
msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
wxEmptyString, wxITEM_CHECK );
if( zoom == screen->m_ZoomList[i] )
zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
}
// Create grid submenu as required.
if( screen->GetGridCount() )
{
wxMenu* gridMenu = new wxMenu;
AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
_( "Grid" ), KiBitmap( grid_select_xpm ) );
wxArrayString gridsList;
int icurr = screen->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES );
for( unsigned i = 0; i < gridsList.GetCount(); i++ )
{
GRID_TYPE& grid = screen->GetGrid( i );
gridMenu->Append( grid.m_CmdId, gridsList[i], wxEmptyString, wxITEM_CHECK );
if( (int)i == icurr )
gridMenu->Check( grid.m_CmdId, true );
}
}
MasterMenu->AppendSeparator();
AddMenuItem( MasterMenu, ID_POPUP_CANCEL, _( "Close" ), KiBitmap( cancel_xpm ) );
}
// Find the first child dialog. // Find the first child dialog.
wxWindow* findDialog( wxWindowList& aList ) wxWindow* findDialog( wxWindowList& aList )
{ {

View File

@ -104,24 +104,12 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_ClipBox.SetX( 0 ); m_ClipBox.SetX( 0 );
m_ClipBox.SetY( 0 ); m_ClipBox.SetY( 0 );
m_canStartBlock = -1; // Command block can start if >= 0 m_canStartBlock = -1; // Command block can start if >= 0
m_abortRequest = false;
m_enableMousewheelPan = false;
m_enableZoomNoCenter = false;
m_enableAutoPan = true;
m_ignoreMouseEvents = false; m_ignoreMouseEvents = false;
// Be sure a mouse release button event will be ignored when creating the canvas // Be sure a mouse release button event will be ignored when creating the canvas
// if the mouse click was not made inside the canvas (can happen sometimes, when // if the mouse click was not made inside the canvas (can happen sometimes, when
// launching a editor from a double click made in another frame) // launching a editor from a double click made in another frame)
m_ignoreNextLeftButtonRelease = true; m_ignoreNextLeftButtonRelease = true;
m_mouseCaptureCallback = NULL;
m_endMouseCaptureCallback = NULL;
Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false );
Pgm().CommonSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
m_requestAutoPan = false;
m_minDragEventCount = 0; m_minDragEventCount = 0;
#ifdef __WXMAC__ #ifdef __WXMAC__
@ -142,15 +130,6 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
EDA_DRAW_PANEL::~EDA_DRAW_PANEL() EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
{ {
wxConfigBase* cfg = Kiface().KifaceSettings();
if( cfg )
{
cfg->Write( ENBL_MOUSEWHEEL_PAN_KEY, m_enableMousewheelPan );
cfg->Write( ENBL_ZOOM_NO_CENTER_KEY, m_enableZoomNoCenter );
cfg->Write( ENBL_AUTO_PAN_KEY, m_enableAutoPan );
}
wxDELETE( m_ClickTimer ); wxDELETE( m_ClickTimer );
} }
@ -257,42 +236,12 @@ void EDA_DRAW_PANEL::CrossHairOn( wxDC* DC )
} }
double EDA_DRAW_PANEL::GetZoom()
{
return GetScreen()->GetZoom();
}
void EDA_DRAW_PANEL::SetZoom( double zoom )
{
GetScreen()->SetZoom( zoom );
}
wxRealPoint EDA_DRAW_PANEL::GetGrid() wxRealPoint EDA_DRAW_PANEL::GetGrid()
{ {
return GetScreen()->GetGridSize(); return GetScreen()->GetGridSize();
} }
bool EDA_DRAW_PANEL::IsPointOnDisplay( const wxPoint& aPosition )
{
wxPoint pos;
EDA_RECT display_rect;
INSTALL_UNBUFFERED_DC( dc, this ); // Refresh the clip box to the entire screen size.
SetClipBox( dc );
display_rect = m_ClipBox;
// Slightly decreased the size of the useful screen area to avoid drawing limits.
#define PIXEL_MARGIN 8
display_rect.Inflate( -PIXEL_MARGIN );
return display_rect.Contains( aPosition );
}
void EDA_DRAW_PANEL::RefreshDrawingRect( const EDA_RECT& aRect, bool aEraseBackground ) void EDA_DRAW_PANEL::RefreshDrawingRect( const EDA_RECT& aRect, bool aEraseBackground )
{ {
INSTALL_UNBUFFERED_DC( dc, this ); INSTALL_UNBUFFERED_DC( dc, this );
@ -493,25 +442,6 @@ void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect )
} }
void EDA_DRAW_PANEL::EraseScreen( wxDC* DC )
{
GRSetDrawMode( DC, GR_COPY );
COLOR4D bgColor = GetParent()->GetDrawBgColor();
GRSFilledRect( NULL, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
0, bgColor, bgColor );
// Set to one (1) to draw bounding box validate bounding box calculation.
#if DEBUG_SHOW_CLIP_RECT
EDA_RECT bBox = m_ClipBox;
GRRect( NULL, DC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
}
void EDA_DRAW_PANEL::DoPrepareDC( wxDC& dc ) void EDA_DRAW_PANEL::DoPrepareDC( wxDC& dc )
{ {
wxScrolledWindow::DoPrepareDC( dc ); wxScrolledWindow::DoPrepareDC( dc );
@ -533,427 +463,32 @@ void EDA_DRAW_PANEL::DoPrepareDC( wxDC& dc )
void EDA_DRAW_PANEL::OnPaint( wxPaintEvent& event ) void EDA_DRAW_PANEL::OnPaint( wxPaintEvent& event )
{ {
// JEY TODO: this is all OBSOLETE... // OBSOLETE
if( GetScreen() == NULL )
{
event.Skip();
return;
}
INSTALL_PAINTDC( paintDC, this );
wxRect region = GetUpdateRegion().GetBox();
SetClipBox( paintDC, &region );
ReDraw( &paintDC, true );
} }
void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
{
BASE_SCREEN* Screen = GetScreen();
if( Screen == NULL )
return;
COLOR4D bgColor = GetParent()->GetDrawBgColor();
// TODO(JE): Is this correct?
if( bgColor.GetBrightness() > 0.5 )
{
g_XorMode = GR_NXOR;
g_GhostColor = BLACK;
}
else
{
g_XorMode = GR_XOR;
g_GhostColor = WHITE;
}
GRResetPenAndBrush( DC );
DC->SetBackground( wxBrush( bgColor.ToColour() ) );
DC->SetBackgroundMode( wxSOLID );
if( erasebg )
EraseScreen( DC );
GetParent()->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( kicadTraceCoords,
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() );
}
void EDA_DRAW_PANEL::SetEnableMousewheelPan( bool aEnable )
{
m_enableMousewheelPan = aEnable;
GetParent()->GetGalCanvas()->GetViewControls()->EnableMousewheelPan( aEnable );
}
void EDA_DRAW_PANEL::SetEnableAutoPan( bool aEnable )
{
m_enableAutoPan = aEnable;
GetParent()->GetGalCanvas()->GetViewControls()->EnableAutoPan( aEnable );
}
void EDA_DRAW_PANEL::SetEnableZoomNoCenter( bool aEnable )
{
m_enableZoomNoCenter = aEnable;
GetParent()->GetGalCanvas()->GetViewControls()->EnableCursorWarping( !aEnable );
}
void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
{
GRSetDrawMode( DC, GR_COPY );
if( GetParent()->IsGridVisible() )
DrawGrid( DC );
// Draw axis
if( GetParent()->GetShowAxis() )
{
COLOR4D axis_color = COLOR4D( BLUE );
wxSize pageSize = GetParent()->GetPageSizeIU();
// Draw the Y axis
GRLine( &m_ClipBox, DC, 0, -pageSize.y, 0, pageSize.y, 0, axis_color );
// Draw the X axis
GRLine( &m_ClipBox, DC, -pageSize.x, 0, pageSize.x, 0, 0, axis_color );
}
if( GetParent()->GetShowOriginAxis() )
DrawAuxiliaryAxis( DC, GR_COPY );
if( GetParent()->GetShowGridAxis() )
DrawGridAxis( DC, GR_COPY, GetParent()->GetGridOrigin() );
}
void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
{
#define MIN_GRID_SIZE 10 // min grid size in pixels to allow drawing
BASE_SCREEN* screen = GetScreen();
wxRealPoint gridSize;
wxSize screenSize;
wxPoint org;
wxRealPoint screenGridSize;
/* The grid must be visible. this is possible only is grid value
* and zoom value are sufficient
*/
gridSize = screen->GetGridSize();
screen->m_StartVisu = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
screenSize = GetClientSize();
screenGridSize.x = aDC->LogicalToDeviceXRel( KiROUND( gridSize.x ) );
screenGridSize.y = aDC->LogicalToDeviceYRel( KiROUND( gridSize.y ) );
org = m_ClipBox.GetPosition();
if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE )
{
screenGridSize.x *= 2.0;
screenGridSize.y *= 2.0;
gridSize.x *= 2.0;
gridSize.y *= 2.0;
}
if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE )
return;
org = GetParent()->GetNearestGridPosition( org, &gridSize );
// Setting the nearest grid position can select grid points outside the clip box.
// Incrementing the start point by one grid step should prevent drawing grid points
// outside the clip box.
if( org.x < m_ClipBox.GetX() )
org.x += KiROUND( gridSize.x );
if( org.y < m_ClipBox.GetY() )
org.y += KiROUND( gridSize.y );
// Use a pixel based draw to display grid. There are a lot of calls, so the cost is
// high and grid is slowly drawn on some platforms. Another way using blit transfert was used,
// a long time ago, but it did not give very good results.
// The better way is highly dependent on the platform and the graphic card.
int xpos;
double right = ( double ) m_ClipBox.GetRight();
double bottom = ( double ) m_ClipBox.GetBottom();
#if defined( USE_WX_GRAPHICS_CONTEXT )
wxGCDC *gcdc = wxDynamicCast( aDC, wxGCDC );
if( gcdc )
{
// Much faster grid drawing on systems using wxGraphicsContext
wxGraphicsContext *gc = gcdc->GetGraphicsContext();
// Grid point size
const int gsz = 1;
const double w = aDC->DeviceToLogicalXRel( gsz );
const double h = aDC->DeviceToLogicalYRel( gsz );
// Use our own pen
wxPen pen( GetParent()->GetGridColor().ToColour(), h );
pen.SetCap( wxCAP_BUTT );
gc->SetPen( pen );
// draw grid
wxGraphicsPath path = gc->CreatePath();
for( double x = (double) org.x - w/2.0; x <= right - w/2.0; x += gridSize.x )
{
for( double y = (double) org.y; y <= bottom; y += gridSize.y )
{
path.MoveToPoint( x, y );
path.AddLineToPoint( x+w, y );
}
}
gc->StrokePath( path );
}
else
#endif
{
GRSetColorPen( aDC, GetParent()->GetGridColor() );
for( double x = (double) org.x; x <= right; x += gridSize.x )
{
xpos = KiROUND( x );
for( double y = (double) org.y; y <= bottom; y += gridSize.y )
{
aDC->DrawPoint( xpos, KiROUND( y ) );
}
}
}
}
// Set to 1 to draw auxirilary axis as lines, 0 to draw as target (circle with cross) // Set to 1 to draw auxirilary axis as lines, 0 to draw as target (circle with cross)
#define DRAW_AXIS_AS_LINES 0 #define DRAW_AXIS_AS_LINES 0
// Size in pixels of the target shape // Size in pixels of the target shape
#define AXIS_SIZE_IN_PIXELS 15 #define AXIS_SIZE_IN_PIXELS 15
void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
{
wxPoint origin = GetParent()->GetAuxOrigin();
if( origin == wxPoint( 0, 0 ) )
return;
COLOR4D color = COLOR4D( RED );
GRSetDrawMode( aDC, aDrawMode );
#if DRAW_AXIS_AS_LINES
wxSize pageSize = GetParent()->GetPageSizeIU();
// Draw the Y axis
GRLine( &m_ClipBox, aDC, origin.x, -pageSize.y,
origin.x, pageSize.y, 0, color );
// Draw the X axis
GRLine( &m_ClipBox, aDC, -pageSize.x, origin.y,
pageSize.x, origin.y, 0, color );
#else
int radius = aDC->DeviceToLogicalXRel( AXIS_SIZE_IN_PIXELS );
int linewidth = aDC->DeviceToLogicalXRel( 1 );
GRSetColorPen( aDC, color, linewidth );
GRLine( &m_ClipBox, aDC, origin.x, origin.y-radius,
origin.x, origin.y+radius, 0, color );
// Draw the + shape
GRLine( &m_ClipBox, aDC, origin.x-radius, origin.y,
origin.x+radius, origin.y, 0, color );
GRCircle( &m_ClipBox, aDC, origin, radius, linewidth, color );
#endif
}
void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aGridOrigin )
{
if( !GetParent()->GetShowGridAxis() || ( !aGridOrigin.x && !aGridOrigin.y ) )
return;
COLOR4D color = GetParent()->GetGridColor();
GRSetDrawMode( aDC, aDrawMode );
#if DRAW_AXIS_AS_LINES
wxSize pageSize = GetParent()->GetPageSizeIU();
// Draw the Y axis
GRLine( &m_ClipBox, aDC, aGridOrigin.x, -pageSize.y,
aGridOrigin.x, pageSize.y, 0, color );
// Draw the X axis
GRLine( &m_ClipBox, aDC, -pageSize.x, aGridOrigin.y,
pageSize.x, aGridOrigin.y, 0, color );
#else
int radius = aDC->DeviceToLogicalXRel( AXIS_SIZE_IN_PIXELS );
int linewidth = aDC->DeviceToLogicalXRel( 1 );
GRSetColorPen( aDC, GetParent()->GetGridColor(), linewidth );
GRLine( &m_ClipBox, aDC, aGridOrigin.x-radius, aGridOrigin.y-radius,
aGridOrigin.x+radius, aGridOrigin.y+radius, 0, color );
// Draw the X shape
GRLine( &m_ClipBox, aDC, aGridOrigin.x+radius, aGridOrigin.y-radius,
aGridOrigin.x-radius, aGridOrigin.y+radius, 0, color );
GRCircle( &m_ClipBox, aDC, aGridOrigin, radius, linewidth, color );
#endif
}
void EDA_DRAW_PANEL::OnMouseEntering( wxMouseEvent& aEvent ) void EDA_DRAW_PANEL::OnMouseEntering( wxMouseEvent& aEvent )
{ {
// This is an ugly hack that fixes some cross hair display bugs when the mouse leaves the // OBSOLETE
// canvas area during middle button mouse panning.
if( m_cursorLevel != 0 )
m_cursorLevel = 0;
aEvent.Skip(); aEvent.Skip();
} }
void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event ) void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
{ {
if( m_mouseCaptureCallback == NULL ) // No command in progress. // OBSOLETE
SetAutoPanRequest( false );
if( !m_enableAutoPan || !m_requestAutoPan || m_ignoreMouseEvents )
return;
// Auto pan when mouse has left the client window
// Ensure the cross_hair position is updated,
// because it will be used to center the screen.
// We use a position inside the client window
wxRect area( wxPoint( 0, 0 ), GetClientSize() );
wxPoint cross_hair_pos = event.GetPosition();
// Certain window managers (e.g. awesome wm) incorrectly trigger "on leave" event,
// therefore test if the cursor has really left the panel area
if( !area.Contains( cross_hair_pos ) )
{
INSTALL_UNBUFFERED_DC( dc, this );
cross_hair_pos.x = dc.DeviceToLogicalX( cross_hair_pos.x );
cross_hair_pos.y = dc.DeviceToLogicalY( cross_hair_pos.y );
GetParent()->SetCrossHairPosition( cross_hair_pos );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd );
}
event.Skip(); event.Skip();
} }
void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
{ {
if( m_ignoreMouseEvents ) // OBSOLETE
return;
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() ) )
{
wxLogTrace( kicadTraceCoords,
wxT( "OnMouseWheel() position(%d, %d) rectangle(%d, %d, %d, %d)" ),
event.GetPosition().x, event.GetPosition().y,
rect.x, rect.y, rect.width, rect.height );
event.Skip();
return;
}
INSTALL_UNBUFFERED_DC( dc, this );
GetParent()->SetCrossHairPosition( event.GetLogicalPosition( dc ) );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
bool offCenterReq = event.ControlDown() && event.ShiftDown();
offCenterReq = offCenterReq || m_enableZoomNoCenter;
int axis = event.GetWheelAxis();
int wheelRotation = event.GetWheelRotation();
if( m_enableMousewheelPan )
{
// MousewheelPAN + Ctrl = zooming
if( event.ControlDown() && !event.ShiftDown() )
{
if( wheelRotation > 0 )
cmd.SetId( ID_POPUP_ZOOM_IN );
else if( wheelRotation < 0)
cmd.SetId( ID_POPUP_ZOOM_OUT );
}
// MousewheelPAN + Shift = horizontal scrolling
// Without modifiers MousewheelPAN - just pan
else
{
if( event.ShiftDown() && !event.ControlDown() )
axis = wxMOUSE_WHEEL_HORIZONTAL;
wxPoint newStart = GetViewStart();
wxPoint center = GetParent()->GetScrollCenterPosition();
double scale = GetParent()->GetScreen()->GetScalingFactor();
if( axis == wxMOUSE_WHEEL_HORIZONTAL )
{
newStart.x += wheelRotation;
center.x += KiROUND( (double) wheelRotation / scale );
}
else
{
newStart.y -= wheelRotation;
center.y -= KiROUND( (double) wheelRotation / scale );
}
Scroll( newStart );
GetParent()->SetScrollCenterPosition( center );
GetParent()->SetCrossHairPosition( center, true );
}
}
else if( wheelRotation > 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
cmd.SetId( ID_PAN_UP );
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_LEFT );
else if( offCenterReq )
cmd.SetId( ID_OFFCENTER_ZOOM_IN );
else
cmd.SetId( ID_POPUP_ZOOM_IN );
}
else if( wheelRotation < 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
cmd.SetId( ID_PAN_DOWN );
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_RIGHT );
else if( offCenterReq )
cmd.SetId( ID_OFFCENTER_ZOOM_OUT );
else
cmd.SetId( ID_POPUP_ZOOM_OUT );
}
if( cmd.GetId() )
GetEventHandler()->ProcessEvent( cmd );
event.Skip(); event.Skip();
} }
@ -961,22 +496,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) #if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
void EDA_DRAW_PANEL::OnMagnify( wxMouseEvent& event ) void EDA_DRAW_PANEL::OnMagnify( wxMouseEvent& event )
{ {
// Scale the panel around our cursor position. // OBSOLETE
bool warpCursor = false;
wxPoint cursorPosition = GetParent()->GetCursorPosition( false );
wxPoint centerPosition = GetParent()->GetScrollCenterPosition();
wxPoint vector = centerPosition - cursorPosition;
double magnification = ( event.GetMagnification() + 1.0f );
double scaleFactor = GetZoom() / magnification;
// Scale the vector between the cursor and center point
vector.x /= magnification;
vector.y /= magnification;
SetZoom(scaleFactor);
event.Skip(); event.Skip();
} }
#endif #endif
@ -1076,42 +596,3 @@ void EDA_DRAW_PANEL::OnPan( wxCommandEvent& event )
} }
void EDA_DRAW_PANEL::EndMouseCapture( int id, int cursor, const wxString& title,
bool aCallEndFunc )
{
if( m_mouseCaptureCallback && m_endMouseCaptureCallback && aCallEndFunc )
{
INSTALL_UNBUFFERED_DC( dc, this );
m_endMouseCaptureCallback( this, &dc );
}
m_mouseCaptureCallback = NULL;
m_endMouseCaptureCallback = NULL;
SetAutoPanRequest( false );
if( id != -1 && cursor != -1 )
{
wxASSERT( cursor > wxCURSOR_NONE && cursor < wxCURSOR_MAX );
GetParent()->SetToolID( id, cursor, title );
}
}
void EDA_DRAW_PANEL::CallMouseCapture( wxDC* aDC, const wxPoint& aPosition, bool aErase )
{
wxCHECK_RET( aDC != NULL, wxT( "Invalid device context." ) );
wxCHECK_RET( m_mouseCaptureCallback != NULL, wxT( "Mouse capture callback not set." ) );
m_mouseCaptureCallback( this, aDC, aPosition, aErase );
}
void EDA_DRAW_PANEL::CallEndMouseCapture( wxDC* aDC )
{
wxCHECK_RET( aDC != NULL, wxT( "Invalid device context." ) );
// CallEndMouseCapture is sometimes called with m_endMouseCaptureCallback == NULL
// for instance after an ABORT in block paste.
if( m_endMouseCaptureCallback )
m_endMouseCaptureCallback( this, aDC );
}

View File

@ -26,6 +26,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <pgm_base.h>
#include <view/view.h> #include <view/view.h>
#include <view/wx_view_controls.h> #include <view/wx_view_controls.h>
#include <view/zoom_controller.h> #include <view/zoom_controller.h>
@ -54,9 +55,26 @@ static std::unique_ptr<ZOOM_CONTROLLER> GetZoomControllerForPlatform()
WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel ) : WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel ) :
VIEW_CONTROLS( aView ), m_state( IDLE ), m_parentPanel( aParentPanel ), VIEW_CONTROLS( aView ),
m_scrollScale( 1.0, 1.0 ), m_lastTimestamp( 0 ), m_cursorPos( 0, 0 ), m_updateCursor( true ) m_state( IDLE ),
m_parentPanel( aParentPanel ),
m_scrollScale( 1.0, 1.0 ),
m_lastTimestamp( 0 ),
m_cursorPos( 0, 0 ),
m_updateCursor( true )
{ {
bool enableMousewheelPan = false;
bool enableZoomNoCenter = false;
bool enableAutoPan = true;
Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &enableMousewheelPan, false );
Pgm().CommonSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &enableZoomNoCenter, false );
Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &enableAutoPan, true );
m_settings.m_enableMousewheelPan = enableMousewheelPan;
m_settings.m_warpCursor = !enableZoomNoCenter;
m_settings.m_autoPanSettingEnabled = enableAutoPan;
m_parentPanel->Connect( wxEVT_MOTION, m_parentPanel->Connect( wxEVT_MOTION,
wxMouseEventHandler( WX_VIEW_CONTROLS::onMotion ), NULL, this ); wxMouseEventHandler( WX_VIEW_CONTROLS::onMotion ), NULL, this );
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) #if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
@ -104,8 +122,7 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel
m_cursorWarped = false; m_cursorWarped = false;
m_panTimer.SetOwner( this ); m_panTimer.SetOwner( this );
this->Connect( wxEVT_TIMER, this->Connect( wxEVT_TIMER, wxTimerEventHandler( WX_VIEW_CONTROLS::onTimer ), NULL, this );
wxTimerEventHandler( WX_VIEW_CONTROLS::onTimer ), NULL, this );
m_settings.m_lastKeyboardCursorPositionValid = false; m_settings.m_lastKeyboardCursorPositionValid = false;
} }
@ -113,6 +130,14 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel
WX_VIEW_CONTROLS::~WX_VIEW_CONTROLS() WX_VIEW_CONTROLS::~WX_VIEW_CONTROLS()
{ {
wxConfigBase* cfg = Pgm().CommonSettings();
if( cfg )
{
cfg->Write( ENBL_MOUSEWHEEL_PAN_KEY, m_settings.m_enableMousewheelPan );
cfg->Write( ENBL_ZOOM_NO_CENTER_KEY, !m_settings.m_warpCursor );
cfg->Write( ENBL_AUTO_PAN_KEY, m_settings.m_autoPanSettingEnabled );
}
} }

View File

@ -153,15 +153,14 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
ReCreateOptToolbar(); ReCreateOptToolbar();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.SetArtProvider( new EDA_DOCKART() );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
m_auimgr.Update(); m_auimgr.Update();
@ -170,7 +169,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
// Set up viewport // Set up viewport
KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas(); UseGalCanvas();
@ -486,13 +485,6 @@ void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel()
} }
void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
if( GetBoard() )
UpdateMsgPanel();
}
void DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection( wxUpdateUIEvent& aEvent ) void DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection( wxUpdateUIEvent& aEvent )
{ {
switch( aEvent.GetId() ) switch( aEvent.GetId() )

View File

@ -55,11 +55,6 @@ public:
*/ */
void OnUIToolSelection( wxUpdateUIEvent& aEvent ); void OnUIToolSelection( wxUpdateUIEvent& aEvent );
/*
* Draws the current highlighted footprint.
*/
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
void ReCreateHToolbar() override; void ReCreateHToolbar() override;
void ReCreateVToolbar() override; void ReCreateVToolbar() override;
void ReCreateOptToolbar() override; void ReCreateOptToolbar() override;

View File

@ -202,7 +202,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
RebuildSymbolUnitsList(); RebuildSymbolUnitsList();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.SetArtProvider( new EDA_DOCKART() );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );

View File

@ -312,8 +312,6 @@ public:
*/ */
void RedrawComponent( wxDC* aDC, wxPoint aOffset ); void RedrawComponent( wxDC* aDC, wxPoint aOffset );
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override { /* OBSOLETE */ }
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar() override; void ReCreateHToolbar() override;
void ReCreateVToolbar() override; void ReCreateVToolbar() override;

View File

@ -112,8 +112,6 @@ void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
{ {
LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, true ); LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, true );
viewlibFrame->PushPreferences( m_canvas );
// On Windows, Raise() does not bring the window on screen, when iconized // On Windows, Raise() does not bring the window on screen, when iconized
if( viewlibFrame->IsIconized() ) if( viewlibFrame->IsIconized() )
viewlibFrame->Iconize( false ); viewlibFrame->Iconize( false );
@ -405,7 +403,7 @@ void SCH_BASE_FRAME::createCanvas()
// Set up viewport // Set up viewport
KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas(); UseGalCanvas();

View File

@ -85,11 +85,6 @@ SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( SCH_DRAW_PANEL::OnCharHook ), NULL, this ); Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( SCH_DRAW_PANEL::OnCharHook ), NULL, this );
Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false );
Pgm().CommonSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
m_abortRequest = false;
m_ignoreMouseEvents = false; m_ignoreMouseEvents = false;
// Be sure a mouse release button event will be ignored when creating the canvas // Be sure a mouse release button event will be ignored when creating the canvas
// if the mouse click was not made inside the canvas (can happen sometimes, when // if the mouse click was not made inside the canvas (can happen sometimes, when
@ -165,36 +160,6 @@ bool SCH_DRAW_PANEL::SwitchBackend( GAL_TYPE aGalType )
} }
void SCH_DRAW_PANEL::SetEnableMousewheelPan( bool aEnable )
{
m_enableMousewheelPan = aEnable;
GetParent()->GetGalCanvas()->GetViewControls()->EnableMousewheelPan( aEnable );
}
void SCH_DRAW_PANEL::SetEnableAutoPan( bool aEnable )
{
EDA_DRAW_PANEL::SetEnableAutoPan( aEnable );
GetParent()->GetGalCanvas()->GetViewControls()->EnableAutoPan( aEnable );
}
void SCH_DRAW_PANEL::SetAutoPanRequest( bool aEnable )
{
GetParent()->GetGalCanvas()->GetViewControls()->SetAutoPan( aEnable );
}
void SCH_DRAW_PANEL::SetEnableZoomNoCenter( bool aEnable )
{
m_enableZoomNoCenter = aEnable;
GetParent()->GetGalCanvas()->GetViewControls()->EnableCursorWarping( !aEnable );
}
void SCH_DRAW_PANEL::setDefaultLayerDeps() void SCH_DRAW_PANEL::setDefaultLayerDeps()
{ {
// caching makes no sense for Cairo and other software renderers // caching makes no sense for Cairo and other software renderers

View File

@ -43,11 +43,6 @@ public:
bool SwitchBackend( GAL_TYPE aGalType ) override; bool SwitchBackend( GAL_TYPE aGalType ) override;
void OnCharHook( wxKeyEvent& event ); void OnCharHook( wxKeyEvent& event );
void SetEnableMousewheelPan( bool aEnable ) override;
void SetEnableZoomNoCenter( bool aEnable ) override;
void SetEnableAutoPan( bool aEnable ) override;
void SetAutoPanRequest( bool aEnable ) override;
BASE_SCREEN* GetScreen() override; BASE_SCREEN* GetScreen() override;
virtual EDA_DRAW_FRAME* GetParent() const override; virtual EDA_DRAW_FRAME* GetParent() const override;

View File

@ -318,7 +318,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_pageSetupData.GetPrintData().SetNoCopies( 1 ); m_pageSetupData.GetPrintData().SetNoCopies( 1 );
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.SetArtProvider( new EDA_DOCKART() );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
@ -1020,8 +1020,6 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
libeditFrame->Show( true ); libeditFrame->Show( true );
} }
libeditFrame->PushPreferences( m_canvas );
// On Windows, Raise() does not bring the window on screen, when iconized // On Windows, Raise() does not bring the window on screen, when iconized
if( libeditFrame->IsIconized() ) if( libeditFrame->IsIconized() )
libeditFrame->Iconize( false ); libeditFrame->Iconize( false );
@ -1116,8 +1114,6 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_ITEM* aItem, bool aUndoAppe
wxCHECK_RET( aItem != NULL, wxT( "Cannot add current aItem to list." ) ); wxCHECK_RET( aItem != NULL, wxT( "Cannot add current aItem to list." ) );
m_canvas->SetAutoPanRequest( false );
SCH_SHEET* parentSheet = nullptr; SCH_SHEET* parentSheet = nullptr;
SCH_COMPONENT* parentComponent = nullptr; SCH_COMPONENT* parentComponent = nullptr;
SCH_ITEM* undoItem = aItem; SCH_ITEM* undoItem = aItem;

View File

@ -299,8 +299,6 @@ public:
void LoadSettings( wxConfigBase* aCfg ) override; void LoadSettings( wxConfigBase* aCfg ) override;
void SaveSettings( wxConfigBase* aCfg ) override; void SaveSettings( wxConfigBase* aCfg ) override;
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override { /* OBSOLETE */ }
void CreateScreens(); void CreateScreens();
void ReCreateHToolbar() override; void ReCreateHToolbar() override;
void ReCreateVToolbar() override; void ReCreateVToolbar() override;

View File

@ -462,7 +462,6 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard( wxCommandEvent& aEvt )
GetCanvas()->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) ); GetCanvas()->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) );
dc.Clear(); dc.Clear();
GetCanvas()->EraseScreen( &dc );
const LSET allLayersMask = LSET().set(); const LSET allLayersMask = LSET().set();
PrintPage( &dc, allLayersMask, false ); PrintPage( &dc, allLayersMask, false );
screen->m_IsPrinting = false; screen->m_IsPrinting = false;

View File

@ -175,7 +175,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
DisplayLibInfos(); DisplayLibInfos();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.SetArtProvider( new EDA_DOCKART() );
// Manage main toolbar // Manage main toolbar
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );

View File

@ -84,7 +84,6 @@ public:
bool ReCreateListCmp(); bool ReCreateListCmp();
void DisplayLibInfos(); void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override { /* OBSOLETE */ }
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void CloseLibraryViewer( wxCommandEvent& event ); void CloseLibraryViewer( wxCommandEvent& event );
void ReCreateHToolbar() override; void ReCreateHToolbar() override;

View File

@ -41,7 +41,6 @@ set( GERBVIEW_SRCS
X2_gerber_attributes.cpp X2_gerber_attributes.cpp
clear_gbr_drawlayers.cpp clear_gbr_drawlayers.cpp
dcode.cpp dcode.cpp
draw_gerber_screen.cpp
evaluate.cpp evaluate.cpp
events_called_functions.cpp events_called_functions.cpp
excellon_read_drill_file.cpp excellon_read_drill_file.cpp

View File

@ -1,113 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jpierre.charras at wanadoo
* Copyright (C) 2013-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file draw_gerber_screen.cpp
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <common.h>
#include <class_drawpanel.h>
#include <draw_graphic_text.h>
#include <base_units.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerber_file_image.h>
#include <gerber_file_image_list.h>
#include "gerbview_printout.h"
void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
GBR_SCREEN* screen = (GBR_SCREEN*) GetScreen();
if( !GetGerberLayout() )
return;
wxBusyCursor dummy;
GR_DRAWMODE drawMode = UNSPECIFIED_DRAWMODE;
switch( GetDisplayMode() )
{
default:
case 0:
break;
case 1:
drawMode = GR_COPY;
break;
case 2:
drawMode = GR_OR;
break;
}
// Draw according to the current setting. This needs to be GR_COPY or GR_OR.
m_DisplayOptions.m_NegativeDrawColor = GetNegativeItemsColor();
m_DisplayOptions.m_BgDrawColor = GetDrawBgColor();
GetGerberLayout()->Draw( m_canvas, DC, drawMode, wxPoint( 0, 0 ), &m_DisplayOptions );
if( m_DisplayOptions.m_DisplayDCodes )
{
COLOR4D dcode_color = GetVisibleElementColor( LAYER_DCODES );
GetGerberLayout()->DrawItemsDCodeID( m_canvas, DC, GR_COPY, dcode_color );
}
// Draw the "background" now, i.e. grid and axis after gerber layers
// because most of time the actual background is erased by successive drawings of each gerber
// layer mainly in COPY mode
m_canvas->DrawBackGround( DC );
DrawWorkSheet( DC, screen, 0, IU_PER_MILS, wxEmptyString );
#ifdef USE_WX_OVERLAY
if( IsShown() )
{
m_overlay.Reset();
// On macOS, the call to create overlaydc fails for some reason due to
// the DC having zero size initially.
wxCoord w = 0, h = 0;
static_cast<wxWindowDC*>( DC )->GetSize( &w, &h );
if( w == 0 || h == 0)
{
w = h = 1;
}
wxDCOverlay overlaydc( m_overlay, (wxWindowDC*)DC, 0, 0, 1, 1 );
overlaydc.Clear();
}
#endif
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
m_canvas->DrawCrossHair( DC );
}

View File

@ -146,7 +146,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.SetArtProvider( new EDA_DOCKART() );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(4) ); m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(4) );
@ -157,8 +157,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
.Caption( _( "Layers Manager" ) ).PaneBorder( false ) .Caption( _( "Layers Manager" ) ).PaneBorder( false )
.MinSize( 80, -1 ).BestSize( m_LayersManager->GetBestSize() ) ); .MinSize( 80, -1 ).BestSize( m_LayersManager->GetBestSize() ) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
ReFillLayerWidget(); // this is near end because contents establish size ReFillLayerWidget(); // this is near end because contents establish size
m_auimgr.Update(); m_auimgr.Update();

View File

@ -200,7 +200,6 @@ public:
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) override; bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) override;
// Virtual basic functions: // Virtual basic functions:
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
void ReCreateHToolbar() override; void ReCreateHToolbar() override;
void ReCreateAuxiliaryToolbar() override; void ReCreateAuxiliaryToolbar() override;

View File

@ -219,11 +219,6 @@ protected:
*/ */
bool GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid ); bool GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid );
/**
* Move and refresh the crosshair after movement and call the mouse capture function.
*/
void RefreshCrossHair( const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC* aDC );
/** /**
* Stores the canvas type in the application settings. * Stores the canvas type in the application settings.
*/ */
@ -447,13 +442,6 @@ public:
*/ */
virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0; virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0;
/**
* Add standard zoom commands and submenu zoom and grid selection to a popup menu
* uses zoom hotkeys info base to add hotkeys info to menu commands
* @param aMasterMenu = the menu to populate.
*/
virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
/** /**
* Return a human readable value which can be displayed as zoom * Return a human readable value which can be displayed as zoom
* level indicator in dialogs. * level indicator in dialogs.
@ -652,8 +640,6 @@ public:
void DisplayToolMsg( const wxString& msg ); void DisplayToolMsg( const wxString& msg );
wxString GetToolMsg() { return m_toolMsg; } wxString GetToolMsg() { return m_toolMsg; }
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) {}
/** /**
* Called when modifying the page settings. * Called when modifying the page settings.
@ -732,14 +718,6 @@ public:
*/ */
virtual void UpdateMsgPanel(); virtual void UpdateMsgPanel();
/**
* Push preferences from a parent window to a child window.
* (i.e. from eeschema to schematic symbol editor)
*
* @param aParentCanvas is the parent canvas to push preferences from.
*/
void PushPreferences( const EDA_DRAW_PANEL* aParentCanvas );
/** /**
* Print the page pointed by current screen, set by the calling print function. * Print the page pointed by current screen, set by the calling print function.
* *

View File

@ -29,17 +29,10 @@
#include <wx/aui/dockart.h> #include <wx/aui/dockart.h>
#include <wx/aui/framemanager.h> #include <wx/aui/framemanager.h>
class EDA_DRAW_FRAME;
class EDA_DOCKART : public wxAuiDefaultDockArt class EDA_DOCKART : public wxAuiDefaultDockArt
{ {
private:
EDA_DRAW_FRAME* m_frame;
public: public:
EDA_DOCKART( EDA_DRAW_FRAME* aParent ) : EDA_DOCKART()
m_frame( aParent )
{ {
SetMetric( wxAUI_DOCKART_PANE_BORDER_SIZE, 1 ); SetMetric( wxAUI_DOCKART_PANE_BORDER_SIZE, 1 );
} }

View File

@ -200,7 +200,8 @@ enum main_id
ID_POPUP_GRID_NEXT, ID_POPUP_GRID_NEXT,
ID_POPUP_GRID_PREV, ID_POPUP_GRID_PREV,
ID_POPUP_GRID_SELECT, ID_POPUP_GRID_SELECT,
ID_POPUP_GRID_LEVEL_1000, // id for first predefined grid in inches (1000 * 0.0001 inch) ID_POPUP_GRID_FIRST,
ID_POPUP_GRID_LEVEL_1000 = ID_POPUP_GRID_FIRST, // These must be in same order as menu
ID_POPUP_GRID_LEVEL_500, ID_POPUP_GRID_LEVEL_500,
ID_POPUP_GRID_LEVEL_250, ID_POPUP_GRID_LEVEL_250,
ID_POPUP_GRID_LEVEL_200, ID_POPUP_GRID_LEVEL_200,
@ -211,10 +212,10 @@ enum main_id
ID_POPUP_GRID_LEVEL_10, ID_POPUP_GRID_LEVEL_10,
ID_POPUP_GRID_LEVEL_5, ID_POPUP_GRID_LEVEL_5,
ID_POPUP_GRID_LEVEL_2, ID_POPUP_GRID_LEVEL_2,
ID_POPUP_GRID_LEVEL_1, // id for last predefined grid in inches ( 0.0001 inch) ID_POPUP_GRID_LEVEL_1,
ID_POPUP_GRID_LEVEL_5MM, ID_POPUP_GRID_LEVEL_5MM,
ID_POPUP_GRID_LEVEL_2_5MM, ID_POPUP_GRID_LEVEL_2_5MM,
ID_POPUP_GRID_LEVEL_1MM, // id for first predefined grid in mm (1mm) ID_POPUP_GRID_LEVEL_1MM,
ID_POPUP_GRID_LEVEL_0_5MM, ID_POPUP_GRID_LEVEL_0_5MM,
ID_POPUP_GRID_LEVEL_0_25MM, ID_POPUP_GRID_LEVEL_0_25MM,
ID_POPUP_GRID_LEVEL_0_2MM, ID_POPUP_GRID_LEVEL_0_2MM,
@ -223,6 +224,8 @@ enum main_id
ID_POPUP_GRID_LEVEL_0_0_25MM, ID_POPUP_GRID_LEVEL_0_0_25MM,
ID_POPUP_GRID_LEVEL_0_0_1MM, ID_POPUP_GRID_LEVEL_0_0_1MM,
ID_POPUP_GRID_USER, ID_POPUP_GRID_USER,
ID_POPUP_GRID_SEPARATOR,
ID_POPUP_GRID_SETTINGS,
ID_GRID_SETTINGS, ID_GRID_SETTINGS,

View File

@ -17,21 +17,10 @@ protected:
int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit. int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit.
int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit. int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit.
wxPoint m_CursorStartPos; ///< Used for testing the cursor movement.
wxPoint m_PanStartCenter; ///< Initial scroll center position when pan started
wxPoint m_PanStartEventPosition; ///< Initial position of mouse event when pan started
/// The drawing area used to redraw the screen which is usually the visible area /// The drawing area used to redraw the screen which is usually the visible area
/// of the drawing in internal units. /// of the drawing in internal units.
EDA_RECT m_ClipBox; EDA_RECT m_ClipBox;
bool m_abortRequest; ///< Flag used to abort long commands.
bool m_enableZoomNoCenter; ///< True to enable zooming around the crosshair instead of the center
bool m_enableMousewheelPan; ///< True to enable mousewheel panning by default.
bool m_enableAutoPan; ///< True to enable automatic panning.
bool m_ignoreMouseEvents; ///< Ignore mouse events when true. bool m_ignoreMouseEvents; ///< Ignore mouse events when true.
/* Used to inhibit a response to a mouse left button release, after a double click /* Used to inhibit a response to a mouse left button release, after a double click
@ -54,10 +43,6 @@ public:
m_cursorLevel( 0 ), m_cursorLevel( 0 ),
m_scrollIncrementX( 1 ), m_scrollIncrementX( 1 ),
m_scrollIncrementY( 1 ), m_scrollIncrementY( 1 ),
m_abortRequest( false ),
m_enableZoomNoCenter( false ),
m_enableMousewheelPan( false ),
m_enableAutoPan( false ),
m_ignoreMouseEvents( false ), m_ignoreMouseEvents( false ),
m_ignoreNextLeftButtonRelease( false ), m_ignoreNextLeftButtonRelease( false ),
m_PrintIsMirrored( false ), m_PrintIsMirrored( false ),
@ -83,24 +68,6 @@ public:
void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; } void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; }
bool GetAbortRequest() const { return m_abortRequest; }
void SetAbortRequest( bool aAbortRequest ) { m_abortRequest = aAbortRequest; }
bool GetEnableMousewheelPan() const { return m_enableMousewheelPan; }
virtual void SetEnableMousewheelPan( bool aEnable ) { m_enableMousewheelPan = aEnable; };
bool GetEnableZoomNoCenter() const { return m_enableZoomNoCenter; }
virtual void SetEnableZoomNoCenter( bool aEnable ) { m_enableZoomNoCenter = aEnable; };
bool GetEnableAutoPan() const { return m_enableAutoPan; }
virtual void SetEnableAutoPan( bool aEnable ) { m_enableAutoPan = aEnable; };
virtual void SetAutoPanRequest( bool aEnable ) = 0;
void SetIgnoreMouseEvents( bool aIgnore ) { m_ignoreMouseEvents = aIgnore; } void SetIgnoreMouseEvents( bool aIgnore ) { m_ignoreMouseEvents = aIgnore; }
void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; } void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; }
@ -108,45 +75,6 @@ public:
bool GetPrintMirrored() const { return m_PrintIsMirrored; } bool GetPrintMirrored() const { return m_PrintIsMirrored; }
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; } void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
/**
* Function DrawBackGround
* @param DC = current Device Context
* Draws (if allowed) :
* the grid
* X and Y axis
* X and Y auxiliary axis
*/
virtual void DrawBackGround( wxDC* DC ) { printf("EDA_DRAW_PANEL:Unimplemented1\n"); };
/**
* Function DrawGrid
* draws a grid to \a aDC.
* @see m_ClipBox to determine the damaged area of the drawing to draw the grid.
* @see EDA_DRAW_FRAME::IsGridVisible() to determine if grid is shown.
* @see EDA_DRAW_FRAME::GetGridColor() for the color of the grid.
* @param aDC The device context to draw the grid.
*/
virtual void DrawGrid( wxDC* aDC ) { printf("EDA_DRAW_PANEL:Unimplemented2\n"); };
/**
* Function DrawAuxiliaryAxis
* Draw the Auxiliary Axis, used in Pcbnew which as origin coordinates
* for gerber and excellon files
* @param aDC = current Device Context
* @param aDrawMode = draw mode (GR_COPY, GR_OR ..)
*/
virtual void DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode ) { printf("EDA_DRAW_PANEL:Unimplemented2\n");};
/**
* Function DrawGridAxis
* Draw on auxiliary axis, used in Pcbnew to show grid origin, when
* the grid origin is set by user, and is not (0,0)
* @param aDC = current Device Context
* @param aDrawMode = draw mode (GR_COPY, GR_OR ..)
* @param aGridOrigin = the absolute coordinate of grid origin for snap.
*/
virtual void DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aGridOrigin ) { printf("EDA_DRAW_PANEL:Unimplemented4\n"); };
/* Mouse and keys events */ /* Mouse and keys events */
/** /**
@ -159,8 +87,6 @@ public:
*</p> *</p>
*/ */
virtual void EraseScreen( wxDC* DC ) { printf("EDA_DRAW_PANEL:Unimplemented6\n"); };;
virtual void SetZoom( double mode ) { printf("EDA_DRAW_PANEL:Unimplemented7\n"); };; virtual void SetZoom( double mode ) { printf("EDA_DRAW_PANEL:Unimplemented7\n"); };;
virtual double GetZoom() { return 1.0; };; virtual double GetZoom() { return 1.0; };;
@ -168,14 +94,6 @@ public:
//virtual wxRealPoint GetGrid() { printf("EDA_DRAW_PANEL:Unimplemented\n"); return wxRealPoint(1.0, 1.0); };; //virtual wxRealPoint GetGrid() { printf("EDA_DRAW_PANEL:Unimplemented\n"); return wxRealPoint(1.0, 1.0); };;
/**
* Function IsPointOnDisplay
* @param aPosition The position to test in logical (drawing) units.
* @return true if \a aPosition is visible on the screen.
* false if \a aPosition is not visible on the screen.
*/
virtual bool IsPointOnDisplay( const wxPoint& aPosition ) { printf("EDA_DRAW_PANEL:Unimplemented9\n"); return false; };;
/** /**
* Function SetClipBox * Function SetClipBox
* sets the clip box in drawing (logical) units from \a aRect in device units. * sets the clip box in drawing (logical) units from \a aRect in device units.
@ -194,8 +112,6 @@ public:
*/ */
virtual void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL ) { printf("EDA_DRAW_PANEL:Unimplemented10\n"); };; virtual void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL ) { printf("EDA_DRAW_PANEL:Unimplemented10\n"); };;
virtual void ReDraw( wxDC* aDC, bool aEraseBackground = true ) { printf("EDA_DRAW_PANEL:Unimplemented11\n"); };;
/** /**
* Function RefreshDrawingRect * Function RefreshDrawingRect
* redraws the contents of \a aRect in drawing units. \a aRect is converted to * redraws the contents of \a aRect in drawing units. \a aRect is converted to

View File

@ -73,15 +73,6 @@ private:
/// of the drawing in internal units. /// of the drawing in internal units.
EDA_RECT m_ClipBox; EDA_RECT m_ClipBox;
bool m_abortRequest; ///< Flag used to abort long commands.
bool m_enableZoomNoCenter; ///< True to enable zooming around the crosshair instead of the center
bool m_enableMousewheelPan; ///< True to enable mousewheel panning by default.
bool m_enableAutoPan; ///< True to enable automatic panning.
bool m_requestAutoPan; ///< true to request an auto pan. Valid only when m_enableAutoPan = true.
bool m_ignoreMouseEvents; ///< Ignore mouse events when true. bool m_ignoreMouseEvents; ///< Ignore mouse events when true.
/* Used to inhibit a response to a mouse left button release, after a double click /* Used to inhibit a response to a mouse left button release, after a double click
@ -103,12 +94,6 @@ private:
/// are oriented, and in mirror mode, orientations are reversed. /// are oriented, and in mirror mode, orientations are reversed.
bool m_PrintIsMirrored; bool m_PrintIsMirrored;
/// Mouse capture move callback function.
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback;
/// Abort mouse capture callback function.
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback;
/// useful to avoid false start block in certain cases /// useful to avoid false start block in certain cases
/// (like switch from a sheet to another sheet /// (like switch from a sheet to another sheet
/// >= 0 (or >= n) if a block can start /// >= 0 (or >= n) if a block can start
@ -138,24 +123,6 @@ public:
void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; } void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; }
bool GetAbortRequest() const { return m_abortRequest; }
void SetAbortRequest( bool aAbortRequest ) { m_abortRequest = aAbortRequest; }
bool GetEnableMousewheelPan() const { return m_enableMousewheelPan; }
void SetEnableMousewheelPan( bool aEnable );
bool GetEnableZoomNoCenter() const { return m_enableZoomNoCenter; }
void SetEnableZoomNoCenter( bool aEnable );
bool GetEnableAutoPan() const { return m_enableAutoPan; }
void SetEnableAutoPan( bool aEnable );
void SetAutoPanRequest( bool aEnable ) { m_requestAutoPan = aEnable; }
void SetIgnoreMouseEvents( bool aIgnore ) { m_ignoreMouseEvents = aIgnore; } void SetIgnoreMouseEvents( bool aIgnore ) { m_ignoreMouseEvents = aIgnore; }
void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; } void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; }
@ -163,45 +130,6 @@ public:
bool GetPrintMirrored() const { return m_PrintIsMirrored; } bool GetPrintMirrored() const { return m_PrintIsMirrored; }
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; } void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
/**
* 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
* draws a grid to \a aDC.
* @see m_ClipBox to determine the damaged area of the drawing to draw the grid.
* @see EDA_DRAW_FRAME::IsGridVisible() to determine if grid is shown.
* @see EDA_DRAW_FRAME::GetGridColor() for the color of the grid.
* @param aDC The device context to draw the grid.
*/
void DrawGrid( wxDC* aDC );
/**
* Function DrawAuxiliaryAxis
* Draw the Auxiliary Axis, used in Pcbnew which as origin coordinates
* for gerber and excellon files
* @param aDC = current Device Context
* @param aDrawMode = draw mode (GR_COPY, GR_OR ..)
*/
void DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode );
/**
* Function DrawGridAxis
* Draw on auxiliary axis, used in Pcbnew to show grid origin, when
* the grid origin is set by user, and is not (0,0)
* @param aDC = current Device Context
* @param aDrawMode = draw mode (GR_COPY, GR_OR ..)
* @param aGridOrigin = the absolute coordinate of grid origin for snap.
*/
void DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aGridOrigin );
void OnEraseBackground( wxEraseEvent& event ) { } void OnEraseBackground( wxEraseEvent& event ) { }
/** /**
@ -264,24 +192,12 @@ public:
void OnPan( wxCommandEvent& event ); void OnPan( wxCommandEvent& event );
void EraseScreen( wxDC* DC );
void OnScrollWin( wxCommandEvent& event ); void OnScrollWin( wxCommandEvent& event );
void OnScroll( wxScrollWinEvent& event ); void OnScroll( wxScrollWinEvent& event );
void SetZoom( double mode );
double GetZoom();
void SetGrid( const wxRealPoint& size ); void SetGrid( const wxRealPoint& size );
wxRealPoint GetGrid(); wxRealPoint GetGrid();
/**
* Function IsPointOnDisplay
* @param aPosition The position to test in logical (drawing) units.
* @return true if \a aPosition is visible on the screen.
* false if \a aPosition is not visible on the screen.
*/
bool IsPointOnDisplay( const wxPoint& aPosition );
/** /**
* Function SetClipBox * Function SetClipBox
* sets the clip box in drawing (logical) units from \a aRect in device units. * sets the clip box in drawing (logical) units from \a aRect in device units.
@ -300,8 +216,6 @@ public:
*/ */
void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL ); void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL );
void ReDraw( wxDC* aDC, bool aEraseBackground = true );
/** /**
* Function RefreshDrawingRect * Function RefreshDrawingRect
* redraws the contents of \a aRect in drawing units. \a aRect is converted to * redraws the contents of \a aRect in drawing units. \a aRect is converted to
@ -366,63 +280,6 @@ public:
// Show the cross hair. // Show the cross hair.
void CrossHairOn( wxDC* DC ); void CrossHairOn( wxDC* DC );
/**
* Function SetMouseCapture
* sets the mouse capture and end mouse capture callbacks to \a aMouseCaptureCallback
* and \a aEndMouseCaptureCallback respectively.
*/
void SetMouseCapture( MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback,
END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback )
{
m_mouseCaptureCallback = aMouseCaptureCallback;
m_endMouseCaptureCallback = aEndMouseCaptureCallback;
}
void SetMouseCaptureCallback( MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback )
{
m_mouseCaptureCallback = aMouseCaptureCallback;
}
/**
* Function EndMouseCapture
* ends mouse a capture.
*
* Check to see if the cursor is being managed for block or editing 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.
* @param aCallEndFunc Call the abort mouse capture callback if true.
*/
void EndMouseCapture( int aId = -1, int aCursorId = -1,
const wxString& aTitle = wxEmptyString,
bool aCallEndFunc = true );
inline bool IsMouseCaptured() const { return m_mouseCaptureCallback != NULL; }
/**
* Function CallMouseCapture
* calls the mouse capture callback.
*
* @param aDC A point to a wxDC object to perform any drawing upon.
* @param aPosition A referecnce to a wxPoint object containing the current cursor
* position.
* @param aErase True indicates the item being drawn should be erase before drawing
* it a \a aPosition.
*/
void CallMouseCapture( wxDC* aDC, const wxPoint& aPosition, bool aErase );
/**
* Function CallEndMouseCapture
* calls the end mouse capture callback.
*
* @param aDC A point to a wxDC object to perform any drawing upon.
*/
void CallEndMouseCapture( wxDC* aDC );
/** /**
* Function SetCurrentCursor * Function SetCurrentCursor
* Set the current cursor shape for drawpanel * Set the current cursor shape for drawpanel

View File

@ -197,7 +197,6 @@ public:
// General // General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override { }
virtual void ReCreateOptToolbar() { } virtual void ReCreateOptToolbar() { }
virtual void ShowChangedLanguage() override; virtual void ShowChangedLanguage() override;
virtual void ReCreateMenuBar() override; virtual void ReCreateMenuBar() override;

View File

@ -66,7 +66,6 @@ void PL_EDITOR_FRAME::OnFileHistory( wxCommandEvent& event )
} }
} }
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT );
::wxSetWorkingDirectory( ::wxPathOnly( filename ) ); ::wxSetWorkingDirectory( ::wxPathOnly( filename ) );
if( LoadPageLayoutDescrFile( filename ) ) if( LoadPageLayoutDescrFile( filename ) )

View File

@ -157,7 +157,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetStatusWidths( arrayDim( dims ), dims ); SetStatusWidths( arrayDim( dims ), dims );
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.SetArtProvider( new EDA_DOCKART() );
m_propertiesPagelayout = new PROPERTIES_FRAME( this ); m_propertiesPagelayout = new PROPERTIES_FRAME( this );
@ -172,12 +172,11 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
.Caption( _( "Properties" ) ).MinSize( m_propertiesPagelayout->GetMinSize() ) .Caption( _( "Properties" ) ).MinSize( m_propertiesPagelayout->GetMinSize() )
.BestSize( m_propertiesFrameWidth, -1 ) ); .BestSize( m_propertiesFrameWidth, -1 ) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
// Set up viewport // Set up viewport
KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas(); UseGalCanvas();

View File

@ -99,7 +99,6 @@ public:
void setupTools(); void setupTools();
// Virtual basic functions: // Virtual basic functions:
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override { /* OBSOLETE */ }
void ReCreateHToolbar() override; void ReCreateHToolbar() override;
void SetPageSettings(const PAGE_INFO&) override; void SetPageSettings(const PAGE_INFO&) override;

View File

@ -4,7 +4,7 @@
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -209,41 +209,3 @@ void PCB_TARGET::SwapData( BOARD_ITEM* aImage )
std::swap( *((PCB_TARGET*) this), *((PCB_TARGET*) aImage) ); std::swap( *((PCB_TARGET*) this), *((PCB_TARGET*) aImage) );
} }
static PCB_TARGET s_TargetCopy( nullptr ); // Used to store "old" values of the current item
// parameters before editing for undo/redo/cancel
void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
{
if( aTarget == NULL )
return;
aTarget->Draw( m_canvas, DC, GR_OR );
m_canvas->SetMouseCapture( NULL, NULL );
OnModify();
if( aTarget->IsNew() )
{
SaveCopyInUndoList( aTarget, UR_NEW );
aTarget->ClearFlags();
return;
}
if( aTarget->GetEditFlags() == IS_MOVED )
{
SaveCopyInUndoList( aTarget, UR_MOVED,
aTarget->GetPosition() - s_TargetCopy.GetPosition() );
aTarget->ClearFlags();
return;
}
if( (aTarget->GetEditFlags() & IN_EDIT) )
{
aTarget->SwapData( &s_TargetCopy );
SaveCopyInUndoList( aTarget, UR_CHANGED );
aTarget->SwapData( &s_TargetCopy );
}
aTarget->ClearFlags();
}

View File

@ -230,7 +230,7 @@ void DIALOG_PAD_PROPERTIES::enablePrimitivePage( bool aEnable )
void DIALOG_PAD_PROPERTIES::prepareCanvas() void DIALOG_PAD_PROPERTIES::prepareCanvas()
{ {
// Initialize the canvases (legacy or gal) to display the pad // Initialize the canvas to display the pad
// Show the X and Y axis. It is usefull because pad shape can have an offset // Show the X and Y axis. It is usefull because pad shape can have an offset
// or be a complex shape. // or be a complex shape.
@ -245,7 +245,7 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas()
m_panelShowPadGal->SwitchBackend( m_parent->GetGalCanvas()->GetBackend() ); m_panelShowPadGal->SwitchBackend( m_parent->GetGalCanvas()->GetBackend() );
m_panelShowPadGal->SetStealsFocus( false ); m_panelShowPadGal->SetStealsFocus( false );
bool mousewheelPan = m_parent->GetCanvas()->GetEnableMousewheelPan(); bool mousewheelPan = m_parent->GetGalCanvas()->GetViewControls()->IsMousewheelPanEnabled();
m_panelShowPadGal->GetViewControls()->EnableMousewheelPan( mousewheelPan ); m_panelShowPadGal->GetViewControls()->EnableMousewheelPan( mousewheelPan );
m_panelShowPadGal->Show(); m_panelShowPadGal->Show();

View File

@ -63,13 +63,9 @@
// Handles the selection of command events. // Handles the selection of command events.
void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
INSTALL_UNBUFFERED_DC( dc, m_canvas );
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
m_canvas->CrossHairOff( &dc );
switch( id ) // Some (not all ) edit commands must be finished or aborted switch( id ) // Some (not all ) edit commands must be finished or aborted
{ {
case wxID_CUT: case wxID_CUT:
@ -79,9 +75,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
default: // Finish (abort) the command default: // Finish (abort) the command
if( m_canvas->IsMouseCaptured() )
m_canvas->CallEndMouseCapture( &dc );
if( GetToolId() != id ) if( GetToolId() != id )
{ {
if( m_lastDrawToolId != GetToolId() ) if( m_lastDrawToolId != GetToolId() )
@ -120,8 +113,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( wxWindow::FindFocus() != editor ) if( wxWindow::FindFocus() != editor )
editor->SetFocus(); editor->SetFocus();
} }
editor->PushPreferences( m_canvas );
} }
break; break;
@ -147,8 +138,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( wxWindow::FindFocus() != viewer ) if( wxWindow::FindFocus() != viewer )
viewer->SetFocus(); viewer->SetFocus();
} }
viewer->PushPreferences( m_canvas );
} }
break; break;
@ -212,7 +201,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
m_canvas->CrossHairOn( &dc );
m_canvas->SetIgnoreMouseEvents( false ); m_canvas->SetIgnoreMouseEvents( false );
} }
@ -264,15 +252,10 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
{ {
// JEY TODO: obsolete? // JEY TODO: obsolete?
int id = aEvent.GetId(); int id = aEvent.GetId();
int lastToolID = GetToolId(); int lastToolID = GetToolId();
INSTALL_UNBUFFERED_DC( dc, m_canvas );
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
// Stop the current command and deselect the current tool.
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
switch( id ) switch( id )
{ {
case ID_NO_TOOL_SELECTED: case ID_NO_TOOL_SELECTED:
@ -293,7 +276,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
else else
SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) ); SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
Compile_Ratsnest( &dc, true ); Compile_Ratsnest( nullptr, true );
break; break;
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
@ -354,7 +337,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
case ID_LOCAL_RATSNEST_BUTT: case ID_LOCAL_RATSNEST_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) ); SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
Compile_Ratsnest( &dc, true ); Compile_Ratsnest( nullptr, true );
break; break;

View File

@ -181,11 +181,6 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
int ii; int ii;
int id = event.GetId(); int id = event.GetId();
/* Note: none of these events require aborting the current command (if any)
* (like move, edit or block command)
* so we do not test for a current command in progress and call
* m_canvas->m_endMouseCaptureCallback( m_canvas, &dc );
*/
switch( id ) switch( id )
{ {
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH: case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
@ -288,17 +283,4 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
wxLogDebug( wxT( "PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event() error") ); wxLogDebug( wxT( "PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event() error") );
break; break;
} }
// Refresh track in progress, if any, by forcing a mouse event,
// to call the current function attached to the mouse
/*if( m_canvas->IsMouseCaptured() )
{
wxMouseEvent event(wxEVT_MOTION);
wxPostEvent( m_canvas, event );
}*/
//+hp
//Refresh canvas, that we can see changes instantly. I use this because it dont,t throw mouse up-left corner.
if( m_canvas->IsMouseCaptured() )
m_canvas->Refresh();
} }

View File

@ -196,8 +196,6 @@ void PCB_EDIT_FRAME::OnFileHistory( wxCommandEvent& event )
{ {
int open_ctl = 0; int open_ctl = 0;
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
if( !wxFileName::IsFileReadable( fn ) ) if( !wxFileName::IsFileReadable( fn ) )
{ {
if( !AskLoadBoardFileName( this, &open_ctl, &fn, true ) ) if( !AskLoadBoardFileName( this, &open_ctl, &fn, true ) )
@ -220,13 +218,6 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
{ {
wxString msg; wxString msg;
// If an edit is in progress, stop it.
// For something else than save, get rid of current tool.
if( id == ID_SAVE_BOARD )
m_canvas->EndMouseCapture( -1, m_canvas->GetDefaultCursor() );
else
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
switch( id ) switch( id )
{ {
case ID_LOAD_FILE: case ID_LOAD_FILE:

View File

@ -253,7 +253,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_Layers->OnLayerSelected(); m_Layers->OnLayerSelected();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.SetArtProvider( new EDA_DOCKART() );
// Horizontal items; layers 4 - 6 // Horizontal items; layers 4 - 6
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
@ -270,14 +270,13 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
.Caption( _( "Layers Manager" ) ).PaneBorder( false ) .Caption( _( "Layers Manager" ) ).PaneBorder( false )
.MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) ); .MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
// Set up viewport // Set up viewport // JEY TODO: do these directly rather than off of m_canvas....
KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas(); UseGalCanvas();

View File

@ -107,11 +107,6 @@ public:
void ProcessPreferences( wxCommandEvent& event ); void ProcessPreferences( wxCommandEvent& event );
/**
* Draw the footprint editor BOARD, and others elements such as axis and grid.
*/
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
/** /**
* Refresh the library tree and redraw the window * Refresh the library tree and redraw the window
*/ */

View File

@ -138,10 +138,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
INSTALL_UNBUFFERED_DC( dc, m_canvas );
wxGetMousePosition( &pos.x, &pos.y ); wxGetMousePosition( &pos.x, &pos.y );
pos.y += 20; pos.y += 20;
switch( id ) switch( id )
@ -153,14 +150,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
default: default:
if( m_canvas->IsMouseCaptured() )
{
// for all other commands: stop the move in progress
m_canvas->CallEndMouseCapture( &dc );
}
SetNoToolSelected(); SetNoToolSelected();
break; break;
} }
@ -480,8 +470,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
break; break;
break;
case ID_GEN_IMPORT_GRAPHICS_FILE: case ID_GEN_IMPORT_GRAPHICS_FILE:
if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules )
{ {

View File

@ -214,7 +214,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
drawPanel->DisplayBoard( m_Pcb ); drawPanel->DisplayBoard( m_Pcb );
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.SetArtProvider( new EDA_DOCKART() );
// Horizontal items; layers 4 - 6 // Horizontal items; layers 4 - 6
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().VToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().VToolbar().Name( "MainToolbar" ).Top().Layer(6) );
@ -226,8 +226,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
m_auimgr.AddPane( m_footprintList, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(1) m_auimgr.AddPane( m_footprintList, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(1)
.CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 300, -1 ) ); .CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 300, -1 ) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
// after changing something to the aui manager call Update() to reflect the changes // after changing something to the aui manager call Update() to reflect the changes
m_auimgr.Update(); m_auimgr.Update();
@ -236,7 +235,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
// Set up viewport // Set up viewport
KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas(); UseGalCanvas();
@ -803,20 +802,6 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
} }
void FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
if( !GetBoard() )
return;
m_canvas->DrawBackGround( DC );
GetBoard()->Draw( m_canvas, DC, GR_COPY );
m_canvas->DrawCrossHair( DC );
UpdateMsgPanel();
}
void FOOTPRINT_VIEWER_FRAME::ApplyDisplaySettingsToGAL() void FOOTPRINT_VIEWER_FRAME::ApplyDisplaySettingsToGAL()
{ {
auto painter = static_cast<KIGFX::PCB_PAINTER*>( GetGalCanvas()->GetView()->GetPainter() ); auto painter = static_cast<KIGFX::PCB_PAINTER*>( GetGalCanvas()->GetView()->GetPainter() );

View File

@ -107,13 +107,6 @@ private:
*/ */
void UpdateTitle(); void UpdateTitle();
/**
* Function RedrawActiveWindow
* Display the current selected component.
* If the component is an alias, the ROOT component is displayed
*/
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
void OnCloseWindow( wxCloseEvent& Event ) override; void OnCloseWindow( wxCloseEvent& Event ) override;
void CloseFootprintViewer( wxCommandEvent& event ); void CloseFootprintViewer( wxCommandEvent& event );

View File

@ -211,7 +211,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
DisplayWizardInfos(); DisplayWizardInfos();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.SetArtProvider( new EDA_DOCKART() );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
@ -221,10 +221,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
m_auimgr.AddPane( m_buildMessageBox, EDA_PANE().Palette().Name( "Output" ).Left().Position(1) m_auimgr.AddPane( m_buildMessageBox, EDA_PANE().Palette().Name( "Output" ).Left().Position(1)
.CaptionVisible( false ).MinSize( 360, -1 ) ); .CaptionVisible( false ).MinSize( 360, -1 ) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetGalCanvas(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
wxAuiPaneInfo().Name( "DrawFrameGal" ).CentrePane().Hide() );
auto& galOpts = GetGalDisplayOptions(); auto& galOpts = GetGalDisplayOptions();
galOpts.m_fullscreenCursor = true; galOpts.m_fullscreenCursor = true;
@ -233,7 +230,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
// Set up viewport // Set up viewport
KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas(); UseGalCanvas();

View File

@ -175,7 +175,6 @@ private:
void DisplayWizardInfos(); void DisplayWizardInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
void OnCloseWindow( wxCloseEvent& Event ) override; void OnCloseWindow( wxCloseEvent& Event ) override;
void ReCreateHToolbar() override; void ReCreateHToolbar() override;
void ReCreateVToolbar() override; void ReCreateVToolbar() override;

View File

@ -260,29 +260,3 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
} }
/**
* Function RedrawActiveWindow
* Display the current selected component.
* If the component is an alias, the ROOT component is displayed
*
*/
void FOOTPRINT_WIZARD_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
if( !GetBoard() )
return;
m_canvas->DrawBackGround( DC );
GetBoard()->Draw( m_canvas, DC, GR_COPY );
MODULE* module = GetBoard()->m_Modules;
if( module )
SetMsgPanel( module );
m_canvas->DrawCrossHair( DC );
ClearMsgPanel();
if( module )
SetMsgPanel( module );
}

View File

@ -324,7 +324,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
ReCreateMicrowaveVToolbar(); ReCreateMicrowaveVToolbar();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.SetArtProvider( new EDA_DOCKART() );
// Horizontal items; layers 4 - 6 // Horizontal items; layers 4 - 6
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
@ -340,8 +340,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
.Caption( _( "Layers Manager" ) ).PaneBorder( false ) .Caption( _( "Layers Manager" ) ).PaneBorder( false )
.MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) ); .MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools ); m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools ); m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
@ -401,7 +400,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Set up viewport // Set up viewport
KIGFX::VIEW* view = galCanvas->GetView(); KIGFX::VIEW* view = galCanvas->GetView();
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas(); UseGalCanvas();
@ -551,8 +550,6 @@ void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
m_canvas->SetAbortRequest( true );
if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() ) if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
{ {
wxString msg = _( "Save changes to\n\"%s\"\nbefore closing?" ); wxString msg = _( "Save changes to\n\"%s\"\nbefore closing?" );

View File

@ -480,7 +480,6 @@ public:
*/ */
void OnEditTracksAndVias( wxCommandEvent& event ); void OnEditTracksAndVias( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
void ReCreateHToolbar() override; void ReCreateHToolbar() override;
void ReCreateAuxiliaryToolbar() override; void ReCreateAuxiliaryToolbar() override;
void ReCreateVToolbar() override; void ReCreateVToolbar() override;
@ -1021,16 +1020,9 @@ public:
*/ */
void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container ); void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container );
// Target handling // Properties dialogs
void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC );
void ShowTargetOptionsDialog( PCB_TARGET* aTarget ); void ShowTargetOptionsDialog( PCB_TARGET* aTarget );
// Dimension handling:
void ShowDimensionPropertyDialog( DIMENSION* aDimension ); void ShowDimensionPropertyDialog( DIMENSION* aDimension );
// netlist handling:
void InstallNetlistFrame(); void InstallNetlistFrame();
/** /**

View File

@ -52,80 +52,6 @@ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
int ox, int oy, LSET LayerMask, GR_DRAWMODE draw_mode ); int ox, int oy, LSET LayerMask, GR_DRAWMODE draw_mode );
void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
PCB_SCREEN* screen = GetScreen();
if( !GetBoard() || !screen )
return;
GRSetDrawMode( DC, GR_COPY );
m_canvas->DrawBackGround( DC );
DrawWorkSheet( DC, screen, 0, IU_PER_MILS, wxEmptyString );
// Redraw the footprints
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
module->Draw( m_canvas, DC, GR_OR | GR_ALLOW_HIGHCONTRAST );
#ifdef USE_WX_OVERLAY
if( IsShown() )
{
m_overlay.Reset();
wxDCOverlay overlaydc( m_overlay, (wxWindowDC*) DC );
overlaydc.Clear();
}
#endif
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
// Redraw the cursor
m_canvas->DrawCrossHair( DC );
}
/* Draw the BOARD, and others elements : axis, grid ..
*/
void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
PCB_SCREEN* screen = GetScreen();
if( !GetBoard() || !screen )
return;
GRSetDrawMode( DC, GR_COPY );
m_canvas->DrawBackGround( DC );
DrawWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness,
IU_PER_MILS, GetBoard()->GetFileName() );
GetBoard()->Draw( m_canvas, DC, GR_OR | GR_ALLOW_HIGHCONTRAST );
DrawGeneralRatsnest( DC );
#ifdef USE_WX_OVERLAY
if( IsShown() )
{
m_overlay.Reset();
wxDCOverlay overlaydc( m_overlay, (wxWindowDC*) DC );
overlaydc.Clear();
}
#endif
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
// Redraw the cursor
m_canvas->DrawCrossHair( DC );
}
// Redraw the BOARD items but not cursors, axis or grid // Redraw the BOARD items but not cursors, axis or grid
void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset ) void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset )
{ {