Loading pcbnew/pcbframe.cpp +1 −2 Original line number Original line Diff line number Diff line Loading @@ -320,8 +320,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, for ( int i = 0; i < 10; i++ ) for ( int i = 0; i < 10; i++ ) m_Macros[i].m_Record.clear(); m_Macros[i].m_Record.clear(); setupTools(); SetBoard( new BOARD() ); SetBoard( new BOARD() ); // Create the PCB_LAYER_WIDGET *after* SetBoard(): // Create the PCB_LAYER_WIDGET *after* SetBoard(): Loading Loading @@ -482,6 +480,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, } } } } setupTools(); } } PCB_EDIT_FRAME::~PCB_EDIT_FRAME() PCB_EDIT_FRAME::~PCB_EDIT_FRAME() Loading pcbnew/tools/selection_tool.cpp +33 −6 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include <wxPcbStruct.h> #include <wxPcbStruct.h> #include <collectors.h> #include <collectors.h> #include <view/view_controls.h> #include <tool/context_menu.h> #include <tool/context_menu.h> Loading Loading @@ -59,13 +60,15 @@ void SELECTION_TOOL::Reset() { { m_selectedItems.clear(); m_selectedItems.clear(); // the tool launches upon reception of activate ("pcbnew.InteractiveSelection") // The tool launches upon reception of activate ("pcbnew.InteractiveSelection") Go( &SELECTION_TOOL::Main, TOOL_EVENT( TC_Command, TA_ActivateTool, GetName() ) ); //"pcbnew.InteractiveSelection")); Go( &SELECTION_TOOL::Main, TOOL_EVENT( TC_Command, TA_ActivateTool, GetName() ) ); } } int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) { { bool dragging = false; // Main loop: keep receiving events // Main loop: keep receiving events while( OPT_TOOL_EVENT evt = Wait() ) while( OPT_TOOL_EVENT evt = Wait() ) { { Loading @@ -76,17 +79,41 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) if( !m_selectedItems.empty() ) if( !m_selectedItems.empty() ) clearSelection(); clearSelection(); else else return 0; break; // Finish } } // single click? Select single object // single click? Select single object if( evt->IsClick( MB_Left ) ) if( evt->IsClick( MB_Left ) ) selectSingle( evt->Position() ); selectSingle( evt->Position() ); // drag with LMB? Select multiple objects (or at least draw a selection box) // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them if( evt->IsDrag( MB_Left ) ) if( evt->IsDrag( MB_Left ) ) { dragging = true; getViewControls()->SetAutoPan( true ); if( m_selectedItems.empty() || m_additive ) { // If nothings has been selected or user wants to select more // draw the selection box selectMultiple(); selectMultiple(); } } else { // Now user wants to drag the selected items m_toolMgr->InvokeTool( "pcbnew.InteractiveMove" ); } } else if( dragging ) { dragging = false; getViewControls()->SetAutoPan( false ); } } // Restore the default settings getViewControls()->SetAutoPan( false ); return 0; return 0; } } Loading Loading @@ -213,7 +240,7 @@ void SELECTION_TOOL::selectMultiple() m_selArea->SetOrigin( evt->DragOrigin() ); m_selArea->SetOrigin( evt->DragOrigin() ); m_selArea->SetEnd( evt->Position() ); m_selArea->SetEnd( evt->Position() ); m_selArea->ViewSetVisible( true ); m_selArea->ViewSetVisible( true ); m_selArea->ViewUpdate( VIEW_ITEM::APPEARANCE | VIEW_ITEM::GEOMETRY ); m_selArea->ViewUpdate( VIEW_ITEM::GEOMETRY ); } } if( evt->IsMouseUp( MB_Left ) ) if( evt->IsMouseUp( MB_Left ) ) Loading Loading
pcbnew/pcbframe.cpp +1 −2 Original line number Original line Diff line number Diff line Loading @@ -320,8 +320,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, for ( int i = 0; i < 10; i++ ) for ( int i = 0; i < 10; i++ ) m_Macros[i].m_Record.clear(); m_Macros[i].m_Record.clear(); setupTools(); SetBoard( new BOARD() ); SetBoard( new BOARD() ); // Create the PCB_LAYER_WIDGET *after* SetBoard(): // Create the PCB_LAYER_WIDGET *after* SetBoard(): Loading Loading @@ -482,6 +480,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, } } } } setupTools(); } } PCB_EDIT_FRAME::~PCB_EDIT_FRAME() PCB_EDIT_FRAME::~PCB_EDIT_FRAME() Loading
pcbnew/tools/selection_tool.cpp +33 −6 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include <wxPcbStruct.h> #include <wxPcbStruct.h> #include <collectors.h> #include <collectors.h> #include <view/view_controls.h> #include <tool/context_menu.h> #include <tool/context_menu.h> Loading Loading @@ -59,13 +60,15 @@ void SELECTION_TOOL::Reset() { { m_selectedItems.clear(); m_selectedItems.clear(); // the tool launches upon reception of activate ("pcbnew.InteractiveSelection") // The tool launches upon reception of activate ("pcbnew.InteractiveSelection") Go( &SELECTION_TOOL::Main, TOOL_EVENT( TC_Command, TA_ActivateTool, GetName() ) ); //"pcbnew.InteractiveSelection")); Go( &SELECTION_TOOL::Main, TOOL_EVENT( TC_Command, TA_ActivateTool, GetName() ) ); } } int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) { { bool dragging = false; // Main loop: keep receiving events // Main loop: keep receiving events while( OPT_TOOL_EVENT evt = Wait() ) while( OPT_TOOL_EVENT evt = Wait() ) { { Loading @@ -76,17 +79,41 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) if( !m_selectedItems.empty() ) if( !m_selectedItems.empty() ) clearSelection(); clearSelection(); else else return 0; break; // Finish } } // single click? Select single object // single click? Select single object if( evt->IsClick( MB_Left ) ) if( evt->IsClick( MB_Left ) ) selectSingle( evt->Position() ); selectSingle( evt->Position() ); // drag with LMB? Select multiple objects (or at least draw a selection box) // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them if( evt->IsDrag( MB_Left ) ) if( evt->IsDrag( MB_Left ) ) { dragging = true; getViewControls()->SetAutoPan( true ); if( m_selectedItems.empty() || m_additive ) { // If nothings has been selected or user wants to select more // draw the selection box selectMultiple(); selectMultiple(); } } else { // Now user wants to drag the selected items m_toolMgr->InvokeTool( "pcbnew.InteractiveMove" ); } } else if( dragging ) { dragging = false; getViewControls()->SetAutoPan( false ); } } // Restore the default settings getViewControls()->SetAutoPan( false ); return 0; return 0; } } Loading Loading @@ -213,7 +240,7 @@ void SELECTION_TOOL::selectMultiple() m_selArea->SetOrigin( evt->DragOrigin() ); m_selArea->SetOrigin( evt->DragOrigin() ); m_selArea->SetEnd( evt->Position() ); m_selArea->SetEnd( evt->Position() ); m_selArea->ViewSetVisible( true ); m_selArea->ViewSetVisible( true ); m_selArea->ViewUpdate( VIEW_ITEM::APPEARANCE | VIEW_ITEM::GEOMETRY ); m_selArea->ViewUpdate( VIEW_ITEM::GEOMETRY ); } } if( evt->IsMouseUp( MB_Left ) ) if( evt->IsMouseUp( MB_Left ) ) Loading