Remove legacy block operations.
This commit is contained in:
parent
13aa503614
commit
b90b454ada
|
@ -57,7 +57,6 @@ set( GERBVIEW_SRCS
|
|||
locate.cpp
|
||||
menubar.cpp
|
||||
onleftclick.cpp
|
||||
onrightclick.cpp
|
||||
readgerb.cpp
|
||||
rs274_read_XY_and_IJ_coordinates.cpp
|
||||
rs274d.cpp
|
||||
|
|
|
@ -154,10 +154,6 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
switch( id )
|
||||
{
|
||||
case ID_POPUP_PLACE_BLOCK:
|
||||
case ID_POPUP_ZOOM_BLOCK:
|
||||
break;
|
||||
|
||||
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
||||
m_canvas->EndMouseCapture();
|
||||
|
||||
|
@ -204,26 +200,6 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
Liste_D_Codes();
|
||||
break;
|
||||
|
||||
case ID_POPUP_PLACE_BLOCK:
|
||||
if( !IsGalCanvasActive() )
|
||||
{
|
||||
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
|
||||
m_canvas->SetAutoPanRequest( false );
|
||||
HandleBlockPlace( &dc );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_BLOCK:
|
||||
if( !IsGalCanvasActive() )
|
||||
{
|
||||
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_HIGHLIGHT_CMP_ITEMS:
|
||||
if( m_SelComponentBox->SetStringSelection( currItem->GetNetAttributes().m_Cmpref ) )
|
||||
m_canvas->Refresh();
|
||||
|
|
|
@ -232,7 +232,7 @@ public:
|
|||
void ReCreateMenuBar() override;
|
||||
void OnLeftClick( wxDC* aDC, const wxPoint& aMousePos ) override;
|
||||
void OnLeftDClick( wxDC* aDC, const wxPoint& aMousePos ) override;
|
||||
bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) override;
|
||||
bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) override { return true; }
|
||||
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
||||
double BestZoom() override;
|
||||
void UpdateStatusBar() override;
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see change_log.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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <id.h>
|
||||
#include <gerbview_id.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <kicad_string.h>
|
||||
|
||||
/* Prepare the right-click pullup menu.
|
||||
* The menu already has a list of zoom commands.
|
||||
*/
|
||||
bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
|
||||
{
|
||||
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
|
||||
wxString msg;
|
||||
bool BlockActive = !GetScreen()->m_BlockLocate.IsIdle();
|
||||
bool busy = currItem && currItem->GetEditFlags();
|
||||
|
||||
// Do not initiate a start block validation on menu.
|
||||
m_canvas->SetCanStartBlock( -1 );
|
||||
|
||||
// Simple location of elements where possible.
|
||||
if( !busy )
|
||||
{
|
||||
currItem = Locate( aPosition, CURSEUR_OFF_GRILLE );
|
||||
busy = currItem && currItem->GetEditFlags();
|
||||
}
|
||||
|
||||
// If command in progress, end command.
|
||||
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||
{
|
||||
if( busy )
|
||||
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||
_( "Cancel" ), KiBitmap( cancel_xpm ) );
|
||||
else
|
||||
AddMenuItem( aPopMenu, ID_POPUP_CLOSE_CURRENT_TOOL,
|
||||
_( "End Tool" ), KiBitmap( cursor_xpm ) );
|
||||
|
||||
aPopMenu->AppendSeparator();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( busy || BlockActive )
|
||||
{
|
||||
if( BlockActive )
|
||||
{
|
||||
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||
_( "Cancel Block" ), KiBitmap( cancel_xpm ) );
|
||||
aPopMenu->AppendSeparator();
|
||||
AddMenuItem( aPopMenu, ID_POPUP_PLACE_BLOCK,
|
||||
_( "Place Block" ), KiBitmap( checked_ok_xpm ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||
_( "Cancel" ), KiBitmap( cancel_xpm ) );
|
||||
}
|
||||
|
||||
aPopMenu->AppendSeparator();
|
||||
}
|
||||
}
|
||||
|
||||
if( BlockActive )
|
||||
return true;
|
||||
|
||||
if( currItem )
|
||||
{
|
||||
GetScreen()->SetCurItem( currItem );
|
||||
bool add_separator = false;
|
||||
|
||||
// Now, display a context menu
|
||||
// to allow highlighting items which share the same attributes
|
||||
// as the selected item (net attributes and aperture attributes)
|
||||
const GBR_NETLIST_METADATA& net_attr = currItem->GetNetAttributes();
|
||||
|
||||
if( ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) ||
|
||||
( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )
|
||||
{
|
||||
AddMenuItem( aPopMenu, ID_HIGHLIGHT_CMP_ITEMS,
|
||||
wxString::Format( _( "Highlight Items of Component \"%s\"" ),
|
||||
GetChars( net_attr.m_Cmpref ) ),
|
||||
KiBitmap( file_footprint_xpm ) );
|
||||
add_separator = true;
|
||||
}
|
||||
|
||||
if( ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_NET ) )
|
||||
{
|
||||
AddMenuItem( aPopMenu, ID_HIGHLIGHT_NET_ITEMS,
|
||||
wxString::Format( _( "Highlight Items of Net \"%s\"" ),
|
||||
UnescapeString( net_attr.m_Netname ) ),
|
||||
KiBitmap( general_ratsnest_xpm ) );
|
||||
add_separator = true;
|
||||
}
|
||||
|
||||
D_CODE* apertDescr = currItem->GetDcodeDescr();
|
||||
|
||||
if( apertDescr && !apertDescr->m_AperFunction.IsEmpty() )
|
||||
{
|
||||
AddMenuItem( aPopMenu, ID_HIGHLIGHT_APER_ATTRIBUTE_ITEMS,
|
||||
wxString::Format( _( "Highlight Aperture Type \"%s\"" ),
|
||||
GetChars( apertDescr->m_AperFunction ) ),
|
||||
KiBitmap( flag_xpm ) );
|
||||
add_separator = true;
|
||||
}
|
||||
|
||||
if( add_separator )
|
||||
aPopMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
AddMenuItem( aPopMenu, ID_HIGHLIGHT_REMOVE_ALL,
|
||||
_( "Clear Highlight" ),
|
||||
KiBitmap( gerbview_clear_layers_xpm ) );
|
||||
|
||||
aPopMenu->AppendSeparator();
|
||||
|
||||
return true;
|
||||
}
|
11
include/id.h
11
include/id.h
|
@ -160,17 +160,6 @@ enum main_id
|
|||
ID_POPUP_GENERAL_START_RANGE, // first number
|
||||
ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||
ID_POPUP_CLOSE_CURRENT_TOOL,
|
||||
|
||||
// JEY TODO: all the block-specific commands are obsolete after PCBNew's legacy canvas goes...
|
||||
ID_POPUP_MOVE_BLOCK_EXACT,
|
||||
ID_POPUP_DUPLICATE_BLOCK,
|
||||
ID_POPUP_ROTATE_BLOCK,
|
||||
ID_POPUP_DELETE_BLOCK,
|
||||
ID_POPUP_FLIP_BLOCK,
|
||||
ID_POPUP_PLACE_BLOCK,
|
||||
ID_POPUP_ZOOM_BLOCK,
|
||||
ID_POPUP_MIRROR_X_BLOCK,
|
||||
ID_POPUP_MIRROR_Y_BLOCK,
|
||||
ID_POPUP_GENERAL_END_RANGE, // last number
|
||||
|
||||
ID_POPUP_ENTER_MENU,
|
||||
|
|
|
@ -234,7 +234,6 @@ set( PCBNEW_CLASS_SRCS
|
|||
array_creator.cpp
|
||||
array_pad_name_provider.cpp
|
||||
attribut.cpp
|
||||
block.cpp
|
||||
block_footprint_editor.cpp
|
||||
board_netlist_updater.cpp
|
||||
build_BOM_from_board.cpp
|
||||
|
|
791
pcbnew/block.cpp
791
pcbnew/block.cpp
|
@ -1,791 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 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 pcbnew/block.cpp
|
||||
*/
|
||||
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <confirm.h>
|
||||
#include <block_commande.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <trigo.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_track.h>
|
||||
#include <class_drawsegment.h>
|
||||
#include <class_pcb_text.h>
|
||||
#include <class_pcb_target.h>
|
||||
#include <class_module.h>
|
||||
#include <class_dimension.h>
|
||||
#include <class_zone.h>
|
||||
|
||||
#include <dialog_block_options.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <protos.h>
|
||||
|
||||
#include <connectivity/connectivity_data.h>
|
||||
|
||||
#define BLOCK_OUTLINE_COLOR YELLOW
|
||||
|
||||
/**
|
||||
* Function drawPickedItems
|
||||
* draws items currently selected in a block
|
||||
* @param aPanel = Current draw panel
|
||||
* @param aDC = Current device context
|
||||
* @param aOffset = Drawing offset
|
||||
**/
|
||||
static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset );
|
||||
|
||||
/**
|
||||
* Function drawMovingBlock
|
||||
* handles drawing of a moving block
|
||||
* @param aPanel = Current draw panel
|
||||
* @param aDC = Current device context
|
||||
* @param aPosition The cursor position in logical (drawing) units.
|
||||
* @param aErase = Erase block at current position
|
||||
**/
|
||||
static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||
bool aErase );
|
||||
|
||||
|
||||
static DIALOG_BLOCK_OPTIONS::OPTIONS blockOpts;
|
||||
|
||||
|
||||
static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title )
|
||||
{
|
||||
wxPoint oldpos = parent->GetCrossHairPosition();
|
||||
|
||||
parent->GetCanvas()->SetIgnoreMouseEvents( true );
|
||||
DIALOG_BLOCK_OPTIONS * dlg = new DIALOG_BLOCK_OPTIONS( parent, blockOpts, true, title );
|
||||
|
||||
int cmd = dlg->ShowModal();
|
||||
dlg->Destroy();
|
||||
|
||||
parent->SetCrossHairPosition( oldpos );
|
||||
parent->GetCanvas()->MoveCursorToCrossHair();
|
||||
parent->GetCanvas()->SetIgnoreMouseEvents( false );
|
||||
|
||||
return cmd == wxID_OK;
|
||||
}
|
||||
|
||||
|
||||
int PCB_EDIT_FRAME::BlockCommand( EDA_KEY aKey )
|
||||
{
|
||||
int cmd = 0;
|
||||
|
||||
switch( aKey )
|
||||
{
|
||||
default:
|
||||
cmd = aKey & 0xFF;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
cmd = BLOCK_MOVE;
|
||||
break;
|
||||
|
||||
case GR_KB_SHIFT:
|
||||
cmd = BLOCK_DUPLICATE;
|
||||
break;
|
||||
|
||||
case GR_KB_CTRL:
|
||||
cmd = BLOCK_ROTATE;
|
||||
break;
|
||||
|
||||
case GR_KB_SHIFTCTRL:
|
||||
cmd = BLOCK_DELETE;
|
||||
break;
|
||||
|
||||
case GR_KB_ALT:
|
||||
cmd = BLOCK_FLIP;
|
||||
break;
|
||||
|
||||
case MOUSE_MIDDLE:
|
||||
cmd = BLOCK_ZOOM;
|
||||
break;
|
||||
}
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||
{
|
||||
GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST;
|
||||
|
||||
if( !m_canvas->IsMouseCaptured() )
|
||||
{
|
||||
DisplayError( this, wxT( "Error in HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
|
||||
}
|
||||
|
||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
||||
|
||||
const BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();
|
||||
|
||||
switch( command )
|
||||
{
|
||||
case BLOCK_IDLE:
|
||||
break;
|
||||
|
||||
case BLOCK_DRAG: // Drag
|
||||
case BLOCK_MOVE: // Move
|
||||
case BLOCK_PRESELECT_MOVE: // Move with preselection list
|
||||
if( m_canvas->IsMouseCaptured() )
|
||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||
|
||||
Block_Move();
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
break;
|
||||
|
||||
case BLOCK_DUPLICATE: // Duplicate
|
||||
case BLOCK_DUPLICATE_AND_INCREMENT:
|
||||
if( m_canvas->IsMouseCaptured() )
|
||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||
|
||||
Block_Duplicate( command == BLOCK_DUPLICATE_AND_INCREMENT );
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE:
|
||||
break;
|
||||
|
||||
case BLOCK_ZOOM: // Handled by HandleBlockEnd()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
OnModify();
|
||||
|
||||
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
|
||||
GetScreen()->ClearBlockCommand();
|
||||
|
||||
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||
{
|
||||
DisplayError( this, wxT( "Error in HandleBlockPLace some items left in list" ) );
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||
{
|
||||
bool nextcmd = false; // Will be set to true if a block place is needed
|
||||
bool cancelCmd = false;
|
||||
// If coming here after cancel block, clean up and exit
|
||||
if( GetScreen()->m_BlockLocate.GetState() == STATE_NO_BLOCK )
|
||||
{
|
||||
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString,
|
||||
false );
|
||||
GetScreen()->ClearBlockCommand();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Show dialog if there are no selected items and we're not zooming
|
||||
if( !GetScreen()->m_BlockLocate.GetCount()
|
||||
&& GetScreen()->m_BlockLocate.GetCommand() != BLOCK_ZOOM )
|
||||
{
|
||||
if( InstallBlockCmdFrame( this, _( "Block Operation" ) ) == false )
|
||||
{
|
||||
cancelCmd = true;
|
||||
|
||||
// undraw block outline
|
||||
if( DC )
|
||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawAndSizingBlockOutlines( m_canvas, DC, wxDefaultPosition, false );
|
||||
Block_SelectItems();
|
||||
|
||||
// Exit if no items found
|
||||
if( !GetScreen()->m_BlockLocate.GetCount() )
|
||||
cancelCmd = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( !cancelCmd && m_canvas->IsMouseCaptured() )
|
||||
{
|
||||
switch( GetScreen()->m_BlockLocate.GetCommand() )
|
||||
{
|
||||
case BLOCK_IDLE:
|
||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||
break;
|
||||
|
||||
case BLOCK_DRAG: // Drag (not used, for future enhancements)
|
||||
case BLOCK_MOVE: // Move
|
||||
case BLOCK_DUPLICATE: // Duplicate
|
||||
case BLOCK_DUPLICATE_AND_INCREMENT: // Duplicate and increment relevant references
|
||||
case BLOCK_PRESELECT_MOVE: // Move with preselection list
|
||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
|
||||
nextcmd = true;
|
||||
m_canvas->SetMouseCaptureCallback( drawMovingBlock );
|
||||
if( DC )
|
||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||
break;
|
||||
|
||||
case BLOCK_DELETE: // Delete
|
||||
m_canvas->SetMouseCaptureCallback( NULL );
|
||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
||||
Block_Delete();
|
||||
break;
|
||||
|
||||
case BLOCK_ROTATE: // Rotation
|
||||
m_canvas->SetMouseCaptureCallback( NULL );
|
||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
||||
Block_Rotate();
|
||||
break;
|
||||
|
||||
case BLOCK_FLIP: // Flip
|
||||
m_canvas->SetMouseCaptureCallback( NULL );
|
||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
||||
Block_Flip();
|
||||
break;
|
||||
|
||||
case BLOCK_COPY: // Copy
|
||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
||||
|
||||
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||
{
|
||||
// @todo (if useful) Save_Block( );
|
||||
}
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE:
|
||||
break;
|
||||
|
||||
case BLOCK_ZOOM: // Window Zoom
|
||||
|
||||
// Turn off the redraw block routine now so it is not displayed
|
||||
// with one corner at the new center of the screen
|
||||
m_canvas->SetMouseCaptureCallback( NULL );
|
||||
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( ! nextcmd )
|
||||
{
|
||||
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
||||
GetScreen()->ClearBlockCommand();
|
||||
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString,
|
||||
false );
|
||||
}
|
||||
|
||||
return nextcmd;
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::Block_SelectItems()
|
||||
{
|
||||
LSET layerMask;
|
||||
bool selectOnlyComplete = GetScreen()->m_BlockLocate.GetWidth() > 0 ;
|
||||
|
||||
GetScreen()->m_BlockLocate.Normalize();
|
||||
|
||||
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
|
||||
ITEM_PICKER picker( NULL, UR_UNSPECIFIED );
|
||||
|
||||
// Add modules
|
||||
if( blockOpts.includeModules )
|
||||
{
|
||||
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
PCB_LAYER_ID layer = module->GetLayer();
|
||||
|
||||
if( module->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete )
|
||||
&& ( !module->IsLocked() || blockOpts.includeLockedModules ) )
|
||||
{
|
||||
if( blockOpts.includeItemsOnInvisibleLayers || m_Pcb->IsModuleLayerVisible( layer ) )
|
||||
{
|
||||
picker.SetItem ( module );
|
||||
itemsList->PushItem( picker );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add tracks and vias
|
||||
for( auto PtStruct : m_Pcb->Tracks() )
|
||||
{
|
||||
if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && !blockOpts.includeItemsOnInvisibleLayers )
|
||||
continue;
|
||||
|
||||
if( !( blockOpts.includeTracks && PtStruct->Type() == PCB_TRACE_T ) &&
|
||||
!( blockOpts.includeVias && PtStruct->Type() == PCB_VIA_T) )
|
||||
continue;
|
||||
|
||||
if( PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
|
||||
{
|
||||
picker.SetItem ( PtStruct );
|
||||
itemsList->PushItem( picker );
|
||||
}
|
||||
}
|
||||
|
||||
// Add graphic items
|
||||
layerMask = LSET( Edge_Cuts );
|
||||
|
||||
if( blockOpts.includeItemsOnTechLayers )
|
||||
layerMask.set();
|
||||
|
||||
if( !blockOpts.includeBoardOutlineLayer )
|
||||
layerMask.set( Edge_Cuts, false );
|
||||
|
||||
for( auto PtStruct : m_Pcb->Drawings() )
|
||||
{
|
||||
if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && ! blockOpts.includeItemsOnInvisibleLayers)
|
||||
continue;
|
||||
|
||||
bool select_me = false;
|
||||
|
||||
switch( PtStruct->Type() )
|
||||
{
|
||||
case PCB_LINE_T:
|
||||
if( !layerMask[PtStruct->GetLayer()] )
|
||||
break;
|
||||
|
||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
|
||||
break;
|
||||
|
||||
select_me = true; // This item is in bloc: select it
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
if( !blockOpts.includePcbTexts )
|
||||
break;
|
||||
|
||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
|
||||
break;
|
||||
|
||||
select_me = true; // This item is in bloc: select it
|
||||
break;
|
||||
|
||||
case PCB_TARGET_T:
|
||||
if( !layerMask[PtStruct->GetLayer()] )
|
||||
break;
|
||||
|
||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
|
||||
break;
|
||||
|
||||
select_me = true; // This item is in bloc: select it
|
||||
break;
|
||||
|
||||
case PCB_DIMENSION_T:
|
||||
if( !layerMask[PtStruct->GetLayer()] )
|
||||
break;
|
||||
|
||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
|
||||
break;
|
||||
|
||||
select_me = true; // This item is in bloc: select it
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if( select_me )
|
||||
{
|
||||
picker.SetItem ( PtStruct );
|
||||
itemsList->PushItem( picker );
|
||||
}
|
||||
}
|
||||
|
||||
// Add zones
|
||||
if( blockOpts.includeZones )
|
||||
{
|
||||
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* area = m_Pcb->GetArea( ii );
|
||||
|
||||
if( area->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
|
||||
{
|
||||
if( blockOpts.includeItemsOnInvisibleLayers
|
||||
|| m_Pcb->IsLayerVisible( area->GetLayer() ) )
|
||||
{
|
||||
BOARD_ITEM* zone_c = (BOARD_ITEM*) area;
|
||||
picker.SetItem ( zone_c );
|
||||
itemsList->PushItem( picker );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset )
|
||||
{
|
||||
PICKED_ITEMS_LIST* itemsList = &aPanel->GetScreen()->m_BlockLocate.GetItems();
|
||||
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
|
||||
|
||||
g_Offset_Module = -aOffset;
|
||||
|
||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_MODULE_T:
|
||||
frame->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
||||
((MODULE*) item)->DrawOutlinesWhenMoving( aPanel, aDC, g_Offset_Module );
|
||||
break;
|
||||
|
||||
case PCB_LINE_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TRACE_T:
|
||||
case PCB_VIA_T:
|
||||
case PCB_TARGET_T:
|
||||
case PCB_DIMENSION_T: // Currently markers are not affected by block commands
|
||||
case PCB_MARKER_T:
|
||||
item->Draw( aPanel, aDC, GR_XOR, aOffset );
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T:
|
||||
item->Draw( aPanel, aDC, GR_XOR, aOffset );
|
||||
((ZONE_CONTAINER*) item)->DrawFilledArea( aPanel, aDC, GR_XOR, aOffset );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_Offset_Module = wxPoint( 0, 0 );
|
||||
}
|
||||
|
||||
|
||||
static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||
bool aErase )
|
||||
{
|
||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
||||
|
||||
// do not show local module rastnest in block move, it is not usable.
|
||||
auto displ_opts = (PCB_DISPLAY_OPTIONS*)( aPanel->GetDisplayOptions() );
|
||||
bool showRats = displ_opts->m_Show_Module_Ratsnest;
|
||||
displ_opts->m_Show_Module_Ratsnest = false;
|
||||
|
||||
if( aErase )
|
||||
{
|
||||
if( screen->m_BlockLocate.GetMoveVector().x || screen->m_BlockLocate.GetMoveVector().y )
|
||||
{
|
||||
screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.GetMoveVector(),
|
||||
GR_XOR, BLOCK_OUTLINE_COLOR );
|
||||
|
||||
if( blockOpts.drawItems )
|
||||
drawPickedItems( aPanel, aDC, screen->m_BlockLocate.GetMoveVector() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
|
||||
{
|
||||
screen->m_BlockLocate.SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() -
|
||||
screen->m_BlockLocate.GetLastCursorPosition() );
|
||||
}
|
||||
|
||||
if( screen->m_BlockLocate.GetMoveVector().x || screen->m_BlockLocate.GetMoveVector().y )
|
||||
{
|
||||
screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.GetMoveVector(),
|
||||
GR_XOR, BLOCK_OUTLINE_COLOR );
|
||||
|
||||
if( blockOpts.drawItems )
|
||||
drawPickedItems( aPanel, aDC, screen->m_BlockLocate.GetMoveVector() );
|
||||
}
|
||||
|
||||
displ_opts->m_Show_Module_Ratsnest = showRats;
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::Block_Delete()
|
||||
{
|
||||
OnModify();
|
||||
SetCurItem( NULL );
|
||||
|
||||
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
|
||||
itemsList->m_Status = UR_DELETED;
|
||||
|
||||
// unlink items and clear flags
|
||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||
itemsList->SetPickedItemStatus( UR_DELETED, ii );
|
||||
GetBoard()->GetConnectivity()->Remove( item );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_MODULE_T:
|
||||
{
|
||||
MODULE* module = (MODULE*) item;
|
||||
module->ClearFlags();
|
||||
module->UnLink();
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T: // a zone area
|
||||
m_Pcb->Remove( item );
|
||||
break;
|
||||
|
||||
case PCB_LINE_T: // a segment not on copper layers
|
||||
case PCB_TEXT_T: // a text on a layer
|
||||
case PCB_TRACE_T: // a track segment (segment on a copper layer)
|
||||
case PCB_VIA_T: // a via (like track segment on a copper layer)
|
||||
case PCB_DIMENSION_T: // a dimension (graphic item)
|
||||
case PCB_TARGET_T: // a target (graphic item)
|
||||
item->UnLink();
|
||||
break;
|
||||
|
||||
// These items are deleted, but not put in undo list
|
||||
case PCB_MARKER_T: // a marker used to show something
|
||||
item->UnLink();
|
||||
itemsList->RemovePicker( ii );
|
||||
ii--;
|
||||
item->DeleteStructure();
|
||||
break;
|
||||
|
||||
default:
|
||||
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Delete( ) error: unexpected type" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SaveCopyInUndoList( *itemsList, UR_DELETED );
|
||||
|
||||
Compile_Ratsnest( NULL, true );
|
||||
m_canvas->Refresh( true );
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::Block_Rotate()
|
||||
{
|
||||
// 6.0 TODO: This is the legacy toolset version
|
||||
|
||||
wxPoint centre; // rotation cent-re for the rotation transform
|
||||
int rotAngle = m_rotationAngle; // rotation angle in 0.1 deg.
|
||||
|
||||
centre = GetScreen()->m_BlockLocate.Centre();
|
||||
|
||||
OnModify();
|
||||
|
||||
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
|
||||
itemsList->m_Status = UR_CHANGED;
|
||||
|
||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||
wxASSERT( item );
|
||||
itemsList->SetPickedItemStatus( UR_CHANGED, ii );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_MODULE_T:
|
||||
( (MODULE*) item )->ClearFlags();
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
break;
|
||||
|
||||
// Move and rotate the track segments
|
||||
case PCB_TRACE_T: // a track segment (segment on a copper layer)
|
||||
case PCB_VIA_T: // a via (like track segment on a copper layer)
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T:
|
||||
case PCB_LINE_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TARGET_T:
|
||||
case PCB_DIMENSION_T:
|
||||
break;
|
||||
|
||||
default:
|
||||
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Rotate( ) error: unexpected type" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Save all the block items in there current state before applying the rotation.
|
||||
SaveCopyInUndoList( *itemsList, UR_CHANGED, centre );
|
||||
|
||||
// Now perform the rotation.
|
||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||
wxASSERT( item );
|
||||
item->Rotate( centre, rotAngle );
|
||||
GetBoard()->GetConnectivity()->Update( item );
|
||||
}
|
||||
|
||||
Compile_Ratsnest( NULL, true );
|
||||
m_canvas->Refresh( true );
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::Block_Flip()
|
||||
{
|
||||
#define INVERT( pos ) (pos) = center.y - ( (pos) - center.y )
|
||||
wxPoint center; // Position of the axis for inversion of all elements
|
||||
|
||||
OnModify();
|
||||
|
||||
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
|
||||
itemsList->m_Status = UR_FLIPPED;
|
||||
|
||||
center = GetScreen()->m_BlockLocate.Centre();
|
||||
|
||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||
wxASSERT( item );
|
||||
itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
|
||||
item->Flip( center );
|
||||
GetBoard()->GetConnectivity()->Update( item );
|
||||
|
||||
// If a connected item is flipped, the ratsnest is no more OK
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_MODULE_T:
|
||||
item->ClearFlags();
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
break;
|
||||
|
||||
case PCB_TRACE_T:
|
||||
case PCB_VIA_T:
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T:
|
||||
case PCB_LINE_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TARGET_T:
|
||||
case PCB_DIMENSION_T:
|
||||
break;
|
||||
|
||||
default:
|
||||
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Flip( ) error: unexpected type" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SaveCopyInUndoList( *itemsList, UR_FLIPPED, center );
|
||||
Compile_Ratsnest( NULL, true );
|
||||
m_canvas->Refresh( true );
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::Block_Move()
|
||||
{
|
||||
OnModify();
|
||||
|
||||
wxPoint MoveVector = GetScreen()->m_BlockLocate.GetMoveVector();
|
||||
|
||||
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
|
||||
itemsList->m_Status = UR_MOVED;
|
||||
|
||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||
itemsList->SetPickedItemStatus( UR_MOVED, ii );
|
||||
item->Move( MoveVector );
|
||||
GetBoard()->GetConnectivity()->Update( item );
|
||||
item->ClearFlags( IS_MOVED );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_MODULE_T:
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
item->ClearFlags();
|
||||
break;
|
||||
|
||||
// Move track segments
|
||||
case PCB_TRACE_T: // a track segment (segment on a copper layer)
|
||||
case PCB_VIA_T: // a via (like a track segment on a copper layer)
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
break;
|
||||
|
||||
case PCB_ZONE_AREA_T:
|
||||
case PCB_LINE_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TARGET_T:
|
||||
case PCB_DIMENSION_T:
|
||||
break;
|
||||
|
||||
default:
|
||||
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Move( ) error: unexpected type" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SaveCopyInUndoList( *itemsList, UR_MOVED, MoveVector );
|
||||
|
||||
Compile_Ratsnest( NULL, true );
|
||||
m_canvas->Refresh( true );
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::Block_Duplicate( bool aIncrement )
|
||||
{
|
||||
wxPoint MoveVector = GetScreen()->m_BlockLocate.GetMoveVector();
|
||||
|
||||
OnModify();
|
||||
|
||||
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
|
||||
|
||||
PICKED_ITEMS_LIST newList;
|
||||
newList.m_Status = UR_NEW;
|
||||
|
||||
ITEM_PICKER picker( NULL, UR_NEW );
|
||||
BOARD_ITEM* newitem;
|
||||
|
||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||
|
||||
newitem = (BOARD_ITEM*)item->Clone();
|
||||
|
||||
if( item->Type() == PCB_MODULE_T )
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
|
||||
m_Pcb->Add( newitem );
|
||||
|
||||
if( newitem )
|
||||
{
|
||||
newitem->Move( MoveVector );
|
||||
picker.SetItem ( newitem );
|
||||
newList.PushItem( picker );
|
||||
}
|
||||
}
|
||||
|
||||
if( newList.GetCount() )
|
||||
SaveCopyInUndoList( newList, UR_NEW );
|
||||
|
||||
Compile_Ratsnest( NULL, true );
|
||||
m_canvas->Refresh( true );
|
||||
}
|
|
@ -235,43 +235,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
InstallPcbGlobalDeleteFrame( wxDefaultPosition );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PLACE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
|
||||
m_canvas->SetAutoPanRequest( false );
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_DUPLICATE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_DUPLICATE );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
m_canvas->SetAutoPanRequest( false );
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_DELETE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ROTATE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_FLIP_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_FLIP );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_DRC_CONTROL:
|
||||
// Shows the DRC dialog in non modal mode, to allows board editing
|
||||
// with the DRC dialog opened and showing errors.
|
||||
|
|
|
@ -262,12 +262,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
|
||||
case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
|
||||
case ID_POPUP_PCB_DELETE_EDGE:
|
||||
case ID_POPUP_DELETE_BLOCK:
|
||||
case ID_POPUP_PLACE_BLOCK:
|
||||
case ID_POPUP_ZOOM_BLOCK:
|
||||
case ID_POPUP_MIRROR_X_BLOCK:
|
||||
case ID_POPUP_ROTATE_BLOCK:
|
||||
case ID_POPUP_DUPLICATE_BLOCK:
|
||||
break;
|
||||
|
||||
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
||||
|
@ -706,49 +700,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
case ID_POPUP_PLACE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
|
||||
m_canvas->SetAutoPanRequest( false );
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_DUPLICATE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_DUPLICATE );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
m_canvas->SetAutoPanRequest( false );
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_DELETE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ROTATE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_MIRROR_X_BLOCK:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_MIRROR_X );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_MOVE_BLOCK_EXACT:
|
||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE_EXACT );
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_GEN_IMPORT_GRAPHICS_FILE:
|
||||
if( GetBoard()->m_Modules )
|
||||
{
|
||||
|
|
|
@ -44,16 +44,6 @@ void PCB_EDIT_FRAME::ProcessMuWaveFunctions( wxCommandEvent& event )
|
|||
|
||||
pos.y += 20;
|
||||
|
||||
switch( id ) // End any command in progress.
|
||||
{
|
||||
case ID_POPUP_DUPLICATE_BLOCK:
|
||||
break;
|
||||
|
||||
default: // End block command in progress.
|
||||
m_canvas->EndMouseCapture( );
|
||||
break;
|
||||
}
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
||||
|
|
|
@ -668,83 +668,6 @@ public:
|
|||
void OnFlipPcbView( wxCommandEvent& event );
|
||||
void ToolOnRightClick( wxCommandEvent& event ) override;
|
||||
|
||||
/* Block operations: */
|
||||
|
||||
/**
|
||||
* Function BlockCommand
|
||||
* Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...)
|
||||
* corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when
|
||||
* block command is started by dragging the mouse.
|
||||
* @param aKey = the key modifiers (Alt, Shift ...)
|
||||
* @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
|
||||
*/
|
||||
virtual int BlockCommand( EDA_KEY aKey ) override;
|
||||
|
||||
/**
|
||||
* Function HandleBlockPlace()
|
||||
* Called after HandleBlockEnd, when a block command needs to be
|
||||
* executed after the block is moved to its new place
|
||||
* (bloc move, drag, copy .. )
|
||||
* Parameters must be initialized in GetScreen()->m_BlockLocate
|
||||
*/
|
||||
virtual void HandleBlockPlace( wxDC* DC ) override;
|
||||
|
||||
/**
|
||||
* Function HandleBlockEnd()
|
||||
* Handle the "end" of a block command,
|
||||
* i.e. is called at the end of the definition of the area of a block.
|
||||
* depending on the current block command, this command is executed
|
||||
* or parameters are initialized to prepare a call to HandleBlockPlace
|
||||
* in GetScreen()->m_BlockLocate
|
||||
* @return false if no item selected, or command finished,
|
||||
* true if some items found and HandleBlockPlace must be called later
|
||||
*/
|
||||
virtual bool HandleBlockEnd( wxDC* DC ) override;
|
||||
|
||||
/**
|
||||
* Function Block_SelectItems
|
||||
* Uses GetScreen()->m_BlockLocate
|
||||
* select items within the selected block.
|
||||
* selected items are put in the pick list
|
||||
*/
|
||||
void Block_SelectItems();
|
||||
|
||||
/**
|
||||
* Function Block_Delete
|
||||
* deletes all items within the selected block.
|
||||
*/
|
||||
void Block_Delete();
|
||||
|
||||
/**
|
||||
* Function Block_Rotate
|
||||
* Rotate all items within the selected block.
|
||||
* The rotation center is the center of the block
|
||||
*/
|
||||
void Block_Rotate();
|
||||
|
||||
/**
|
||||
* Function Block_Flip
|
||||
* Flip items within the selected block.
|
||||
* The flip center is the center of the block
|
||||
*/
|
||||
void Block_Flip();
|
||||
|
||||
/**
|
||||
* Function Block_Move
|
||||
* move all items within the selected block.
|
||||
* New location is determined by the current offset from the selected
|
||||
* block's original location.
|
||||
*/
|
||||
void Block_Move();
|
||||
|
||||
/**
|
||||
* Function Block_Duplicate
|
||||
* Duplicate all items within the selected block.
|
||||
* New location is determined by the current offset from the selected
|
||||
* block's original location.
|
||||
*/
|
||||
void Block_Duplicate( bool aIncrement );
|
||||
|
||||
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
|
||||
|
||||
/**
|
||||
|
|
|
@ -1006,7 +1006,6 @@ void PCBNEW_CONTROL::setTransitions()
|
|||
Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
|
||||
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() );
|
||||
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() );
|
||||
Go( &PCBNEW_CONTROL::TogglePolarCoords, PCB_ACTIONS::togglePolarCoords.MakeEvent() );
|
||||
Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
|
||||
Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
|
||||
Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() );
|
||||
|
|
Loading…
Reference in New Issue