mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 18:01:41 +00:00
Start the process of removing the legacy draw panel.
This commit is contained in:
parent
4842c73530
commit
edc8438ef0
common
cvpcb
eeschema
libedit
sch_base_frame.cppsch_draw_panel.cppsch_draw_panel.hsch_edit_frame.cppsch_edit_frame.hsheet.cppviewlib_frame.cppviewlib_frame.hgerbview
include
pagelayout_editor
pcbnew
class_pcb_target.cpp
dialogs
edit.cppedit_track_width.cppfiles.cppfootprint_edit_frame.cppfootprint_edit_frame.hfootprint_editor_utils.cppfootprint_viewer_frame.cppfootprint_viewer_frame.hfootprint_wizard_frame.cppfootprint_wizard_frame.hfootprint_wizard_frame_functions.cpppcb_edit_frame.cpppcb_edit_frame.hpcb_legacy_draw_utils.cpp@ -46,7 +46,7 @@ void EDA_DOCKART::DrawBorder( wxDC& aDC, wxWindow* aWindow, const wxRect& aRect,
|
||||
{
|
||||
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
|
||||
// border and then fill in the top and left with the canvas background colour.
|
||||
|
@ -237,7 +237,8 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
|
||||
{
|
||||
EDA_BASE_FRAME::CommonSettingsChanged();
|
||||
|
||||
wxConfigBase* settings = Pgm().CommonSettings();
|
||||
wxConfigBase* settings = Pgm().CommonSettings();
|
||||
KIGFX::VIEW_CONTROLS* viewControls = GetGalCanvas()->GetViewControls();
|
||||
|
||||
int autosaveInterval;
|
||||
settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval );
|
||||
@ -249,13 +250,13 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
|
||||
|
||||
bool option;
|
||||
settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option );
|
||||
m_canvas->SetEnableMousewheelPan( option );
|
||||
viewControls->EnableMousewheelPan( option );
|
||||
|
||||
settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option );
|
||||
m_canvas->SetEnableZoomNoCenter( option );
|
||||
viewControls->EnableCursorWarping( !option );
|
||||
|
||||
settings->Read( ENBL_AUTO_PAN_KEY, &option );
|
||||
m_canvas->SetEnableAutoPan( option );
|
||||
viewControls->EnableAutoPan( option );
|
||||
|
||||
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 )
|
||||
{
|
||||
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()
|
||||
{
|
||||
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->StartDrawing();
|
||||
|
||||
@ -752,12 +731,6 @@ void EDA_DRAW_FRAME::SetScrollCenterPosition( const wxPoint& aPoint )
|
||||
|
||||
//-----</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 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.
|
||||
wxWindow* findDialog( wxWindowList& aList )
|
||||
{
|
||||
|
@ -253,7 +253,8 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
|
||||
{
|
||||
EDA_BASE_FRAME::CommonSettingsChanged();
|
||||
|
||||
wxConfigBase* settings = Pgm().CommonSettings();
|
||||
wxConfigBase* settings = Pgm().CommonSettings();
|
||||
KIGFX::VIEW_CONTROLS* viewControls = GetGalCanvas()->GetViewControls();
|
||||
|
||||
int autosaveInterval;
|
||||
settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval );
|
||||
@ -265,13 +266,13 @@ void EDA_DRAW_FRAME::CommonSettingsChanged()
|
||||
|
||||
bool option;
|
||||
settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option );
|
||||
m_canvas->SetEnableMousewheelPan( option );
|
||||
viewControls->EnableMousewheelPan( option );
|
||||
|
||||
settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option );
|
||||
m_canvas->SetEnableZoomNoCenter( option );
|
||||
viewControls->EnableCursorWarping( !option );
|
||||
|
||||
settings->Read( ENBL_AUTO_PAN_KEY, &option );
|
||||
m_canvas->SetEnableAutoPan( option );
|
||||
viewControls->EnableAutoPan( option );
|
||||
|
||||
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 )
|
||||
{
|
||||
int* clientData;
|
||||
int eventId = ID_POPUP_GRID_LEVEL_100;
|
||||
wxCHECK_RET( m_gridSelectBox, "m_gridSelectBox uninitialized" );
|
||||
|
||||
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
|
||||
return;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
// wxWidgets will check the separator, which we don't want.
|
||||
// Re-check the current grid.
|
||||
wxUpdateUIEvent dummy;
|
||||
OnUpdateSelectGrid( dummy );
|
||||
}
|
||||
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;
|
||||
|
||||
// Notify GAL
|
||||
TOOL_MANAGER* mgr = GetToolManager();
|
||||
|
||||
if( mgr )
|
||||
mgr->RunAction( "common.Control.gridPreset", true, idx );
|
||||
|
||||
m_canvas->Refresh();
|
||||
UpdateStatusBar();
|
||||
m_galCanvas->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
|
||||
{
|
||||
if( m_zoomSelectBox == NULL )
|
||||
return; // Should not happen!
|
||||
wxCHECK_RET( m_zoomSelectBox, "m_zoomSelectBox uninitialized" );
|
||||
|
||||
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()
|
||||
{
|
||||
// Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
|
||||
|
||||
int defaultCursor = wxCURSOR_DEFAULT;
|
||||
|
||||
// Change GAL canvas cursor if requested.
|
||||
defaultCursor = GetGalCanvas()->GetDefaultCursor();
|
||||
|
||||
SetToolID( ID_NO_TOOL_SELECTED, defaultCursor, wxEmptyString );
|
||||
SetToolID( ID_NO_TOOL_SELECTED, GetGalCanvas()->GetDefaultCursor(), wxEmptyString );
|
||||
}
|
||||
|
||||
|
||||
@ -601,8 +568,7 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||
if( m_LastGridSizeId < 0 )
|
||||
m_LastGridSizeId = 0;
|
||||
|
||||
m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
|
||||
long( DEFAULT_MAX_UNDO_ITEMS ) );
|
||||
m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry, long( DEFAULT_MAX_UNDO_ITEMS ) );
|
||||
|
||||
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,
|
||||
const wxString& textLower,
|
||||
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
|
||||
COLOR4D color, int pad )
|
||||
{
|
||||
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()
|
||||
{
|
||||
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
|
||||
@ -704,23 +652,11 @@ void EDA_DRAW_FRAME::UseGalCanvas()
|
||||
gal->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) );
|
||||
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 );
|
||||
GetGalCanvas()->SetEvtHandlerEnabled( true );
|
||||
|
||||
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();
|
||||
SetNoToolSelected();
|
||||
}
|
||||
@ -870,38 +806,6 @@ void EDA_DRAW_FRAME::SetScrollCenterPosition( const wxPoint& aPoint )
|
||||
|
||||
//-----</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,
|
||||
const wxString& wildcard, const wxString& ext,
|
||||
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.
|
||||
wxWindow* findDialog( wxWindowList& aList )
|
||||
{
|
||||
|
@ -104,24 +104,12 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
||||
m_ClipBox.SetX( 0 );
|
||||
m_ClipBox.SetY( 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;
|
||||
// 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
|
||||
// launching a editor from a double click made in another frame)
|
||||
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;
|
||||
|
||||
#ifdef __WXMAC__
|
||||
@ -142,15 +130,6 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@ -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()
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
wxScrolledWindow::DoPrepareDC( dc );
|
||||
@ -533,427 +463,32 @@ void EDA_DRAW_PANEL::DoPrepareDC( wxDC& dc )
|
||||
|
||||
void EDA_DRAW_PANEL::OnPaint( wxPaintEvent& event )
|
||||
{
|
||||
// JEY TODO: this is all OBSOLETE...
|
||||
if( GetScreen() == NULL )
|
||||
{
|
||||
event.Skip();
|
||||
return;
|
||||
}
|
||||
|
||||
INSTALL_PAINTDC( paintDC, this );
|
||||
|
||||
wxRect region = GetUpdateRegion().GetBox();
|
||||
SetClipBox( paintDC, ®ion );
|
||||
ReDraw( &paintDC, true );
|
||||
// OBSOLETE
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
#define DRAW_AXIS_AS_LINES 0
|
||||
// Size in pixels of the target shape
|
||||
#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 )
|
||||
{
|
||||
// This is an ugly hack that fixes some cross hair display bugs when the mouse leaves the
|
||||
// canvas area during middle button mouse panning.
|
||||
if( m_cursorLevel != 0 )
|
||||
m_cursorLevel = 0;
|
||||
|
||||
// OBSOLETE
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
|
||||
{
|
||||
if( m_mouseCaptureCallback == NULL ) // No command in progress.
|
||||
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 );
|
||||
}
|
||||
|
||||
// OBSOLETE
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
|
||||
{
|
||||
if( m_ignoreMouseEvents )
|
||||
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 );
|
||||
// OBSOLETE
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
@ -961,22 +496,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
|
||||
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
|
||||
void EDA_DRAW_PANEL::OnMagnify( wxMouseEvent& event )
|
||||
{
|
||||
// Scale the panel around our cursor position.
|
||||
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);
|
||||
|
||||
// OBSOLETE
|
||||
event.Skip();
|
||||
}
|
||||
#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 );
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <pgm_base.h>
|
||||
#include <view/view.h>
|
||||
#include <view/wx_view_controls.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 ) :
|
||||
VIEW_CONTROLS( aView ), m_state( IDLE ), m_parentPanel( aParentPanel ),
|
||||
m_scrollScale( 1.0, 1.0 ), m_lastTimestamp( 0 ), m_cursorPos( 0, 0 ), m_updateCursor( true )
|
||||
VIEW_CONTROLS( aView ),
|
||||
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,
|
||||
wxMouseEventHandler( WX_VIEW_CONTROLS::onMotion ), NULL, this );
|
||||
#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_panTimer.SetOwner( this );
|
||||
this->Connect( wxEVT_TIMER,
|
||||
wxTimerEventHandler( WX_VIEW_CONTROLS::onTimer ), NULL, this );
|
||||
this->Connect( wxEVT_TIMER, wxTimerEventHandler( WX_VIEW_CONTROLS::onTimer ), NULL, this );
|
||||
|
||||
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()
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,15 +153,14 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
|
||||
ReCreateOptToolbar();
|
||||
|
||||
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_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_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
|
||||
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
|
||||
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
|
||||
|
||||
m_auimgr.Update();
|
||||
|
||||
@ -170,7 +169,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
|
||||
|
||||
// Set up viewport
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
|
||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||
|
||||
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 )
|
||||
{
|
||||
switch( aEvent.GetId() )
|
||||
|
@ -55,11 +55,6 @@ public:
|
||||
*/
|
||||
void OnUIToolSelection( wxUpdateUIEvent& aEvent );
|
||||
|
||||
/*
|
||||
* Draws the current highlighted footprint.
|
||||
*/
|
||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
|
||||
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateVToolbar() override;
|
||||
void ReCreateOptToolbar() override;
|
||||
|
@ -202,7 +202,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
RebuildSymbolUnitsList();
|
||||
|
||||
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_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
|
||||
|
@ -312,8 +312,6 @@ public:
|
||||
*/
|
||||
void RedrawComponent( wxDC* aDC, wxPoint aOffset );
|
||||
|
||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override { /* OBSOLETE */ }
|
||||
|
||||
void OnCloseWindow( wxCloseEvent& Event );
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateVToolbar() override;
|
||||
|
@ -112,8 +112,6 @@ void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
|
||||
{
|
||||
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
|
||||
if( viewlibFrame->IsIconized() )
|
||||
viewlibFrame->Iconize( false );
|
||||
@ -405,7 +403,7 @@ void SCH_BASE_FRAME::createCanvas()
|
||||
|
||||
// Set up viewport
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
|
||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||
|
||||
UseGalCanvas();
|
||||
|
@ -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 );
|
||||
|
||||
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;
|
||||
// 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
|
||||
@ -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()
|
||||
{
|
||||
// caching makes no sense for Cairo and other software renderers
|
||||
|
@ -43,11 +43,6 @@ public:
|
||||
bool SwitchBackend( GAL_TYPE aGalType ) override;
|
||||
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;
|
||||
virtual EDA_DRAW_FRAME* GetParent() const override;
|
||||
|
||||
|
@ -318,7 +318,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||
m_pageSetupData.GetPrintData().SetNoCopies( 1 );
|
||||
|
||||
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_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
|
||||
@ -1020,8 +1020,6 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
||||
libeditFrame->Show( true );
|
||||
}
|
||||
|
||||
libeditFrame->PushPreferences( m_canvas );
|
||||
|
||||
// On Windows, Raise() does not bring the window on screen, when iconized
|
||||
if( libeditFrame->IsIconized() )
|
||||
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." ) );
|
||||
|
||||
m_canvas->SetAutoPanRequest( false );
|
||||
|
||||
SCH_SHEET* parentSheet = nullptr;
|
||||
SCH_COMPONENT* parentComponent = nullptr;
|
||||
SCH_ITEM* undoItem = aItem;
|
||||
|
@ -299,8 +299,6 @@ public:
|
||||
void LoadSettings( wxConfigBase* aCfg ) override;
|
||||
void SaveSettings( wxConfigBase* aCfg ) override;
|
||||
|
||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override { /* OBSOLETE */ }
|
||||
|
||||
void CreateScreens();
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateVToolbar() override;
|
||||
|
@ -462,7 +462,6 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard( wxCommandEvent& aEvt )
|
||||
GetCanvas()->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) );
|
||||
|
||||
dc.Clear();
|
||||
GetCanvas()->EraseScreen( &dc );
|
||||
const LSET allLayersMask = LSET().set();
|
||||
PrintPage( &dc, allLayersMask, false );
|
||||
screen->m_IsPrinting = false;
|
||||
|
@ -175,7 +175,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
||||
DisplayLibInfos();
|
||||
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
|
||||
m_auimgr.SetArtProvider( new EDA_DOCKART() );
|
||||
|
||||
// Manage main toolbar
|
||||
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
|
||||
|
@ -84,7 +84,6 @@ public:
|
||||
bool ReCreateListCmp();
|
||||
|
||||
void DisplayLibInfos();
|
||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override { /* OBSOLETE */ }
|
||||
void OnCloseWindow( wxCloseEvent& Event );
|
||||
void CloseLibraryViewer( wxCommandEvent& event );
|
||||
void ReCreateHToolbar() override;
|
||||
|
@ -41,7 +41,6 @@ set( GERBVIEW_SRCS
|
||||
X2_gerber_attributes.cpp
|
||||
clear_gbr_drawlayers.cpp
|
||||
dcode.cpp
|
||||
draw_gerber_screen.cpp
|
||||
evaluate.cpp
|
||||
events_called_functions.cpp
|
||||
excellon_read_drill_file.cpp
|
||||
|
@ -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 );
|
||||
}
|
@ -146,7 +146,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||
ReCreateAuxiliaryToolbar();
|
||||
|
||||
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_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 )
|
||||
.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( "DrawFrameGal" ).Center().Hide() );
|
||||
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
|
||||
|
||||
ReFillLayerWidget(); // this is near end because contents establish size
|
||||
m_auimgr.Update();
|
||||
|
@ -200,7 +200,6 @@ public:
|
||||
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) override;
|
||||
|
||||
// Virtual basic functions:
|
||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateAuxiliaryToolbar() override;
|
||||
|
||||
|
@ -219,11 +219,6 @@ protected:
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@ -447,13 +442,6 @@ public:
|
||||
*/
|
||||
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
|
||||
* level indicator in dialogs.
|
||||
@ -652,8 +640,6 @@ public:
|
||||
|
||||
void DisplayToolMsg( const wxString& msg );
|
||||
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.
|
||||
@ -732,14 +718,6 @@ public:
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -29,17 +29,10 @@
|
||||
#include <wx/aui/dockart.h>
|
||||
#include <wx/aui/framemanager.h>
|
||||
|
||||
class EDA_DRAW_FRAME;
|
||||
|
||||
|
||||
class EDA_DOCKART : public wxAuiDefaultDockArt
|
||||
{
|
||||
private:
|
||||
EDA_DRAW_FRAME* m_frame;
|
||||
|
||||
public:
|
||||
EDA_DOCKART( EDA_DRAW_FRAME* aParent ) :
|
||||
m_frame( aParent )
|
||||
EDA_DOCKART()
|
||||
{
|
||||
SetMetric( wxAUI_DOCKART_PANE_BORDER_SIZE, 1 );
|
||||
}
|
||||
|
@ -200,7 +200,8 @@ enum main_id
|
||||
ID_POPUP_GRID_NEXT,
|
||||
ID_POPUP_GRID_PREV,
|
||||
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_250,
|
||||
ID_POPUP_GRID_LEVEL_200,
|
||||
@ -211,10 +212,10 @@ enum main_id
|
||||
ID_POPUP_GRID_LEVEL_10,
|
||||
ID_POPUP_GRID_LEVEL_5,
|
||||
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_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_25MM,
|
||||
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_1MM,
|
||||
ID_POPUP_GRID_USER,
|
||||
ID_POPUP_GRID_SEPARATOR,
|
||||
ID_POPUP_GRID_SETTINGS,
|
||||
|
||||
ID_GRID_SETTINGS,
|
||||
|
||||
|
@ -17,21 +17,10 @@ protected:
|
||||
int m_scrollIncrementX; ///< X 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
|
||||
/// of the drawing in internal units.
|
||||
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.
|
||||
|
||||
/* Used to inhibit a response to a mouse left button release, after a double click
|
||||
@ -54,10 +43,6 @@ public:
|
||||
m_cursorLevel( 0 ),
|
||||
m_scrollIncrementX( 1 ),
|
||||
m_scrollIncrementY( 1 ),
|
||||
m_abortRequest( false ),
|
||||
m_enableZoomNoCenter( false ),
|
||||
m_enableMousewheelPan( false ),
|
||||
m_enableAutoPan( false ),
|
||||
m_ignoreMouseEvents( false ),
|
||||
m_ignoreNextLeftButtonRelease( false ),
|
||||
m_PrintIsMirrored( false ),
|
||||
@ -83,24 +68,6 @@ public:
|
||||
|
||||
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 SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; }
|
||||
@ -108,45 +75,6 @@ public:
|
||||
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
|
||||
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 */
|
||||
|
||||
/**
|
||||
@ -159,8 +87,6 @@ public:
|
||||
*</p>
|
||||
*/
|
||||
|
||||
virtual void EraseScreen( wxDC* DC ) { printf("EDA_DRAW_PANEL:Unimplemented6\n"); };;
|
||||
|
||||
virtual void SetZoom( double mode ) { printf("EDA_DRAW_PANEL:Unimplemented7\n"); };;
|
||||
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); };;
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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 ReDraw( wxDC* aDC, bool aEraseBackground = true ) { printf("EDA_DRAW_PANEL:Unimplemented11\n"); };;
|
||||
|
||||
/**
|
||||
* Function RefreshDrawingRect
|
||||
* redraws the contents of \a aRect in drawing units. \a aRect is converted to
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user