2012-01-04 22:08:46 +00:00
|
|
|
/*
|
2011-10-19 20:32:21 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-04-26 16:32:16 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2013-04-16 10:53:23 +00:00
|
|
|
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
2015-04-26 16:32:16 +00:00
|
|
|
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
|
2011-10-19 20:32:21 +00:00
|
|
|
*
|
|
|
|
* 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 schedit.cpp
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
* 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
|
|
|
#include <kiway.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <gr_basic.h>
|
* 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
|
|
|
#include <pgm_base.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <eda_doc.h>
|
2015-02-21 09:46:44 +00:00
|
|
|
#include <schframe.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <kicad_device_context.h>
|
|
|
|
#include <hotkeys_basic.h>
|
|
|
|
|
|
|
|
#include <general.h>
|
|
|
|
#include <eeschema_id.h>
|
|
|
|
#include <protos.h>
|
|
|
|
#include <class_library.h>
|
|
|
|
#include <sch_bus_entry.h>
|
|
|
|
#include <sch_marker.h>
|
|
|
|
#include <sch_component.h>
|
|
|
|
#include <sch_junction.h>
|
|
|
|
#include <sch_line.h>
|
|
|
|
#include <sch_sheet.h>
|
2013-09-25 19:09:57 +00:00
|
|
|
#include <sch_sheet_path.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
wxPoint pos;
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2011-03-25 19:16:05 +00:00
|
|
|
SCH_ITEM* item = screen->GetCurItem();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
pos = wxGetMousePosition();
|
|
|
|
|
|
|
|
pos.y += 20;
|
|
|
|
|
|
|
|
// If needed, stop the current command and deselect current tool
|
|
|
|
switch( id )
|
|
|
|
{
|
2011-03-11 14:44:08 +00:00
|
|
|
case wxID_CUT:
|
|
|
|
case wxID_COPY:
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
2008-03-10 11:42:41 +00:00
|
|
|
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
|
|
|
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
|
2012-10-23 16:37:19 +00:00
|
|
|
case ID_POPUP_SCH_BEGIN_WIRE:
|
|
|
|
case ID_POPUP_SCH_BEGIN_BUS:
|
2008-03-10 11:42:41 +00:00
|
|
|
case ID_POPUP_END_LINE:
|
|
|
|
case ID_POPUP_SCH_SET_SHAPE_TEXT:
|
|
|
|
case ID_POPUP_SCH_CLEANUP_SHEET:
|
|
|
|
case ID_POPUP_SCH_END_SHEET:
|
|
|
|
case ID_POPUP_SCH_RESIZE_SHEET:
|
2015-07-24 10:23:34 +00:00
|
|
|
case ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN:
|
2008-03-10 11:42:41 +00:00
|
|
|
case ID_POPUP_SCH_INIT_CMP:
|
|
|
|
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
|
|
|
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
|
|
|
case ID_POPUP_DRAG_BLOCK:
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
|
|
|
case ID_POPUP_SCH_DELETE_NODE:
|
|
|
|
case ID_POPUP_SCH_DELETE_CONNECTION:
|
|
|
|
case ID_POPUP_SCH_ENTER_SHEET:
|
|
|
|
case ID_POPUP_SCH_LEAVE_SHEET:
|
|
|
|
case ID_POPUP_SCH_ADD_JUNCTION:
|
|
|
|
case ID_POPUP_SCH_ADD_LABEL:
|
2009-07-08 15:42:45 +00:00
|
|
|
case ID_POPUP_SCH_GETINFO_MARKER:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* At this point: Do nothing. these commands do not need to stop the
|
|
|
|
* current command (mainly a block command) or reset the current state
|
|
|
|
* They will be executed later, in next switch structure.
|
2008-03-10 11:42:41 +00:00
|
|
|
*/
|
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_POPUP_SCH_DELETE_CMP:
|
2009-11-04 20:46:53 +00:00
|
|
|
case ID_POPUP_SCH_DELETE:
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2009-12-20 19:48:58 +00:00
|
|
|
// Stop the current command (if any) but keep the current tool
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
default:
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Stop the current command and deselect the current tool
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2011-05-16 19:32:57 +00:00
|
|
|
item = screen->GetCurItem(); // Can be modified by previous calls.
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
switch( id )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case ID_HIERARCHY:
|
2015-07-11 07:37:52 +00:00
|
|
|
InstallHierarchyFrame( pos );
|
2013-08-05 21:02:41 +00:00
|
|
|
SetRepeatItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_CUT:
|
2012-03-26 23:47:08 +00:00
|
|
|
if( screen->m_BlockLocate.GetCommand() != BLOCK_MOVE )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2011-10-27 13:34:28 +00:00
|
|
|
|
2013-10-15 16:18:30 +00:00
|
|
|
screen->m_BlockLocate.SetCommand( BLOCK_DELETE );
|
|
|
|
screen->m_BlockLocate.SetMessageBlock( this );
|
|
|
|
HandleBlockEnd( &dc );
|
2013-08-05 21:02:41 +00:00
|
|
|
SetRepeatItem( NULL );
|
2009-01-06 20:09:32 +00:00
|
|
|
SetSheetNumberAndCount();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_PASTE:
|
2013-08-03 05:15:23 +00:00
|
|
|
HandleBlockBegin( &dc, BLOCK_PASTE, GetCrossHairPosition() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2013-04-01 10:35:20 +00:00
|
|
|
SetBusEntryShape( &dc, dynamic_cast<SCH_BUS_ENTRY_BASE*>( item ), '/' );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2013-04-01 10:35:20 +00:00
|
|
|
SetBusEntryShape( &dc, dynamic_cast<SCH_BUS_ENTRY_BASE*>( item ), '\\' );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() )
|
2011-03-11 14:44:08 +00:00
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture();
|
|
|
|
SetToolID( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString );
|
2011-03-11 14:44:08 +00:00
|
|
|
}
|
|
|
|
else
|
2011-10-27 17:51:22 +00:00
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
2011-10-27 17:51:22 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_END_LINE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
EndSegment( &dc );
|
|
|
|
break;
|
|
|
|
|
2012-10-23 16:37:19 +00:00
|
|
|
case ID_POPUP_SCH_BEGIN_WIRE:
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2013-08-03 05:15:23 +00:00
|
|
|
OnLeftClick( &dc, GetCrossHairPosition() );
|
2012-10-23 16:37:19 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-10-23 16:37:19 +00:00
|
|
|
case ID_POPUP_SCH_BEGIN_BUS:
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2013-08-03 05:15:23 +00:00
|
|
|
OnLeftClick( &dc, GetCrossHairPosition() );
|
2012-10-23 16:37:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_SET_SHAPE_TEXT:
|
2008-02-21 12:21:01 +00:00
|
|
|
// Not used
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_DELETE_NODE:
|
|
|
|
case ID_POPUP_SCH_DELETE_CONNECTION:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-04-15 12:40:56 +00:00
|
|
|
DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION );
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( NULL );
|
2013-08-05 21:02:41 +00:00
|
|
|
SetRepeatItem( NULL );
|
2016-02-19 15:41:32 +00:00
|
|
|
|
|
|
|
if( screen->TestDanglingEnds() )
|
|
|
|
m_canvas->Refresh();
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_BREAK_WIRE:
|
2012-02-26 18:39:39 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
DLIST< SCH_ITEM > oldWires;
|
2012-02-26 18:39:39 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
oldWires.SetOwnership( false ); // Prevent DLIST for deleting items in destructor.
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
screen->ExtractWires( oldWires, true );
|
|
|
|
screen->BreakSegment( GetCrossHairPosition() );
|
2012-02-26 18:39:39 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( oldWires.GetCount() != 0 )
|
2012-02-26 18:39:39 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
PICKED_ITEMS_LIST oldItems;
|
|
|
|
|
|
|
|
oldItems.m_Status = UR_WIRE_IMAGE;
|
|
|
|
|
|
|
|
while( oldWires.GetCount() != 0 )
|
|
|
|
{
|
|
|
|
ITEM_PICKER picker = ITEM_PICKER( oldWires.PopFront(), UR_WIRE_IMAGE );
|
|
|
|
oldItems.PushItem( picker );
|
|
|
|
}
|
|
|
|
|
|
|
|
SaveCopyInUndoList( oldItems, UR_WIRE_IMAGE );
|
2012-02-26 18:39:39 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 15:41:32 +00:00
|
|
|
if( screen->TestDanglingEnds() )
|
|
|
|
m_canvas->Refresh();
|
2012-02-26 18:39:39 +00:00
|
|
|
}
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_DELETE_CMP:
|
|
|
|
case ID_POPUP_SCH_DELETE:
|
2010-09-05 17:01:48 +00:00
|
|
|
if( item == NULL )
|
|
|
|
break;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
DeleteItem( item );
|
2010-09-05 17:01:48 +00:00
|
|
|
screen->SetCurItem( NULL );
|
2013-08-05 21:02:41 +00:00
|
|
|
SetRepeatItem( NULL );
|
2016-02-19 15:41:32 +00:00
|
|
|
screen->TestDanglingEnds();
|
2010-09-05 17:01:48 +00:00
|
|
|
SetSheetNumberAndCount();
|
2016-02-19 15:41:32 +00:00
|
|
|
m_canvas->Refresh();
|
2010-09-05 17:01:48 +00:00
|
|
|
OnModify();
|
2011-03-25 19:16:05 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_END_SHEET:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2015-06-28 16:45:05 +00:00
|
|
|
addCurrentItemToList();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_RESIZE_SHEET:
|
2011-03-25 19:16:05 +00:00
|
|
|
ReSizeSheet( (SCH_SHEET*) item, &dc );
|
2016-02-19 15:41:32 +00:00
|
|
|
|
|
|
|
if( screen->TestDanglingEnds() )
|
|
|
|
m_canvas->Refresh();
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2015-07-24 10:23:34 +00:00
|
|
|
case ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN:
|
2011-03-25 19:16:05 +00:00
|
|
|
if( item != NULL && item->Type() == SCH_SHEET_T )
|
2011-03-30 19:26:05 +00:00
|
|
|
screen->SetCurItem( ImportSheetPin( (SCH_SHEET*) item, &dc ) );
|
2009-05-16 05:38:38 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_CLEANUP_SHEET:
|
2011-03-25 19:16:05 +00:00
|
|
|
if( item != NULL && item->Type() == SCH_SHEET_T )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2011-03-25 19:16:05 +00:00
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) item;
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
if( !sheet->HasUndefinedPins() )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
|
|
|
DisplayInfoMessage( this,
|
2010-12-08 20:12:46 +00:00
|
|
|
_( "There are no undefined labels in this sheet to clean up." ) );
|
2010-06-24 18:31:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
if( !IsOK( this, _( "Do you wish to cleanup this sheet?" ) ) )
|
2010-06-24 18:31:43 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Save sheet in undo list before cleaning up unreferenced hierarchical labels. */
|
|
|
|
SaveCopyInUndoList( sheet, UR_CHANGED );
|
|
|
|
sheet->CleanupSheet();
|
|
|
|
OnModify();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->RefreshDrawingRect( sheet->GetBoundingBox() );
|
2010-06-24 18:31:43 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_INIT_CMP:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2011-03-29 15:21:35 +00:00
|
|
|
// Ensure the struct is a component (could be a struct of a component, like Field, text..)
|
2011-03-25 19:16:05 +00:00
|
|
|
if( item && item->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-03-25 19:16:05 +00:00
|
|
|
ConvertPart( (SCH_COMPONENT*) item, &dc );
|
|
|
|
}
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
2008-03-10 11:42:41 +00:00
|
|
|
|
2011-03-29 15:21:35 +00:00
|
|
|
// Ensure the struct is a component (could be a piece of a component, like Field, text..)
|
2011-03-25 19:16:05 +00:00
|
|
|
if( item && item->Type() == SCH_COMPONENT_T )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( PART_LIBS* libs = Prj().SchLibs() )
|
2009-04-07 11:53:58 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_ALIAS* entry = libs->FindLibraryEntry( ( (SCH_COMPONENT*) item )->GetPartName() );
|
|
|
|
|
|
|
|
if( entry && !!entry->GetDocFileName() )
|
|
|
|
{
|
|
|
|
SEARCH_STACK* lib_search = Prj().SchSearchS();
|
* 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
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
GetAssociatedDocument( this, entry->GetDocFileName(), lib_search );
|
|
|
|
}
|
2009-04-07 11:53:58 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ENTER_SHEET:
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
if( item && (item->Type() == SCH_SHEET_T) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2016-02-27 19:35:45 +00:00
|
|
|
m_CurrentSheet->push_back( (SCH_SHEET*) item );
|
2011-02-05 02:21:11 +00:00
|
|
|
DisplayCurrentSheet();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-03-25 19:16:05 +00:00
|
|
|
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_SCH_LEAVE_SHEET:
|
2015-06-12 21:31:44 +00:00
|
|
|
if( m_CurrentSheet->Last() != g_RootSheet )
|
|
|
|
{
|
2016-02-27 19:35:45 +00:00
|
|
|
m_CurrentSheet->pop_back();
|
2015-06-12 21:31:44 +00:00
|
|
|
DisplayCurrentSheet();
|
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_COPY: // really this is a Save block for paste
|
2013-10-15 16:18:30 +00:00
|
|
|
screen->m_BlockLocate.SetCommand( BLOCK_SAVE );
|
|
|
|
screen->m_BlockLocate.SetMessageBlock( this );
|
|
|
|
HandleBlockEnd( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAutoPanRequest( false );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
2013-10-15 16:18:30 +00:00
|
|
|
screen->m_BlockLocate.SetCommand( BLOCK_ZOOM );
|
|
|
|
screen->m_BlockLocate.SetMessageBlock( this );
|
|
|
|
HandleBlockEnd( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
2015-08-09 15:04:49 +00:00
|
|
|
if( screen->m_BlockLocate.GetCommand() != BLOCK_MOVE )
|
|
|
|
break;
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2013-10-15 16:18:30 +00:00
|
|
|
screen->m_BlockLocate.SetCommand( BLOCK_DELETE );
|
|
|
|
screen->m_BlockLocate.SetMessageBlock( this );
|
|
|
|
HandleBlockEnd( &dc );
|
2009-01-06 20:09:32 +00:00
|
|
|
SetSheetNumberAndCount();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
2015-08-09 15:04:49 +00:00
|
|
|
if( screen->m_BlockLocate.GetCommand() != BLOCK_MOVE )
|
|
|
|
break;
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2013-10-15 16:18:30 +00:00
|
|
|
screen->m_BlockLocate.SetCommand( BLOCK_COPY );
|
|
|
|
screen->m_BlockLocate.SetMessageBlock( this );
|
|
|
|
HandleBlockEnd( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_DRAG_BLOCK:
|
2015-08-09 15:04:49 +00:00
|
|
|
if( screen->m_BlockLocate.GetCommand() != BLOCK_MOVE )
|
|
|
|
break;
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2013-10-15 16:18:30 +00:00
|
|
|
screen->m_BlockLocate.SetCommand( BLOCK_DRAG );
|
|
|
|
screen->m_BlockLocate.SetMessageBlock( this );
|
|
|
|
HandleBlockEnd( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ADD_JUNCTION:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2013-08-03 05:15:23 +00:00
|
|
|
screen->SetCurItem( AddJunction( &dc, GetCrossHairPosition(), true ) );
|
2016-02-19 15:41:32 +00:00
|
|
|
|
|
|
|
if( screen->TestDanglingEnds() )
|
|
|
|
m_canvas->Refresh();
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_SCH_ADD_LABEL:
|
|
|
|
case ID_POPUP_SCH_ADD_GLABEL:
|
2010-12-08 20:12:46 +00:00
|
|
|
screen->SetCurItem( CreateNewText( &dc, id == ID_POPUP_SCH_ADD_LABEL ?
|
|
|
|
LAYER_LOCLABEL : LAYER_GLOBLABEL ) );
|
2011-03-25 19:16:05 +00:00
|
|
|
item = screen->GetCurItem();
|
|
|
|
|
|
|
|
if( item )
|
2015-06-28 16:45:05 +00:00
|
|
|
addCurrentItemToList();
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2009-07-08 15:42:45 +00:00
|
|
|
case ID_POPUP_SCH_GETINFO_MARKER:
|
2011-03-25 19:16:05 +00:00
|
|
|
if( item && item->Type() == SCH_MARKER_T )
|
|
|
|
( (SCH_MARKER*) item )->DisplayMarkerInfo( this );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2009-07-08 15:42:45 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
default: // Log error:
|
2011-10-27 17:51:22 +00:00
|
|
|
wxFAIL_MSG( wxString::Format( wxT( "Cannot process command event ID %d" ),
|
|
|
|
event.GetId() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
// End switch ( id ) (Command execution)
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
2013-08-05 21:02:41 +00:00
|
|
|
SetRepeatItem( NULL );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-19 12:08:12 +00:00
|
|
|
void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-04-19 12:08:12 +00:00
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2012-10-08 19:34:04 +00:00
|
|
|
SCH_ITEM* item = screen->GetCurItem();
|
2011-04-19 12:08:12 +00:00
|
|
|
|
2012-12-29 12:55:36 +00:00
|
|
|
if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
|
|
|
|
{
|
|
|
|
// trying to move an item when there is a block at the same time is not acceptable
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-04-19 12:08:12 +00:00
|
|
|
if( item == NULL )
|
2011-10-21 13:59:15 +00:00
|
|
|
{
|
|
|
|
// If we didn't get here by a hot key, then something has gone wrong.
|
|
|
|
if( aEvent.GetInt() == 0 )
|
|
|
|
return;
|
|
|
|
|
2011-10-26 20:46:04 +00:00
|
|
|
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
|
2011-10-21 13:59:15 +00:00
|
|
|
|
2011-10-26 20:46:04 +00:00
|
|
|
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
|
2011-10-21 13:59:15 +00:00
|
|
|
|
|
|
|
item = LocateAndShowItem( data->GetPosition(), SCH_COLLECTOR::MovableItems,
|
|
|
|
aEvent.GetInt() );
|
|
|
|
|
|
|
|
// Exit if no item found at the current location or the item is already being edited.
|
|
|
|
if( (item == NULL) || (item->GetFlags() != 0) )
|
|
|
|
return;
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2011-04-19 12:08:12 +00:00
|
|
|
|
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-19 20:32:21 +00:00
|
|
|
case SCH_LINE_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-19 20:32:21 +00:00
|
|
|
case SCH_JUNCTION_T:
|
|
|
|
case SCH_NO_CONNECT_T:
|
2013-04-01 10:35:20 +00:00
|
|
|
case SCH_BUS_BUS_ENTRY_T:
|
|
|
|
case SCH_BUS_WIRE_ENTRY_T:
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
|
|
|
case SCH_TEXT_T:
|
2011-10-19 20:32:21 +00:00
|
|
|
case SCH_COMPONENT_T:
|
2011-10-21 13:59:15 +00:00
|
|
|
case SCH_SHEET_PIN_T:
|
2011-10-22 12:31:44 +00:00
|
|
|
case SCH_FIELD_T:
|
2015-02-28 16:56:09 +00:00
|
|
|
case SCH_SHEET_T:
|
|
|
|
PrepareMoveItem( item, &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-08-31 14:59:20 +00:00
|
|
|
case SCH_BITMAP_T:
|
2015-02-28 16:56:09 +00:00
|
|
|
// move an image is a special case:
|
|
|
|
// we cannot undraw/redraw a bitmap just using our xor mode
|
|
|
|
// the MoveImage function handle this undraw/redraw difficulty
|
|
|
|
// By redrawing the full bounding box
|
2011-08-31 14:59:20 +00:00
|
|
|
MoveImage( (SCH_BITMAP*) item, &dc );
|
|
|
|
break;
|
|
|
|
|
2011-10-19 20:32:21 +00:00
|
|
|
case SCH_MARKER_T:
|
2015-02-28 16:56:09 +00:00
|
|
|
// Moving a marker has no sense
|
2015-03-11 16:04:20 +00:00
|
|
|
break;
|
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
default:
|
|
|
|
// Unknown items cannot be moved
|
|
|
|
wxFAIL_MSG( wxString::Format(
|
2015-04-26 16:32:16 +00:00
|
|
|
wxT( "Cannot move item type %d" ), item->Type() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-04-19 12:08:12 +00:00
|
|
|
|
|
|
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
2013-08-05 21:02:41 +00:00
|
|
|
SetRepeatItem( NULL );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2011-02-05 19:22:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
|
|
|
|
|
|
|
if( screen->IsBlockActive() )
|
|
|
|
{
|
2012-02-28 20:14:17 +00:00
|
|
|
m_canvas->SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
|
2011-02-05 19:22:58 +00:00
|
|
|
screen->ClearBlockCommand();
|
|
|
|
|
|
|
|
// Stop the current command (if any) but keep the current tool
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture();
|
2011-02-05 19:22:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() ) // Stop the current command but keep the current tool
|
|
|
|
m_canvas->EndMouseCapture();
|
2011-03-05 10:35:18 +00:00
|
|
|
else // Deselect current tool
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
|
2011-03-05 10:35:18 +00:00
|
|
|
}
|
2011-02-05 19:22:58 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
|
|
|
{
|
2012-03-19 07:48:29 +00:00
|
|
|
int id = aEvent.GetId();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
// Stop the current command and deselect the current tool.
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
case ID_NO_TOOL_SELECTED:
|
2011-12-22 13:28:11 +00:00
|
|
|
SetToolID( id, m_canvas->GetDefaultCursor(), _( "No tool selected" ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_HIERARCHY_PUSH_POP_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Descend or ascend hierarchy" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NOCONN_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add no connect" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_WIRE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_BUS_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add bus" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_LINE_COMMENT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add lines" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_JUNCTION_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add junction" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_LABEL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add label" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_GLABEL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add global label" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_HIERLABEL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add hierarchical label" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TEXT_COMMENT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
|
|
|
|
break;
|
|
|
|
|
2011-08-31 14:59:20 +00:00
|
|
|
case ID_ADD_IMAGE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add image" ) );
|
|
|
|
break;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
case ID_WIRETOBUS_ENTRY_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add wire to bus entry" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_BUSTOBUS_ENTRY_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add bus to bus entry" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SHEET_SYMBOL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add sheet" ) );
|
|
|
|
break;
|
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
case ID_SHEET_PIN_BUTT:
|
2011-02-21 13:54:29 +00:00
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add sheet pins" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_IMPORT_HLABEL_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Import sheet pins" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SCH_PLACE_COMPONENT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add component" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PLACE_POWER_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add power" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-08-05 21:02:41 +00:00
|
|
|
SetRepeatItem( NULL );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
2011-10-24 13:56:35 +00:00
|
|
|
|
|
|
|
// Simulate left click event if we got here from a hot key.
|
2011-10-26 20:46:04 +00:00
|
|
|
if( aEvent.GetClientObject() != NULL )
|
2011-10-24 13:56:35 +00:00
|
|
|
{
|
2011-10-26 20:46:04 +00:00
|
|
|
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
|
2011-10-24 13:56:35 +00:00
|
|
|
|
|
|
|
wxPoint pos = data->GetPosition();
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2011-10-24 13:56:35 +00:00
|
|
|
OnLeftClick( &dc, pos );
|
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
2011-12-14 20:03:15 +00:00
|
|
|
if( aEvent.GetEventObject() == m_drawToolBar )
|
2011-02-24 20:22:12 +00:00
|
|
|
aEvent.Check( GetToolId() == aEvent.GetId() );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
2011-04-15 12:40:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::DeleteConnection( bool aFullConnection )
|
|
|
|
{
|
2012-08-24 11:14:10 +00:00
|
|
|
PICKED_ITEMS_LIST pickList;
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint pos = GetCrossHairPosition();
|
2011-04-15 12:40:56 +00:00
|
|
|
|
|
|
|
if( screen->GetConnection( pos, pickList, aFullConnection ) != 0 )
|
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
DeleteItemsInList( m_canvas, pickList );
|
2011-04-15 12:40:56 +00:00
|
|
|
OnModify();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC )
|
|
|
|
{
|
2012-08-24 11:14:10 +00:00
|
|
|
SCH_ITEM* item;
|
2011-04-15 12:40:56 +00:00
|
|
|
SCH_SCREEN* screen = GetScreen();
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
item = LocateItem( GetCrossHairPosition(), SCH_COLLECTOR::ParentItems );
|
2011-04-15 12:40:56 +00:00
|
|
|
|
|
|
|
if( item )
|
|
|
|
{
|
|
|
|
bool itemHasConnections = item->IsConnectable();
|
|
|
|
|
|
|
|
screen->SetCurItem( NULL );
|
|
|
|
SetRepeatItem( NULL );
|
|
|
|
DeleteItem( item );
|
|
|
|
|
2016-02-19 15:41:32 +00:00
|
|
|
if( itemHasConnections && screen->TestDanglingEnds() )
|
|
|
|
m_canvas->Refresh();
|
2011-04-15 12:40:56 +00:00
|
|
|
|
|
|
|
OnModify();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2011-10-22 12:31:44 +00:00
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
// This function is a callback function, called by the mouse cursor movin event
|
|
|
|
// when an item is currently moved
|
|
|
|
static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|
|
|
const wxPoint& aPosition, bool aErase )
|
2011-10-22 12:31:44 +00:00
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
|
2012-08-24 11:14:10 +00:00
|
|
|
SCH_ITEM* item = screen->GetCurItem();
|
2011-10-22 12:31:44 +00:00
|
|
|
|
|
|
|
wxCHECK_RET( (item != NULL), wxT( "Cannot move invalid schematic item." ) );
|
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
SCH_COMPONENT* cmp = NULL;
|
|
|
|
|
|
|
|
if( item->Type() == SCH_COMPONENT_T )
|
|
|
|
cmp = static_cast< SCH_COMPONENT* >( item );
|
|
|
|
|
2012-01-24 17:46:32 +00:00
|
|
|
#ifndef USE_WX_OVERLAY
|
2011-10-22 12:31:44 +00:00
|
|
|
// Erase the current item at its current position.
|
|
|
|
if( aErase )
|
2015-02-28 16:56:09 +00:00
|
|
|
{
|
|
|
|
if( cmp ) // Use fast mode (do not draw pin texts)
|
|
|
|
cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, UNSPECIFIED_COLOR, false );
|
|
|
|
else
|
|
|
|
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
|
|
|
|
}
|
2012-01-24 17:46:32 +00:00
|
|
|
#endif
|
2012-08-24 11:14:10 +00:00
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
wxPoint cpos = aPanel->GetParent()->GetCrossHairPosition();
|
|
|
|
cpos -= item->GetStoredPos();
|
|
|
|
|
|
|
|
item->SetPosition( cpos );
|
2011-10-22 12:31:44 +00:00
|
|
|
|
|
|
|
// Draw the item item at it's new position.
|
2014-02-11 21:54:30 +00:00
|
|
|
item->SetWireImage(); // While moving, the item may choose to render differently
|
2015-02-28 16:56:09 +00:00
|
|
|
|
|
|
|
if( cmp ) // Use fast mode (do not draw pin texts)
|
|
|
|
cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, UNSPECIFIED_COLOR, false );
|
|
|
|
else
|
|
|
|
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
|
2011-10-22 12:31:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
|
|
|
{
|
2012-08-24 11:14:10 +00:00
|
|
|
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
|
|
|
|
SCH_ITEM* item = screen->GetCurItem();
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
SCH_EDIT_FRAME* parent = (SCH_EDIT_FRAME*) aPanel->GetParent();
|
2011-10-22 12:31:44 +00:00
|
|
|
|
|
|
|
parent->SetRepeatItem( NULL );
|
|
|
|
screen->SetCurItem( NULL );
|
|
|
|
|
|
|
|
if( item == NULL ) /* no current item */
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( item->IsNew() )
|
|
|
|
{
|
|
|
|
delete item;
|
|
|
|
item = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SCH_ITEM* oldItem = parent->GetUndoItem();
|
|
|
|
|
|
|
|
SCH_ITEM* currentItem;
|
|
|
|
|
|
|
|
// Items that are children of other objects are undone by swapping the contents
|
|
|
|
// of the parent items.
|
|
|
|
if( (item->Type() == SCH_SHEET_PIN_T) || (item->Type() == SCH_FIELD_T) )
|
|
|
|
{
|
|
|
|
currentItem = (SCH_ITEM*) item->GetParent();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
currentItem = item;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxCHECK_RET( oldItem != NULL && currentItem->Type() == oldItem->Type(),
|
|
|
|
wxT( "Cannot restore undefined or bad last schematic item." ) );
|
|
|
|
|
|
|
|
// Never delete existing item, because it can be referenced by an undo/redo command
|
|
|
|
// Just restore its data
|
|
|
|
currentItem->SwapData( oldItem );
|
2014-02-11 21:54:30 +00:00
|
|
|
|
|
|
|
// Erase the wire representation before the 'normal' view is drawn.
|
|
|
|
if ( item->IsWireImage() )
|
2014-02-21 00:06:37 +00:00
|
|
|
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
|
2014-02-11 21:54:30 +00:00
|
|
|
|
2011-10-22 12:31:44 +00:00
|
|
|
item->ClearFlags();
|
|
|
|
}
|
|
|
|
|
|
|
|
aPanel->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC )
|
2011-10-22 12:31:44 +00:00
|
|
|
{
|
|
|
|
wxCHECK_RET( aItem != NULL, wxT( "Cannot move invalid schematic item" ) );
|
|
|
|
|
2013-08-05 21:02:41 +00:00
|
|
|
SetRepeatItem( NULL );
|
2011-10-22 12:31:44 +00:00
|
|
|
|
|
|
|
if( !aItem->IsNew() )
|
|
|
|
{
|
|
|
|
if( (aItem->Type() == SCH_SHEET_PIN_T) || (aItem->Type() == SCH_FIELD_T) )
|
|
|
|
SetUndoItem( (SCH_ITEM*) aItem->GetParent() );
|
|
|
|
else
|
|
|
|
SetUndoItem( aItem );
|
|
|
|
}
|
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
if( aItem->Type() == SCH_FIELD_T && aItem->GetParent()->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
// Now that we're moving a field, they're no longer autoplaced.
|
2016-01-09 23:36:09 +00:00
|
|
|
SCH_COMPONENT *parent = static_cast<SCH_COMPONENT*>( aItem->GetParent() );
|
2015-12-13 16:56:47 +00:00
|
|
|
parent->ClearFieldsAutoplaced();
|
|
|
|
}
|
|
|
|
|
2011-10-22 12:31:44 +00:00
|
|
|
aItem->SetFlags( IS_MOVED );
|
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
// For some items, moving the cursor to anchor is not good
|
|
|
|
// (for instance large hierarchical sheets od componants can have
|
|
|
|
// the anchor position outside the canvas)
|
|
|
|
// these items return IsMovableFromAnchorPoint() == false
|
|
|
|
// For these items, do not wrap the cursor
|
|
|
|
if( aItem->IsMovableFromAnchorPoint() )
|
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( aItem->GetPosition() );
|
2015-02-28 16:56:09 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
aItem->SetStoredPos( wxPoint( 0,0 ) );
|
|
|
|
}
|
|
|
|
else
|
2016-03-30 18:19:32 +00:00
|
|
|
{
|
|
|
|
// Round the point under the cursor to a multiple of the grid
|
|
|
|
wxPoint cursorpos = GetCrossHairPosition() - aItem->GetPosition();
|
|
|
|
wxPoint gridsize = GetScreen()->GetGridSize();
|
|
|
|
cursorpos.x = ( cursorpos.x / gridsize.x ) * gridsize.x;
|
|
|
|
cursorpos.y = ( cursorpos.y / gridsize.y ) * gridsize.y;
|
|
|
|
|
|
|
|
aItem->SetStoredPos( cursorpos );
|
|
|
|
}
|
2011-10-22 12:31:44 +00:00
|
|
|
|
|
|
|
OnModify();
|
2015-07-24 10:23:34 +00:00
|
|
|
|
2011-10-22 12:31:44 +00:00
|
|
|
GetScreen()->SetCurItem( aItem );
|
2015-07-24 10:23:34 +00:00
|
|
|
m_canvas->SetMouseCapture( moveItemWithMouseCursor, abortMoveItem );
|
2015-02-28 16:56:09 +00:00
|
|
|
|
|
|
|
m_canvas->Refresh();
|
2011-10-22 12:31:44 +00:00
|
|
|
}
|
2011-10-26 20:46:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2012-08-24 11:14:10 +00:00
|
|
|
SCH_ITEM* item = screen->GetCurItem();
|
2011-10-26 20:46:04 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2011-10-26 20:46:04 +00:00
|
|
|
|
2012-12-29 12:55:36 +00:00
|
|
|
// Allows block rotate operation on hot key.
|
|
|
|
if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
|
2011-10-26 20:46:04 +00:00
|
|
|
{
|
2013-10-15 16:18:30 +00:00
|
|
|
screen->m_BlockLocate.SetCommand( BLOCK_ROTATE );
|
|
|
|
HandleBlockEnd( &dc );
|
2012-12-29 12:55:36 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-10-26 20:46:04 +00:00
|
|
|
|
2012-12-29 12:55:36 +00:00
|
|
|
if( item == NULL )
|
|
|
|
{
|
2011-10-28 20:30:50 +00:00
|
|
|
// If we didn't get here by a hot key, then something has gone wrong.
|
|
|
|
if( aEvent.GetInt() == 0 )
|
|
|
|
return;
|
|
|
|
|
2011-10-26 20:46:04 +00:00
|
|
|
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
|
|
|
|
|
|
|
|
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
|
|
|
|
|
|
|
|
item = LocateAndShowItem( data->GetPosition(), SCH_COLLECTOR::RotatableItems,
|
|
|
|
aEvent.GetInt() );
|
|
|
|
|
|
|
|
// Exit if no item found at the current location or the item is already being edited.
|
|
|
|
if( (item == NULL) || (item->GetFlags() != 0) )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch( item->Type() )
|
|
|
|
{
|
|
|
|
case SCH_COMPONENT_T:
|
2015-12-13 16:56:47 +00:00
|
|
|
{
|
2016-01-09 23:36:09 +00:00
|
|
|
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
|
2015-12-13 16:56:47 +00:00
|
|
|
if( aEvent.GetId() == ID_SCH_ROTATE_CLOCKWISE )
|
|
|
|
OrientComponent( CMP_ROTATE_CLOCKWISE );
|
|
|
|
else if( aEvent.GetId() == ID_SCH_ROTATE_COUNTERCLOCKWISE )
|
|
|
|
OrientComponent( CMP_ROTATE_COUNTERCLOCKWISE );
|
|
|
|
else
|
|
|
|
wxFAIL_MSG( wxT( "Unknown rotate item command ID." ) );
|
2011-10-28 20:30:50 +00:00
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
if( m_autoplaceFields )
|
|
|
|
component->AutoAutoplaceFields( GetScreen() );
|
|
|
|
|
|
|
|
m_canvas->Refresh();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2011-10-26 20:46:04 +00:00
|
|
|
|
|
|
|
case SCH_TEXT_T:
|
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2016-03-23 12:16:27 +00:00
|
|
|
ChangeTextOrient( (SCH_TEXT*) item );
|
|
|
|
m_canvas->Refresh();
|
2011-10-26 20:46:04 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_FIELD_T:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2016-03-23 12:16:27 +00:00
|
|
|
RotateField( (SCH_FIELD*) item );
|
2015-12-13 16:56:47 +00:00
|
|
|
if( item->GetParent()->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
// Now that we're moving a field, they're no longer autoplaced.
|
2016-01-09 23:36:09 +00:00
|
|
|
SCH_COMPONENT *parent = static_cast<SCH_COMPONENT*>( item->GetParent() );
|
2015-12-13 16:56:47 +00:00
|
|
|
parent->ClearFieldsAutoplaced();
|
|
|
|
}
|
2016-03-23 12:16:27 +00:00
|
|
|
m_canvas->Refresh();
|
2011-10-26 20:46:04 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_BITMAP_T:
|
|
|
|
RotateImage( (SCH_BITMAP*) item );
|
|
|
|
break;
|
|
|
|
|
2015-04-26 16:32:16 +00:00
|
|
|
case SCH_SHEET_T:
|
|
|
|
if( !item->IsNew() ) // rotate a sheet during its creation has no sense
|
|
|
|
{
|
|
|
|
bool retCCW = ( aEvent.GetId() == ID_SCH_ROTATE_COUNTERCLOCKWISE );
|
|
|
|
RotateHierarchicalSheet( static_cast<SCH_SHEET*>( item ), retCCW );
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_JUNCTION_T:
|
|
|
|
case SCH_NO_CONNECT_T:
|
|
|
|
// these items are not rotated, because rotation does not change them.
|
|
|
|
break;
|
|
|
|
|
2011-10-26 20:46:04 +00:00
|
|
|
default:
|
2015-04-26 16:32:16 +00:00
|
|
|
// Other items (wires...) cannot be rotated, at least during creation
|
|
|
|
if( item->IsNew() )
|
|
|
|
break;
|
|
|
|
|
2011-10-27 13:34:28 +00:00
|
|
|
wxFAIL_MSG( wxString::Format( wxT( "Cannot rotate schematic item type %s." ),
|
|
|
|
GetChars( item->GetClass() ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( item->GetFlags() == 0 )
|
|
|
|
screen->SetCurItem( NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
|
|
|
SCH_ITEM* item = screen->GetCurItem();
|
|
|
|
|
|
|
|
if( item == NULL )
|
|
|
|
{
|
|
|
|
// If we didn't get here by a hot key, then something has gone wrong.
|
|
|
|
if( aEvent.GetInt() == 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
|
|
|
|
|
|
|
|
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
|
|
|
|
|
2012-12-08 17:24:49 +00:00
|
|
|
// Set the locat filter, according to the edit command
|
|
|
|
const KICAD_T* filterList = SCH_COLLECTOR::EditableItems;
|
|
|
|
const KICAD_T* filterListAux = NULL;
|
2013-10-15 16:18:30 +00:00
|
|
|
|
2012-12-08 17:24:49 +00:00
|
|
|
switch( aEvent.GetId() )
|
|
|
|
{
|
|
|
|
case ID_SCH_EDIT_COMPONENT_REFERENCE:
|
|
|
|
filterList = SCH_COLLECTOR::CmpFieldReferenceOnly;
|
|
|
|
filterListAux = SCH_COLLECTOR::ComponentsOnly;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SCH_EDIT_COMPONENT_VALUE:
|
|
|
|
filterList = SCH_COLLECTOR::CmpFieldValueOnly;
|
|
|
|
filterListAux = SCH_COLLECTOR::ComponentsOnly;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SCH_EDIT_COMPONENT_FOOTPRINT:
|
|
|
|
filterList = SCH_COLLECTOR::CmpFieldFootprintOnly;
|
|
|
|
filterListAux = SCH_COLLECTOR::ComponentsOnly;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2013-10-15 16:18:30 +00:00
|
|
|
|
|
|
|
item = LocateAndShowItem( data->GetPosition(), filterList, aEvent.GetInt() );
|
2012-12-08 17:24:49 +00:00
|
|
|
|
|
|
|
// If no item found, and if an auxiliary filter exists, try to use it
|
|
|
|
if( !item && filterListAux )
|
2013-10-15 16:18:30 +00:00
|
|
|
item = LocateAndShowItem( data->GetPosition(), filterListAux, aEvent.GetInt() );
|
2011-10-27 13:34:28 +00:00
|
|
|
|
|
|
|
// Exit if no item found at the current location or the item is already being edited.
|
|
|
|
if( (item == NULL) || (item->GetFlags() != 0) )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch( item->Type() )
|
|
|
|
{
|
|
|
|
case SCH_COMPONENT_T:
|
|
|
|
{
|
|
|
|
switch( aEvent.GetId() )
|
|
|
|
{
|
|
|
|
case ID_SCH_EDIT_COMPONENT_REFERENCE:
|
2012-06-03 11:16:08 +00:00
|
|
|
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ) );
|
2011-10-27 13:34:28 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SCH_EDIT_COMPONENT_VALUE:
|
2012-06-03 11:16:08 +00:00
|
|
|
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ) );
|
2011-10-27 13:34:28 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SCH_EDIT_COMPONENT_FOOTPRINT:
|
2012-06-03 11:16:08 +00:00
|
|
|
EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ) );
|
2011-10-27 13:34:28 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SCH_EDIT_ITEM:
|
|
|
|
EditComponent( (SCH_COMPONENT*) item );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
wxFAIL_MSG( wxString::Format( wxT( "Invalid schematic component edit command ID %d" ),
|
|
|
|
aEvent.GetId() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case SCH_SHEET_T:
|
2016-02-15 20:12:42 +00:00
|
|
|
if( EditSheet( (SCH_SHEET*) item, m_CurrentSheet ) )
|
2015-06-28 16:45:05 +00:00
|
|
|
m_canvas->Refresh();
|
2011-10-26 20:46:04 +00:00
|
|
|
break;
|
2011-10-27 13:34:28 +00:00
|
|
|
|
|
|
|
case SCH_SHEET_PIN_T:
|
2015-06-27 09:12:32 +00:00
|
|
|
EditSheetPin( (SCH_SHEET_PIN*) item, true );
|
2011-10-27 13:34:28 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_TEXT_T:
|
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
|
|
|
EditSchematicText( (SCH_TEXT*) item );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_FIELD_T:
|
2012-06-03 11:16:08 +00:00
|
|
|
EditComponentFieldText( (SCH_FIELD*) item );
|
2011-10-27 13:34:28 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_BITMAP_T:
|
|
|
|
EditImage( (SCH_BITMAP*) item );
|
|
|
|
break;
|
|
|
|
|
2015-04-30 11:08:35 +00:00
|
|
|
case SCH_LINE_T: // These items have no param to edit
|
|
|
|
case SCH_MARKER_T:
|
|
|
|
case SCH_JUNCTION_T:
|
|
|
|
case SCH_NO_CONNECT_T:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: // Unexpected item
|
2011-10-27 13:34:28 +00:00
|
|
|
wxFAIL_MSG( wxString::Format( wxT( "Cannot edit schematic item type %s." ),
|
|
|
|
GetChars( item->GetClass() ) ) );
|
2011-10-26 20:46:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( item->GetFlags() == 0 )
|
|
|
|
screen->SetCurItem( NULL );
|
|
|
|
}
|
2011-10-27 17:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
|
|
|
SCH_ITEM* item = screen->GetCurItem();
|
|
|
|
|
2014-07-29 16:38:27 +00:00
|
|
|
// The easiest way to handle a menu or a hot key drag command
|
|
|
|
// is to simulate a block drag command
|
|
|
|
//
|
|
|
|
// When a drag item is requested, some items use a BLOCK_DRAG_ITEM drag type
|
|
|
|
// an some items use a BLOCK_DRAG drag type (mainly a junction)
|
|
|
|
// a BLOCK_DRAG collects all items in a block (here a 2x2 rect centered on the cursor)
|
|
|
|
// and BLOCK_DRAG_ITEM drag only the selected item
|
|
|
|
BLOCK_COMMAND_T dragType = BLOCK_DRAG_ITEM;
|
2011-10-27 17:51:22 +00:00
|
|
|
|
|
|
|
if( item == NULL )
|
|
|
|
{
|
|
|
|
// If we didn't get here by a hot key, then something has gone wrong.
|
|
|
|
if( aEvent.GetInt() == 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
|
|
|
|
|
|
|
|
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
|
|
|
|
|
|
|
|
item = LocateAndShowItem( data->GetPosition(), SCH_COLLECTOR::DraggableItems,
|
|
|
|
aEvent.GetInt() );
|
|
|
|
|
|
|
|
// Exit if no item found at the current location or the item is already being edited.
|
|
|
|
if( (item == NULL) || (item->GetFlags() != 0) )
|
|
|
|
return;
|
2014-07-29 16:38:27 +00:00
|
|
|
|
|
|
|
// When a junction or a node is found, a BLOCK_DRAG is better
|
|
|
|
if( m_collectedItems.IsCorner() || m_collectedItems.IsNode( false )
|
|
|
|
|| m_collectedItems.IsDraggableJunction() )
|
|
|
|
dragType = BLOCK_DRAG;
|
2011-10-27 17:51:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch( item->Type() )
|
|
|
|
{
|
2014-07-31 02:56:25 +00:00
|
|
|
case SCH_BUS_BUS_ENTRY_T:
|
|
|
|
case SCH_BUS_WIRE_ENTRY_T:
|
|
|
|
case SCH_LINE_T:
|
|
|
|
case SCH_JUNCTION_T:
|
|
|
|
case SCH_COMPONENT_T:
|
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
|
|
|
case SCH_SHEET_T:
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-10-27 17:51:22 +00:00
|
|
|
|
2014-07-31 02:56:25 +00:00
|
|
|
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
|
|
|
|
{
|
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2011-10-27 17:51:22 +00:00
|
|
|
|
2014-07-31 02:56:25 +00:00
|
|
|
if( !HandleBlockBegin( &dc, dragType, GetCrossHairPosition() ) )
|
|
|
|
break;
|
2011-10-27 17:51:22 +00:00
|
|
|
|
2014-07-31 02:56:25 +00:00
|
|
|
// Give a non null size to the search block:
|
|
|
|
screen->m_BlockLocate.Inflate( 1 );
|
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
}
|
2011-10-27 17:51:22 +00:00
|
|
|
|
2014-07-31 02:56:25 +00:00
|
|
|
break;
|
2011-10-27 17:51:22 +00:00
|
|
|
|
2014-07-31 02:56:25 +00:00
|
|
|
default:
|
|
|
|
wxFAIL_MSG( wxString::Format( wxT( "Cannot drag schematic item type %s." ),
|
|
|
|
GetChars( item->GetClass() ) ) );
|
2011-10-27 17:51:22 +00:00
|
|
|
}
|
|
|
|
}
|
2011-10-28 20:30:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2012-08-24 11:14:10 +00:00
|
|
|
SCH_ITEM* item = screen->GetCurItem();
|
2011-10-28 20:30:50 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2011-10-28 20:30:50 +00:00
|
|
|
|
2012-12-29 12:55:36 +00:00
|
|
|
// Allows block rotate operation on hot key.
|
|
|
|
if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
|
2011-10-28 20:30:50 +00:00
|
|
|
{
|
2012-12-29 12:55:36 +00:00
|
|
|
if( aEvent.GetId() == ID_SCH_MIRROR_X )
|
2013-10-15 16:18:30 +00:00
|
|
|
{
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
screen->m_BlockLocate.SetMessageBlock( this );
|
|
|
|
screen->m_BlockLocate.SetCommand( BLOCK_MIRROR_X );
|
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
}
|
2012-12-29 12:55:36 +00:00
|
|
|
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
|
2013-10-15 16:18:30 +00:00
|
|
|
{
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
screen->m_BlockLocate.SetMessageBlock( this );
|
|
|
|
screen->m_BlockLocate.SetCommand( BLOCK_MIRROR_Y );
|
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
}
|
2012-12-29 12:55:36 +00:00
|
|
|
else
|
2013-10-15 16:18:30 +00:00
|
|
|
{
|
2012-12-29 12:55:36 +00:00
|
|
|
wxFAIL_MSG( wxT( "Unknown block oriention command ID." ) );
|
2013-10-15 16:18:30 +00:00
|
|
|
}
|
2011-10-28 20:30:50 +00:00
|
|
|
|
2012-12-29 12:55:36 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-10-28 20:30:50 +00:00
|
|
|
|
2012-12-29 12:55:36 +00:00
|
|
|
if( item == NULL )
|
|
|
|
{
|
2011-10-28 20:30:50 +00:00
|
|
|
// If we didn't get here by a hot key, then something has gone wrong.
|
|
|
|
if( aEvent.GetInt() == 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
|
|
|
|
|
|
|
|
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
|
|
|
|
|
|
|
|
item = LocateAndShowItem( data->GetPosition(), SCH_COLLECTOR::OrientableItems,
|
|
|
|
aEvent.GetInt() );
|
|
|
|
|
|
|
|
// Exit if no item found at the current location or the item is already being edited.
|
|
|
|
if( (item == NULL) || (item->GetFlags() != 0) )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch( item->Type() )
|
|
|
|
{
|
|
|
|
case SCH_COMPONENT_T:
|
2015-12-13 16:56:47 +00:00
|
|
|
{
|
2016-01-09 23:36:09 +00:00
|
|
|
SCH_COMPONENT *component = static_cast<SCH_COMPONENT*>( item );
|
2015-12-13 16:56:47 +00:00
|
|
|
if( aEvent.GetId() == ID_SCH_MIRROR_X )
|
|
|
|
OrientComponent( CMP_MIRROR_X );
|
|
|
|
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
|
|
|
|
OrientComponent( CMP_MIRROR_Y );
|
|
|
|
else if( aEvent.GetId() == ID_SCH_ORIENT_NORMAL )
|
|
|
|
OrientComponent( CMP_NORMAL );
|
|
|
|
else
|
|
|
|
wxFAIL_MSG( wxT( "Invalid orient schematic component command ID." ) );
|
|
|
|
|
|
|
|
if( m_autoplaceFields )
|
|
|
|
component->AutoAutoplaceFields( GetScreen() );
|
2011-10-28 20:30:50 +00:00
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
m_canvas->Refresh();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2011-10-28 20:30:50 +00:00
|
|
|
|
|
|
|
case SCH_BITMAP_T:
|
|
|
|
if( aEvent.GetId() == ID_SCH_MIRROR_X )
|
|
|
|
MirrorImage( (SCH_BITMAP*) item, true );
|
|
|
|
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
|
|
|
|
MirrorImage( (SCH_BITMAP*) item, false );
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2015-04-26 16:32:16 +00:00
|
|
|
case SCH_SHEET_T:
|
|
|
|
if( aEvent.GetId() == ID_SCH_MIRROR_X )
|
|
|
|
MirrorSheet( (SCH_SHEET*) item, true );
|
|
|
|
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
|
|
|
|
MirrorSheet( (SCH_SHEET*) item, false );
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2011-10-28 20:30:50 +00:00
|
|
|
default:
|
2015-09-15 13:51:47 +00:00
|
|
|
// This object cannot be oriented.
|
|
|
|
;
|
2011-10-28 20:30:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( item->GetFlags() == 0 )
|
|
|
|
screen->SetCurItem( NULL );
|
|
|
|
}
|