2011-10-28 13:43:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
|
|
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 2004-2011 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
|
|
|
|
*/
|
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
|
|
|
* @file block_libedit.cpp
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
|
|
|
|
#include <general.h>
|
|
|
|
#include <class_library.h>
|
|
|
|
#include <libeditframe.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int LIB_EDIT_FRAME::BlockCommand( int key )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2012-05-20 19:18:06 +00:00
|
|
|
int cmd = BLOCK_IDLE;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
switch( key )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
cmd = key & 0x255;
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-10-28 13:43:37 +00:00
|
|
|
case -1:
|
2007-08-20 01:20:48 +00:00
|
|
|
cmd = BLOCK_PRESELECT_MOVE;
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case 0:
|
|
|
|
cmd = BLOCK_MOVE;
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case GR_KB_SHIFT:
|
|
|
|
cmd = BLOCK_COPY;
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-05-20 19:18:06 +00:00
|
|
|
case GR_KB_ALT:
|
|
|
|
cmd = BLOCK_ROTATE;
|
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case GR_KB_SHIFTCTRL:
|
|
|
|
cmd = BLOCK_DELETE;
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case GR_KB_CTRL:
|
2009-08-12 10:40:01 +00:00
|
|
|
cmd = BLOCK_MIRROR_Y;
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case MOUSE_MIDDLE:
|
|
|
|
cmd = BLOCK_ZOOM;
|
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
return cmd;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
int ItemCount = 0;
|
2010-11-13 11:02:24 +00:00
|
|
|
int nextCmd = false;
|
2009-09-29 18:38:21 +00:00
|
|
|
wxPoint pt;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
if( GetScreen()->m_BlockLocate.GetCount() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
BLOCK_STATE_T state = GetScreen()->m_BlockLocate.GetState();
|
|
|
|
BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->CallEndMouseCapture( DC );
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( state );
|
|
|
|
GetScreen()->m_BlockLocate.SetCommand( command );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
|
|
|
|
GetScreen()->m_BlockLocate.GetBottom() ) );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
switch( GetScreen()->m_BlockLocate.GetCommand() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case BLOCK_IDLE:
|
|
|
|
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_DRAG: /* Drag */
|
|
|
|
case BLOCK_MOVE: /* Move */
|
|
|
|
case BLOCK_COPY: /* Copy */
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
|
|
|
ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
|
2010-10-20 20:24:26 +00:00
|
|
|
m_unit, m_convert,
|
2011-10-28 13:43:37 +00:00
|
|
|
m_editPinsPerPartOrConvert );
|
2009-09-25 18:49:04 +00:00
|
|
|
if( ItemCount )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-11-13 11:02:24 +00:00
|
|
|
nextCmd = true;
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
|
|
|
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
|
|
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
2010-11-13 11:02:24 +00:00
|
|
|
nextCmd = true;
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_DELETE: /* Delete */
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
|
|
|
ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
|
2010-10-20 20:24:26 +00:00
|
|
|
m_unit, m_convert,
|
2011-10-28 13:43:37 +00:00
|
|
|
m_editPinsPerPartOrConvert );
|
2009-09-25 18:49:04 +00:00
|
|
|
if( ItemCount )
|
|
|
|
SaveCopyInUndoList( m_component );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
2011-01-23 12:32:33 +00:00
|
|
|
{
|
2009-10-10 17:27:53 +00:00
|
|
|
m_component->DeleteSelectedItems();
|
2011-01-23 12:32:33 +00:00
|
|
|
OnModify();
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_SAVE: /* Save */
|
|
|
|
case BLOCK_PASTE:
|
2009-08-12 10:40:01 +00:00
|
|
|
case BLOCK_FLIP:
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
2011-05-20 18:29:35 +00:00
|
|
|
case BLOCK_ROTATE:
|
|
|
|
case BLOCK_MIRROR_X:
|
2009-08-12 10:40:01 +00:00
|
|
|
case BLOCK_MIRROR_Y:
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
|
|
|
ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
|
2010-10-20 20:24:26 +00:00
|
|
|
m_unit, m_convert,
|
2011-10-28 13:43:37 +00:00
|
|
|
m_editPinsPerPartOrConvert );
|
2009-09-25 18:49:04 +00:00
|
|
|
if( ItemCount )
|
|
|
|
SaveCopyInUndoList( m_component );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
pt = GetScreen()->m_BlockLocate.Centre();
|
2013-08-03 05:15:23 +00:00
|
|
|
pt = GetNearestGridPosition( pt );
|
2012-05-20 19:18:06 +00:00
|
|
|
NEGATE( pt.y );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
2011-01-23 12:32:33 +00:00
|
|
|
{
|
|
|
|
OnModify();
|
2012-03-26 23:47:08 +00:00
|
|
|
int block_cmd = GetScreen()->m_BlockLocate.GetCommand();
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2011-05-20 18:29:35 +00:00
|
|
|
if( block_cmd == BLOCK_MIRROR_Y)
|
|
|
|
m_component->MirrorSelectedItemsH( pt );
|
|
|
|
else if( block_cmd == BLOCK_MIRROR_X)
|
|
|
|
m_component->MirrorSelectedItemsV( pt );
|
2013-08-03 05:15:23 +00:00
|
|
|
else if( block_cmd == BLOCK_ROTATE )
|
2011-05-20 18:29:35 +00:00
|
|
|
m_component->RotateSelectedItems( pt );
|
2011-01-23 12:32:33 +00:00
|
|
|
}
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ZOOM: /* Window Zoom */
|
2009-07-25 04:53:39 +00:00
|
|
|
Window_Zoom( GetScreen()->m_BlockLocate );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ABORT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_SELECT_ITEMS_ONLY:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
if( ! nextCmd )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_SELECT_ITEMS_ONLY && m_component )
|
2011-02-11 20:48:13 +00:00
|
|
|
m_component->ClearSelectedItems();
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
|
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
|
2007-08-20 01:20:48 +00:00
|
|
|
GetScreen()->SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString,
|
|
|
|
false );
|
|
|
|
m_canvas->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
return nextCmd;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
wxPoint pt;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
if( !m_canvas->IsMouseCaptured() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
switch( GetScreen()->m_BlockLocate.GetCommand() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case BLOCK_IDLE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_DRAG: /* Drag */
|
|
|
|
case BLOCK_MOVE: /* Move */
|
|
|
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
|
|
|
SaveCopyInUndoList( m_component );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
pt = GetScreen()->m_BlockLocate.GetMoveVector();
|
2009-09-29 18:38:21 +00:00
|
|
|
pt.y *= -1;
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
|
|
|
m_component->MoveSelectedItems( pt );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_COPY: /* Copy */
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
|
|
|
SaveCopyInUndoList( m_component );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
pt = GetScreen()->m_BlockLocate.GetMoveVector();
|
2012-05-20 19:18:06 +00:00
|
|
|
NEGATE( pt.y );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
|
|
|
m_component->CopySelectedItems( pt );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
case BLOCK_PASTE: /* Paste (recopy the last block saved) */
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-05-20 18:29:35 +00:00
|
|
|
case BLOCK_ROTATE: // Invert by popup menu, from block move
|
|
|
|
case BLOCK_MIRROR_X: // Invert by popup menu, from block move
|
|
|
|
case BLOCK_MIRROR_Y: // Invert by popup menu, from block move
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
|
|
|
SaveCopyInUndoList( m_component );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
pt = GetScreen()->m_BlockLocate.Centre();
|
2013-08-03 05:15:23 +00:00
|
|
|
pt = GetNearestGridPosition( pt );
|
2012-05-13 15:31:58 +00:00
|
|
|
NEGATE( pt.y );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if ( m_component )
|
2011-05-20 18:29:35 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
int block_cmd = GetScreen()->m_BlockLocate.GetCommand();
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2011-05-20 18:29:35 +00:00
|
|
|
if( block_cmd == BLOCK_MIRROR_Y)
|
|
|
|
m_component->MirrorSelectedItemsH( pt );
|
|
|
|
else if( block_cmd == BLOCK_MIRROR_X)
|
|
|
|
m_component->MirrorSelectedItemsV( pt );
|
|
|
|
else if( block_cmd == BLOCK_ROTATE )
|
|
|
|
m_component->RotateSelectedItems( pt );
|
|
|
|
}
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
|
|
|
case BLOCK_DELETE:
|
|
|
|
case BLOCK_SAVE:
|
|
|
|
case BLOCK_ABORT:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-02-18 20:07:29 +00:00
|
|
|
OnModify();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
|
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
|
2007-08-20 01:20:48 +00:00
|
|
|
GetScreen()->SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
|
|
|
|
m_canvas->Refresh( true );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-04 18:57:37 +00:00
|
|
|
/*
|
2009-11-03 13:26:31 +00:00
|
|
|
* Traces the outline of the search block structures
|
|
|
|
* The entire block follows the cursor
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2011-02-03 19:27:28 +00:00
|
|
|
void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
BLOCK_SELECTOR* block;
|
2011-02-03 19:27:28 +00:00
|
|
|
BASE_SCREEN* screen = aPanel->GetScreen();
|
2007-08-20 01:20:48 +00:00
|
|
|
wxPoint move_offset;
|
2012-03-26 23:47:08 +00:00
|
|
|
block = &screen->m_BlockLocate;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
LIB_EDIT_FRAME* parent = ( LIB_EDIT_FRAME* ) aPanel->GetParent();
|
2009-09-22 12:27:57 +00:00
|
|
|
wxASSERT( parent != NULL );
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
LIB_COMPONENT* component = parent->GetComponent();
|
2009-09-22 12:27:57 +00:00
|
|
|
|
|
|
|
if( component == NULL )
|
|
|
|
return;
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
int unit = parent->GetUnit();
|
|
|
|
int convert = parent->GetConvert();
|
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
if( aErase )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
component->Draw( aPanel, aDC, block->GetMoveVector(), unit, convert,
|
2012-09-02 12:06:47 +00:00
|
|
|
g_XorMode, UNSPECIFIED_COLOR, DefaultTransform, true, true, true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2012-09-02 12:06:47 +00:00
|
|
|
// Repaint new view
|
2013-08-03 05:15:23 +00:00
|
|
|
block->SetMoveVector( parent->GetCrossHairPosition() - block->GetLastCursorPosition() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
GRSetDrawMode( aDC, g_XorMode );
|
2012-03-26 23:47:08 +00:00
|
|
|
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
component->Draw( aPanel, aDC, block->GetMoveVector(), unit, convert,
|
2012-09-02 12:06:47 +00:00
|
|
|
g_XorMode, UNSPECIFIED_COLOR, DefaultTransform, true, true, true );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|