2011-10-17 20:01:27 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-03-07 07:13:06 +00:00
|
|
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2015-02-01 07:19:31 +00:00
|
|
|
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
|
|
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
|
2016-03-07 07:13:06 +00:00
|
|
|
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-17 20:01:27 +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-09-20 15:07:52 +00:00
|
|
|
/**
|
|
|
|
* @file edit.cpp
|
|
|
|
* @brief Edit PCB implementation.
|
|
|
|
*/
|
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 <pgm_base.h>
|
|
|
|
#include <kiface_i.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <eda_doc.h>
|
|
|
|
#include <gestfich.h>
|
|
|
|
#include <kicad_device_context.h>
|
|
|
|
#include <wxPcbStruct.h>
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <module_editor_frame.h>
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_track.h>
|
|
|
|
#include <class_zone.h>
|
2012-07-04 19:50:47 +00:00
|
|
|
#include <class_pcb_text.h>
|
2012-02-09 20:33:38 +00:00
|
|
|
#include <modview_frame.h>
|
2012-05-04 17:44:42 +00:00
|
|
|
#include <class_pcb_layer_box_selector.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_drc.h>
|
|
|
|
#include <dialog_global_edit_tracks_and_vias.h>
|
2013-10-24 16:44:38 +00:00
|
|
|
#include <invoke_pcb_dialog.h>
|
2016-04-02 12:52:29 +00:00
|
|
|
#include <array_creator.h>
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
#include <dialog_move_exact.h>
|
|
|
|
|
2014-02-17 17:21:00 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tools/common_actions.h>
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Handles the selection of command events.
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
int id = event.GetId();
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2010-08-29 21:31:27 +00:00
|
|
|
MODULE* module;
|
2015-01-10 10:27:49 +00:00
|
|
|
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
|
2009-06-19 20:13:22 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->CrossHairOff( &dc );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2007-09-29 13:31:10 +00:00
|
|
|
switch( id ) // Some (not all ) edit commands must be finished or aborted
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
|
|
|
case wxID_CUT:
|
|
|
|
case wxID_COPY:
|
|
|
|
case ID_PCB_USER_GRID_SETUP:
|
|
|
|
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
2009-09-28 12:21:54 +00:00
|
|
|
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
|
2012-05-30 17:38:52 +00:00
|
|
|
case ID_POPUP_PCB_FLIP_TEXTEPCB:
|
2012-07-04 19:50:47 +00:00
|
|
|
case ID_POPUP_PCB_COPY_TEXTEPCB:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_TEXTEPCB:
|
|
|
|
case ID_POPUP_PCB_EDIT_MIRE:
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
|
|
|
|
case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
|
2013-03-01 19:59:29 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_MODULE_PRMS:
|
|
|
|
case ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_TEXTMODULE:
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
|
2012-12-01 20:03:33 +00:00
|
|
|
case ID_POPUP_PCB_BEGIN_TRACK:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_END_TRACK:
|
2013-08-28 16:14:39 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_THROUGH_VIA:
|
2013-09-20 10:52:33 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA:
|
2013-08-28 16:14:39 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
|
2013-09-20 10:52:33 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
|
2008-01-12 20:31:56 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_MICROVIA:
|
2013-08-28 16:14:39 +00:00
|
|
|
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
|
|
|
|
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
|
|
|
|
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
|
2008-01-23 08:01:38 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
|
2007-12-30 18:20:51 +00:00
|
|
|
case ID_POPUP_PCB_FILL_ALL_ZONES:
|
2008-10-29 15:26:53 +00:00
|
|
|
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES:
|
|
|
|
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_ZONE_CORNER:
|
|
|
|
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
|
2007-12-29 19:15:58 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE:
|
2016-03-22 17:47:29 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_CORNER:
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_ZONE_CORNER:
|
|
|
|
case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
|
2015-02-01 07:19:31 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT:
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
|
|
|
|
case ID_POPUP_PCB_ADD_ZONE_CORNER:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_TRACKSEG:
|
|
|
|
case ID_POPUP_PCB_DELETE_TRACK:
|
|
|
|
case ID_POPUP_PCB_DELETE_TRACKNET:
|
|
|
|
case ID_POPUP_PCB_FILL_ZONE:
|
|
|
|
case ID_POPUP_PCB_SELECT_LAYER:
|
|
|
|
case ID_POPUP_PCB_SELECT_CU_LAYER:
|
|
|
|
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
|
|
|
|
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
|
|
|
|
case ID_POPUP_PCB_MOVE_TRACK_NODE:
|
2013-08-23 06:38:57 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
|
|
|
|
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
|
|
|
|
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
|
|
|
|
case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE:
|
|
|
|
case ID_POPUP_PCB_BREAK_TRACK:
|
|
|
|
case ID_POPUP_PCB_EDIT_NET:
|
|
|
|
case ID_POPUP_PCB_EDIT_TRACK:
|
|
|
|
case ID_POPUP_PCB_EDIT_TRACKSEG:
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_TRACK:
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_TRACK:
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_NET:
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_NET:
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
2009-08-12 10:40:01 +00:00
|
|
|
case ID_POPUP_FLIP_BLOCK:
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
2009-02-24 13:55:13 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_DRAWING:
|
2009-07-13 15:25:41 +00:00
|
|
|
case ID_POPUP_PCB_GETINFO_MARKER:
|
2011-11-24 19:57:41 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST:
|
2013-08-23 06:38:57 +00:00
|
|
|
case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
|
|
|
|
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
|
|
|
|
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
|
|
|
|
case ID_POPUP_PCB_MOVE_MIRE_REQUEST:
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture();
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Should not be executed, just in case
|
2012-03-26 23:47:08 +00:00
|
|
|
if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
|
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
2011-12-22 13:28:11 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
2007-08-04 00:56:53 +00:00
|
|
|
else
|
2012-02-28 20:14:17 +00:00
|
|
|
SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2009-07-25 04:53:39 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
default: // Finish (abort) the command
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() )
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->CallEndMouseCapture( &dc );
|
2007-10-29 15:51:48 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() != id )
|
2009-07-25 04:53:39 +00:00
|
|
|
{
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_lastDrawToolId != GetToolId() )
|
|
|
|
m_lastDrawToolId = GetToolId();
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
2009-06-19 20:13:22 +00:00
|
|
|
}
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-09-29 13:31:10 +00:00
|
|
|
switch( id ) // Execute command
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_OPEN_MODULE_EDITOR:
|
|
|
|
{
|
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
|
|
|
FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, false );
|
2011-08-26 17:01:17 +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
|
|
|
if( !editor )
|
2013-10-17 18:47:46 +00:00
|
|
|
{
|
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
|
|
|
editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
|
* 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
|
|
|
editor->Zoom_Automatique( false );
|
2013-10-17 18:47:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-16 19:29:40 +00:00
|
|
|
// Needed on Windows, other platforms do not use it,
|
|
|
|
// but it creates no issue
|
* 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
|
|
|
if( editor->IsIconized() )
|
|
|
|
editor->Iconize( false );
|
2011-08-03 15:09:39 +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
|
|
|
editor->Raise();
|
2013-10-17 18:47:46 +00:00
|
|
|
|
|
|
|
// Raising the window does not set the focus on Linux. This should work on
|
|
|
|
// any platform.
|
* 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
|
|
|
if( wxWindow::FindFocus() != editor )
|
|
|
|
editor->SetFocus();
|
2013-10-17 18:47:46 +00:00
|
|
|
}
|
2015-08-25 14:16:15 +00:00
|
|
|
|
|
|
|
editor->PushPreferences( m_canvas );
|
2011-08-03 15:09:39 +00:00
|
|
|
}
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2012-02-09 20:33:38 +00:00
|
|
|
case ID_OPEN_MODULE_VIEWER:
|
|
|
|
{
|
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
|
|
|
FOOTPRINT_VIEWER_FRAME* viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
|
* 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
|
|
|
|
|
|
|
if( !viewer )
|
2013-10-17 18:47:46 +00:00
|
|
|
{
|
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
|
|
|
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, true );
|
2013-10-17 18:47:46 +00:00
|
|
|
viewer->Zoom_Automatique( false );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-16 19:29:40 +00:00
|
|
|
// Needed on Windows, other platforms do not use it,
|
|
|
|
// but it creates no issue
|
2013-10-17 18:47:46 +00:00
|
|
|
if( viewer->IsIconized() )
|
|
|
|
viewer->Iconize( false );
|
2012-02-09 20:33:38 +00:00
|
|
|
|
2013-10-17 18:47:46 +00:00
|
|
|
viewer->Raise();
|
2012-02-09 20:33:38 +00:00
|
|
|
|
2013-10-17 18:47:46 +00:00
|
|
|
// Raising the window does not set the focus on Linux. This should work on
|
|
|
|
// any platform.
|
|
|
|
if( wxWindow::FindFocus() != viewer )
|
|
|
|
viewer->SetFocus();
|
|
|
|
}
|
2015-08-25 14:16:15 +00:00
|
|
|
|
|
|
|
viewer->PushPreferences( m_canvas );
|
2012-09-12 09:53:11 +00:00
|
|
|
}
|
2012-02-09 20:33:38 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_PCB_GLOBAL_DELETE:
|
2013-09-25 19:09:57 +00:00
|
|
|
InstallPcbGlobalDeleteFrame( wxDefaultPosition );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAutoPanRequest( false );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_COPY );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAutoPanRequest( false );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
2009-08-12 10:40:01 +00:00
|
|
|
case ID_POPUP_FLIP_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_FLIP );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2007-08-04 00:56:53 +00:00
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_DRC_CONTROL:
|
2011-03-03 19:08:13 +00:00
|
|
|
m_drc->ShowDialog();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_GET_NETLIST:
|
2011-05-03 12:57:44 +00:00
|
|
|
InstallNetlistFrame( &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_FIND_ITEMS:
|
2012-05-28 20:01:51 +00:00
|
|
|
InstallFindFrame();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
2011-12-22 13:28:11 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
|
|
|
break;
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
case ID_POPUP_PCB_END_LINE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// EndSegment(&dc);
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TRACK:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2007-09-12 02:14:07 +00:00
|
|
|
Edit_Track_Width( &dc, (TRACK*) GetCurItem() );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TRACKSEG:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2007-09-12 02:14:07 +00:00
|
|
|
Edit_TrackSegm_Width( &dc, (TRACK*) GetCurItem() );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
{
|
2009-10-30 17:58:15 +00:00
|
|
|
int type = GetCurItem()->Type();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( type == PCB_TRACE_T || type == PCB_VIA_T )
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
|
|
|
BOARD_CONNECTED_ITEM*item = (BOARD_CONNECTED_ITEM*) GetCurItem();
|
2014-02-25 10:47:27 +00:00
|
|
|
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this, item->GetNetCode() );
|
2009-10-30 17:58:15 +00:00
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2012-12-01 20:03:33 +00:00
|
|
|
case ID_POPUP_PCB_BEGIN_TRACK:
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
OnHotkeyBeginRoute( &dc );
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_END_TRACK:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
End_Route( (TRACK*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-12-21 13:42:02 +00:00
|
|
|
|
|
|
|
if( GetCurItem()->IsDragging() )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2009-08-08 06:07:08 +00:00
|
|
|
PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-12-21 13:42:02 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2010-06-16 15:01:45 +00:00
|
|
|
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
|
2010-07-11 16:24:44 +00:00
|
|
|
/* change the position of initial segment when creating new tracks
|
|
|
|
* switch from _/ to -\ .
|
2010-08-17 10:41:44 +00:00
|
|
|
* If a track is in progress, it will be redrawn
|
2010-07-11 16:24:44 +00:00
|
|
|
*/
|
2011-12-29 20:11:42 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() )
|
|
|
|
m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
|
2011-02-03 19:27:28 +00:00
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
|
2011-02-03 19:27:28 +00:00
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() )
|
|
|
|
m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
|
2011-02-03 19:27:28 +00:00
|
|
|
|
2010-07-11 16:24:44 +00:00
|
|
|
break;
|
2010-06-16 15:01:45 +00:00
|
|
|
|
2008-01-12 20:31:56 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_MICROVIA:
|
2010-01-31 20:01:46 +00:00
|
|
|
if( !IsMicroViaAcceptable() )
|
2008-04-01 05:21:50 +00:00
|
|
|
break;
|
2013-08-28 16:14:39 +00:00
|
|
|
// fall through
|
|
|
|
case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
|
|
|
|
case ID_POPUP_PCB_PLACE_THROUGH_VIA:
|
2013-09-20 10:52:33 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA:
|
|
|
|
case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-12-21 13:42:02 +00:00
|
|
|
|
|
|
|
if( GetCurItem()->IsDragging() )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2009-08-08 06:07:08 +00:00
|
|
|
PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-04-25 06:00:04 +00:00
|
|
|
BOARD_DESIGN_SETTINGS &settings = GetDesignSettings();
|
|
|
|
VIATYPE_T v_type = settings.m_CurrentViaType;
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
|
|
|
|
case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
|
|
|
|
settings.m_CurrentViaType = VIA_BLIND_BURIED;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_PLACE_MICROVIA:
|
|
|
|
settings.m_CurrentViaType = VIA_MICROVIA;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
settings.m_CurrentViaType = VIA_THROUGH;
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2013-08-28 16:14:39 +00:00
|
|
|
// place via and switch layer.
|
2013-09-20 10:52:33 +00:00
|
|
|
if( id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA ||
|
|
|
|
id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA )
|
|
|
|
{
|
|
|
|
m_canvas->SetIgnoreMouseEvents( true );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2013-09-25 19:09:57 +00:00
|
|
|
wxPoint dlgPosition;
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2013-09-25 19:09:57 +00:00
|
|
|
wxGetMousePosition( &dlgPosition.x, &dlgPosition.y );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
|
|
|
LAYER_ID layer = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask(), dlgPosition );
|
|
|
|
|
2013-09-20 10:52:33 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( false );
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
|
2014-03-21 10:17:47 +00:00
|
|
|
if( GetActiveLayer() != layer )
|
2013-09-20 10:52:33 +00:00
|
|
|
{
|
2014-03-21 10:17:47 +00:00
|
|
|
GetScreen()->m_Route_Layer_TOP = GetActiveLayer();
|
2013-09-20 10:52:33 +00:00
|
|
|
GetScreen()->m_Route_Layer_BOTTOM = layer;
|
|
|
|
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
|
|
|
|
|
2014-04-25 06:00:04 +00:00
|
|
|
settings.m_CurrentViaType = v_type;
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
if( displ_opts->m_ContrastModeDisplay )
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_TRACKSEG:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TRACK:
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Track( &dc, (TRACK*) GetCurItem() );
|
|
|
|
SetCurItem( NULL );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TRACKNET:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_net( &dc, (TRACK*) GetCurItem() );
|
|
|
|
SetCurItem( NULL );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
|
2009-01-09 19:09:13 +00:00
|
|
|
Attribut_Segment( (TRACK*) GetCurItem(), &dc, true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
|
2009-01-09 19:09:13 +00:00
|
|
|
Attribut_Segment( (TRACK*) GetCurItem(), &dc, false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_TRACK:
|
2009-01-09 19:09:13 +00:00
|
|
|
Attribut_Track( (TRACK*) GetCurItem(), &dc, true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_TRACK:
|
2009-01-09 19:09:13 +00:00
|
|
|
Attribut_Track( (TRACK*) GetCurItem(), &dc, false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_ON_NET:
|
2014-02-25 10:47:27 +00:00
|
|
|
Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNetCode(), true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_LOCK_OFF_NET:
|
2014-02-25 10:47:27 +00:00
|
|
|
Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNetCode(), false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SETFLAGS_TRACK_MNU:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_ZONE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
if( GetCurItem() == NULL )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-03-30 15:36:41 +00:00
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
SEGZONE* zsegm = (SEGZONE*) GetCurItem();
|
2014-02-25 10:47:27 +00:00
|
|
|
int netcode = zsegm->GetNetCode();
|
2011-07-16 16:04:49 +00:00
|
|
|
Delete_OldZone_Fill( zsegm );
|
2009-07-25 04:53:39 +00:00
|
|
|
SetCurItem( NULL );
|
2011-09-15 17:58:35 +00:00
|
|
|
TestNetConnection( NULL, netcode );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( GetBoard() );
|
2009-03-30 15:36:41 +00:00
|
|
|
}
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2007-12-29 19:15:58 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
|
|
|
|
Edit_Zone_Params( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
2008-02-01 21:30:45 +00:00
|
|
|
SetCurItem( NULL ); // Outlines can have changed
|
2007-12-29 19:15:58 +00:00
|
|
|
break;
|
|
|
|
|
2012-06-04 19:04:12 +00:00
|
|
|
case ID_POPUP_PCB_ZONE_DUPLICATE:
|
2014-06-29 13:05:51 +00:00
|
|
|
{
|
|
|
|
ZONE_CONTAINER* zone = (ZONE_CONTAINER*) GetCurItem();
|
|
|
|
duplicateZone( &dc, zone );
|
|
|
|
}
|
|
|
|
break;
|
2012-06-04 19:04:12 +00:00
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAutoPanRequest( true );
|
2008-01-04 12:27:16 +00:00
|
|
|
Add_Similar_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
2008-02-01 21:30:45 +00:00
|
|
|
break;
|
2008-01-01 11:46:47 +00:00
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAutoPanRequest( true );
|
2008-01-04 12:27:16 +00:00
|
|
|
Add_Zone_Cutout( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
2008-02-01 21:30:45 +00:00
|
|
|
break;
|
2008-01-01 11:46:47 +00:00
|
|
|
|
2007-12-29 19:15:58 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_CONTAINER:
|
2014-12-03 16:22:06 +00:00
|
|
|
// Force the main contour selection, to remove the entire zone:
|
|
|
|
((ZONE_CONTAINER*) GetCurItem())->SetSelectedCorner( 0 );
|
|
|
|
// Fall through
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_CUTOUT:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-03-30 15:36:41 +00:00
|
|
|
{
|
2014-02-25 10:47:27 +00:00
|
|
|
int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNetCode();
|
2009-07-25 04:53:39 +00:00
|
|
|
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
|
|
|
SetCurItem( NULL );
|
2011-09-15 17:58:35 +00:00
|
|
|
TestNetConnection( NULL, netcode );
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( GetBoard() );
|
2009-03-30 15:36:41 +00:00
|
|
|
}
|
2008-02-01 21:30:45 +00:00
|
|
|
break;
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_CORNER:
|
|
|
|
Remove_Zone_Corner( &dc, (ZONE_CONTAINER*) GetCurItem() );
|
2007-12-29 19:15:58 +00:00
|
|
|
SetCurItem( NULL );
|
|
|
|
break;
|
2008-02-01 21:30:45 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_ZONE_CORNER:
|
2014-06-29 13:05:51 +00:00
|
|
|
{
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
|
|
|
m_canvas->SetAutoPanRequest( true );
|
|
|
|
Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), false );
|
|
|
|
}
|
2007-12-29 19:15:58 +00:00
|
|
|
break;
|
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
|
2014-06-29 13:05:51 +00:00
|
|
|
{
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
|
|
|
m_canvas->SetAutoPanRequest( true );
|
|
|
|
Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->GetSelectedCorner() );
|
|
|
|
}
|
2008-01-16 20:37:50 +00:00
|
|
|
break;
|
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
|
2014-06-29 13:05:51 +00:00
|
|
|
{
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
|
|
|
m_canvas->SetAutoPanRequest( true );
|
|
|
|
Start_Move_Zone_Outlines( &dc, zone_cont );
|
|
|
|
}
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2008-02-01 21:30:45 +00:00
|
|
|
case ID_POPUP_PCB_ADD_ZONE_CORNER:
|
2014-06-29 13:05:51 +00:00
|
|
|
{
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
|
|
|
wxPoint pos = GetCrossHairPosition();
|
|
|
|
|
|
|
|
/* add corner between zone_cont->m_CornerSelection
|
|
|
|
* and zone_cont->m_CornerSelection+1
|
|
|
|
* and start move the new corner
|
|
|
|
*/
|
|
|
|
zone_cont->Draw( m_canvas, &dc, GR_XOR );
|
|
|
|
zone_cont->Outline()->InsertCorner( zone_cont->GetSelectedCorner(), pos.x, pos.y );
|
|
|
|
zone_cont->SetSelectedCorner( zone_cont->GetSelectedCorner() + 1 );
|
|
|
|
zone_cont->Draw( m_canvas, &dc, GR_XOR );
|
|
|
|
m_canvas->SetAutoPanRequest( true );
|
|
|
|
Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), true );
|
|
|
|
}
|
2007-12-29 19:15:58 +00:00
|
|
|
break;
|
2008-02-01 21:30:45 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
|
|
|
|
case ID_POPUP_PCB_PLACE_ZONE_CORNER:
|
2015-02-01 07:19:31 +00:00
|
|
|
case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT:
|
2014-06-29 13:05:51 +00:00
|
|
|
{
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
|
|
|
End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
|
|
|
|
m_canvas->SetAutoPanRequest( false );
|
|
|
|
}
|
2008-02-01 21:30:45 +00:00
|
|
|
break;
|
|
|
|
|
2007-12-30 18:20:51 +00:00
|
|
|
case ID_POPUP_PCB_FILL_ALL_ZONES:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-11-10 08:21:11 +00:00
|
|
|
Fill_All_Zones( this );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( GetBoard() );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2008-10-29 15:26:53 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
|
2011-10-01 19:24:27 +00:00
|
|
|
if( ( GetCurItem() )->Type() == PCB_ZONE_AREA_T )
|
2008-10-29 15:26:53 +00:00
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
|
2011-07-16 16:04:49 +00:00
|
|
|
zone_container->UnFill();
|
2014-02-25 10:47:27 +00:00
|
|
|
TestNetConnection( NULL, zone_container->GetNetCode() );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( GetBoard() );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2008-10-29 15:26:53 +00:00
|
|
|
}
|
2009-05-24 18:28:36 +00:00
|
|
|
SetCurItem( NULL );
|
2008-10-29 15:26:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
|
2009-07-25 04:53:39 +00:00
|
|
|
GetBoard()->m_Zone.DeleteAll(); // remove zone segments used to fill zones.
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
|
2009-07-25 04:53:39 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
// Remove filled areas in zone
|
2009-01-05 05:21:35 +00:00
|
|
|
ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii );
|
2015-07-15 12:08:50 +00:00
|
|
|
zone_container->UnFill();
|
2008-10-11 19:27:43 +00:00
|
|
|
}
|
2009-07-25 04:53:39 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer
|
2011-11-10 08:21:11 +00:00
|
|
|
TestConnections();
|
2011-11-08 16:18:46 +00:00
|
|
|
TestForActiveLinksInRatsnest( 0 ); // Recalculate the active ratsnest, i.e. the unconnected links
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( GetBoard() );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2008-10-11 19:27:43 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2007-12-29 19:15:58 +00:00
|
|
|
case ID_POPUP_PCB_FILL_ZONE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-08-23 15:22:44 +00:00
|
|
|
Fill_Zone( (ZONE_CONTAINER*) GetCurItem() );
|
2014-02-25 10:47:27 +00:00
|
|
|
TestNetConnection( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNetCode() );
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( GetBoard() );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2007-12-29 19:15:58 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
|
2011-11-24 19:57:41 +00:00
|
|
|
StartMoveTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAutoPanRequest( true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
|
|
|
|
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
|
2010-09-15 17:50:47 +00:00
|
|
|
if( GetCurItem() == NULL )
|
|
|
|
break;
|
2011-09-15 17:58:35 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2011-10-01 19:24:27 +00:00
|
|
|
if( GetCurItem()->Type() != PCB_MODULE_T )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
2013-03-13 18:53:58 +00:00
|
|
|
module->GetReference().GetData() );
|
2010-08-29 21:31:27 +00:00
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-10-24 15:23:06 +00:00
|
|
|
SendMessageToEESCHEMA( module );
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( module->GetPosition() );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2012-09-11 07:33:17 +00:00
|
|
|
StartMoveModule( module, &dc, id == ID_POPUP_PCB_DRAG_MODULE_REQUEST );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: // get module by name and move it
|
2015-12-20 18:47:52 +00:00
|
|
|
SetCurItem( GetFootprintFromBoardByReference() );
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-09-15 17:50:47 +00:00
|
|
|
if( module == NULL )
|
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
wxString msg = wxString::Format(
|
|
|
|
_( "Footprint %s found, but it is locked" ),
|
|
|
|
module->GetReference().GetData() );
|
2010-08-29 21:31:27 +00:00
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-10-24 15:23:06 +00:00
|
|
|
SendMessageToEESCHEMA( module );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2012-09-11 07:33:17 +00:00
|
|
|
StartMoveModule( module, &dc, false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_MODULE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2011-10-01 19:24:27 +00:00
|
|
|
if( GetCurItem()->Type() != PCB_MODULE_T )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
2013-03-13 18:53:58 +00:00
|
|
|
module->GetReference().GetData() );
|
2010-08-29 21:31:27 +00:00
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2015-11-18 18:59:24 +00:00
|
|
|
if( Delete_Module( (MODULE*) GetCurItem(), &dc ) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2011-10-01 19:24:27 +00:00
|
|
|
if( GetCurItem()->Type() != PCB_MODULE_T )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
2013-03-13 18:53:58 +00:00
|
|
|
module->GetReference().GetData() );
|
2010-08-29 21:31:27 +00:00
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// This is a simple rotation, no other editing in progress
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !GetCurItem()->IsMoving() )
|
2013-12-17 21:38:20 +00:00
|
|
|
SaveCopyInUndoList( GetCurItem(), UR_CHANGED, ((MODULE*)GetCurItem())->GetPosition() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2013-12-16 21:40:03 +00:00
|
|
|
Rotate_Module( &dc, (MODULE*) GetCurItem(), m_rotationAngle, true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2011-10-01 19:24:27 +00:00
|
|
|
if( GetCurItem()->Type() != PCB_MODULE_T )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
2013-03-13 18:53:58 +00:00
|
|
|
module->GetReference().GetData() );
|
2010-08-29 21:31:27 +00:00
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// This is a simple rotation, no other editing in progress
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !GetCurItem()->IsMoving() )
|
2013-12-17 21:38:20 +00:00
|
|
|
SaveCopyInUndoList( GetCurItem(), UR_CHANGED, ((MODULE*)GetCurItem())->GetPosition() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2013-12-16 21:40:03 +00:00
|
|
|
Rotate_Module( &dc, (MODULE*) GetCurItem(), -m_rotationAngle, true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2011-10-01 19:24:27 +00:00
|
|
|
if( GetCurItem()->Type() != PCB_MODULE_T )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
2013-03-13 18:53:58 +00:00
|
|
|
module->GetReference().GetData() );
|
2010-08-29 21:31:27 +00:00
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// This is a simple flip, no other editing in progress
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !GetCurItem()->IsMoving() )
|
2013-03-13 18:53:58 +00:00
|
|
|
SaveCopyInUndoList( GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->GetPosition() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-06 07:11:04 +00:00
|
|
|
Change_Side_Module( (MODULE*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2015-08-20 18:13:18 +00:00
|
|
|
case ID_POPUP_PCB_EXCHANGE_FOOTPRINTS:
|
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
|
|
|
|
break;
|
|
|
|
|
|
|
|
InstallExchangeModuleFrame( (MODULE*) GetCurItem() );
|
|
|
|
// Warning: the current item can be deleted by exchange module
|
|
|
|
SetCurItem( NULL );
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
break;
|
|
|
|
|
2013-03-01 19:59:29 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_MODULE_PRMS:
|
2009-10-14 18:14:58 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
2011-10-01 19:24:27 +00:00
|
|
|
if( GetCurItem()->Type() != PCB_MODULE_T )
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-05-23 07:16:05 +00:00
|
|
|
InstallModuleOptionsFrame( (MODULE*) GetCurItem(), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2013-03-01 19:59:29 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT:
|
2015-03-14 07:43:36 +00:00
|
|
|
|
|
|
|
// If we don't have a current item, there's nothing we can do here
|
|
|
|
if( !GetCurItem() )
|
|
|
|
break;
|
|
|
|
|
2013-03-01 19:59:29 +00:00
|
|
|
// If the current Item is a pad, text module ...: Get its parent
|
|
|
|
if( GetCurItem()->Type() != PCB_MODULE_T )
|
|
|
|
SetCurItem( GetCurItem()->GetParent() );
|
|
|
|
|
|
|
|
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
|
|
|
|
break;
|
|
|
|
|
|
|
|
if( GetCurItem()->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
|
|
|
|
{
|
|
|
|
GetCurItem()->SetTimeStamp( GetNewTimeStamp() );
|
|
|
|
OnModify();
|
|
|
|
}
|
2013-05-28 16:54:59 +00:00
|
|
|
|
2013-10-17 18:47:46 +00:00
|
|
|
{
|
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
|
|
|
FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
|
2013-03-01 19:59:29 +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
|
|
|
editor->Load_Module_From_BOARD( (MODULE*)GetCurItem() );
|
2013-10-17 18:47:46 +00:00
|
|
|
SetCurItem( NULL ); // the current module could be deleted by
|
2013-03-01 19:59:29 +00:00
|
|
|
}
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DRAG_PAD_REQUEST:
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem()->GetParent();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( !module || module->Type() != PCB_MODULE_T )
|
2010-08-29 21:31:27 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "The parent (%s) of the pad is locked" ),
|
2013-03-13 18:53:58 +00:00
|
|
|
module->GetReference().GetData() );
|
2010-08-29 21:31:27 +00:00
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2012-09-11 07:33:17 +00:00
|
|
|
StartMovePad( (D_PAD*) GetCurItem(), &dc, true );
|
2007-10-07 18:24:15 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_PAD_REQUEST:
|
2010-08-29 21:31:27 +00:00
|
|
|
module = (MODULE*) GetCurItem()->GetParent();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( !module || module->Type() != PCB_MODULE_T )
|
2010-08-29 21:31:27 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2010-08-29 21:31:27 +00:00
|
|
|
if( module->IsLocked() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "The parent (%s) of the pad is locked" ),
|
2013-03-13 18:53:58 +00:00
|
|
|
module->GetReference().GetData() );
|
2010-08-29 21:31:27 +00:00
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2012-09-11 07:33:17 +00:00
|
|
|
StartMovePad( (D_PAD*) GetCurItem(), &dc, false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_PAD:
|
2009-12-19 19:24:49 +00:00
|
|
|
InstallPadOptionsFrame( (D_PAD*) GetCurItem() );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
|
2008-04-18 13:28:56 +00:00
|
|
|
Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-12-30 12:29:54 +00:00
|
|
|
DlgGlobalChange_PadSettings( (D_PAD*) GetCurItem(), true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
Export_Pad_Settings( (D_PAD*) GetCurItem() );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_PAD:
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
|
2009-05-21 12:45:21 +00:00
|
|
|
DeletePad( (D_PAD*) GetCurItem() );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTMODULE:
|
2014-09-10 15:18:42 +00:00
|
|
|
InstallTextModOptionsFrame( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2011-01-09 11:17:28 +00:00
|
|
|
case ID_POPUP_PCB_RESET_TEXT_SIZE:
|
|
|
|
ResetTextSize( GetCurItem(), &dc );
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2014-09-10 15:18:42 +00:00
|
|
|
StartMoveTexteModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
|
2014-09-10 15:18:42 +00:00
|
|
|
RotateTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TEXTMODULE:
|
2014-09-10 15:18:42 +00:00
|
|
|
DeleteTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ) );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_LAYER:
|
2013-08-30 19:28:31 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
LAYER_ID itmp = SelectLayer( GetActiveLayer() );
|
|
|
|
|
|
|
|
if( itmp >= 0 )
|
2013-08-30 19:28:31 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
// if user changed colors and we are in high contrast mode, then redraw
|
2015-08-23 19:40:33 +00:00
|
|
|
// because the PAD_ATTRIB_SMD pads may change color.
|
2015-01-10 10:27:49 +00:00
|
|
|
if( displ_opts->m_ContrastModeDisplay && GetActiveLayer() != itmp )
|
2014-06-24 16:17:18 +00:00
|
|
|
{
|
|
|
|
m_canvas->Refresh();
|
|
|
|
}
|
|
|
|
SetActiveLayer( itmp );
|
2013-08-30 19:28:31 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
}
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
|
2013-09-11 15:30:21 +00:00
|
|
|
SelectCopperLayerPair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
|
2014-06-24 16:17:18 +00:00
|
|
|
{
|
|
|
|
LAYER_ID itmp = SelectLayer( GetActiveLayer(), LSET::AllCuMask() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
if( itmp >= 0 )
|
|
|
|
SetActiveLayer( itmp );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
}
|
2010-01-24 02:05:07 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_CU_LAYER:
|
2014-06-24 16:17:18 +00:00
|
|
|
{
|
|
|
|
LAYER_ID itmp = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
if( itmp >= 0 )
|
|
|
|
SetActiveLayer( itmp );
|
|
|
|
}
|
2010-01-24 02:05:07 +00:00
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
|
2013-09-11 15:30:21 +00:00
|
|
|
SelectCopperLayerPair();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
2014-06-29 13:05:51 +00:00
|
|
|
SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
if( displ_opts->m_ContrastModeDisplay )
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTEPCB:
|
2008-12-20 17:28:25 +00:00
|
|
|
InstallTextPCBOptionsFrame( (TEXTE_PCB*) GetCurItem(), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
|
2007-09-12 02:14:07 +00:00
|
|
|
Rotate_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2012-07-04 19:50:47 +00:00
|
|
|
case ID_POPUP_PCB_COPY_TEXTEPCB:
|
|
|
|
CreateTextePcb( &dc, (TEXTE_PCB*) GetCurItem() );
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
m_canvas->SetAutoPanRequest( true );
|
|
|
|
break;
|
|
|
|
|
2012-05-30 17:38:52 +00:00
|
|
|
case ID_POPUP_PCB_FLIP_TEXTEPCB:
|
|
|
|
FlipTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_TEXTEPCB:
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_MIRE_REQUEST:
|
2011-09-07 19:41:04 +00:00
|
|
|
BeginMoveTarget( (PCB_TARGET*) GetCurItem(), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_MIRE:
|
2011-09-07 19:41:04 +00:00
|
|
|
ShowTargetOptionsDialog( (PCB_TARGET*) GetCurItem(), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_MIRE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-09-07 19:41:04 +00:00
|
|
|
DeleteTarget( (PCB_TARGET*) GetCurItem(), &dc );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_DIMENSION:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-09-20 15:07:52 +00:00
|
|
|
DeleteDimension( (DIMENSION*) GetCurItem(), &dc );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_DIMENSION:
|
2011-09-20 15:07:52 +00:00
|
|
|
ShowDimensionPropertyDialog( (DIMENSION*) GetCurItem(), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2011-11-24 19:57:41 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST:
|
|
|
|
BeginMoveDimensionText( (DIMENSION*) GetCurItem(), &dc );
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_DRAWING:
|
2007-09-12 02:14:07 +00:00
|
|
|
Delete_Segment_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_MARKER:
|
|
|
|
RemoveStruct( GetCurItem(), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-10-29 15:51:48 +00:00
|
|
|
break;
|
|
|
|
|
2009-07-13 15:25:41 +00:00
|
|
|
case ID_POPUP_PCB_GETINFO_MARKER:
|
2011-10-01 19:24:27 +00:00
|
|
|
if( GetCurItem() && GetCurItem()->Type() == PCB_MARKER_T )
|
2009-08-01 19:26:05 +00:00
|
|
|
( (MARKER_PCB*) GetCurItem() )->DisplayMarkerInfo( this );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-07-13 15:25:41 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
|
2011-12-21 13:42:02 +00:00
|
|
|
if( GetCurItem()->GetFlags() != 0 )
|
2009-08-11 10:27:21 +00:00
|
|
|
break;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
Delete_Drawings_All_Layer( GetCurItem()->GetLayer() );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
m_canvas->Refresh();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_DRAWING:
|
2014-02-18 20:30:17 +00:00
|
|
|
#ifndef USE_WX_OVERLAY
|
2009-07-25 04:53:39 +00:00
|
|
|
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), &dc );
|
2014-02-18 20:30:17 +00:00
|
|
|
#else
|
2014-02-19 21:39:21 +00:00
|
|
|
// #1277772 - Draw into dialog converted in refresh request
|
2014-02-18 20:30:17 +00:00
|
|
|
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), NULL );
|
|
|
|
m_canvas->Refresh();
|
|
|
|
#endif
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_DRAWING_REQUEST:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-09-12 02:14:07 +00:00
|
|
|
Start_Move_DrawItem( (DRAWSEGMENT*) GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
if( GetCurItem() && (GetCurItem()->IsNew()) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
if( GetCurItem() && (GetCurItem()->IsNew()) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2008-02-01 21:30:45 +00:00
|
|
|
if( End_Zone( &dc ) )
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAutoPanRequest( false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-23 08:01:38 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
if( GetCurItem() && (GetCurItem()->IsNew()) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2008-02-01 21:30:45 +00:00
|
|
|
if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
|
|
|
|
SetCurItem( NULL );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-09-15 17:58:35 +00:00
|
|
|
StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
|
|
|
|
case ID_POPUP_PCB_MOVE_TRACK_NODE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-09-15 17:58:35 +00:00
|
|
|
StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
Start_DragTrackSegmentAndKeepSlope( (TRACK*) GetScreen()->GetCurItem(), &dc );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_BREAK_TRACK:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
TRACK* track = (TRACK*) GetScreen()->GetCurItem();
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint pos = GetCrossHairPosition();
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
track->Draw( m_canvas, &dc, GR_XOR );
|
2009-08-08 06:07:08 +00:00
|
|
|
PICKED_ITEMS_LIST itemsListPicker;
|
2013-08-03 05:15:23 +00:00
|
|
|
|
2011-09-17 01:22:26 +00:00
|
|
|
TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker );
|
2013-08-03 05:15:23 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED );
|
2011-12-22 13:28:11 +00:00
|
|
|
track->Draw( m_canvas, &dc, GR_XOR );
|
|
|
|
newtrack->Draw( m_canvas, &dc, GR_XOR );
|
2013-08-03 05:15:23 +00:00
|
|
|
|
|
|
|
// compute the new ratsnest, because connectivity could change
|
2014-02-25 10:47:27 +00:00
|
|
|
TestNetConnection( &dc, track->GetNetCode() );
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
case ID_POPUP_PCB_MOVE_EXACT:
|
|
|
|
moveExact();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DUPLICATE_ITEM:
|
|
|
|
case ID_POPUP_PCB_DUPLICATE_ITEM_AND_INCREMENT:
|
2015-03-22 09:42:41 +00:00
|
|
|
duplicateItems( id == ID_POPUP_PCB_DUPLICATE_ITEM_AND_INCREMENT );
|
2015-02-12 03:22:24 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_CREATE_ARRAY:
|
|
|
|
createArray();
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
case ID_MENU_PCB_CLEAN:
|
2013-03-08 07:29:30 +00:00
|
|
|
Clean_Pcb();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MENU_PCB_SWAP_LAYERS:
|
|
|
|
Swap_Layers( event );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_USER_GRID_SETUP:
|
2013-07-09 05:48:26 +00:00
|
|
|
InvokeDialogGrid();
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:
|
2013-07-09 05:48:26 +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
|
|
|
wxConfigBase* cfg = Pgm().CommonSettings();
|
2013-07-09 05:48:26 +00:00
|
|
|
cfg->Read( wxT( "module_doc_file" ), g_DocModulesFileName );
|
* 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
|
|
|
GetAssociatedDocument( this, g_DocModulesFileName, &Kiface().KifaceSearch() );
|
2013-07-09 05:48:26 +00:00
|
|
|
}
|
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2015-09-28 08:46:00 +00:00
|
|
|
case ID_MENU_ARCHIVE_MODULES_IN_LIBRARY:
|
|
|
|
ArchiveModulesOnBoard( false );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2015-09-28 08:46:00 +00:00
|
|
|
case ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES:
|
|
|
|
ArchiveModulesOnBoard( true );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2013-10-24 16:44:38 +00:00
|
|
|
case ID_GEN_IMPORT_DXF_FILE:
|
2014-07-09 13:02:56 +00:00
|
|
|
InvokeDXFDialogBoardImport( this );
|
2013-10-24 16:44:38 +00:00
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
default:
|
2009-07-25 04:53:39 +00:00
|
|
|
wxString msg;
|
2014-07-09 13:02:56 +00:00
|
|
|
msg.Printf( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ), id );
|
2009-06-19 20:13:22 +00:00
|
|
|
DisplayError( this, msg );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->CrossHairOn( &dc );
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( false );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-04 00:56:53 +00:00
|
|
|
if( Item == NULL )
|
|
|
|
return;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( Item->Type() )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_T:
|
2015-11-18 18:59:24 +00:00
|
|
|
Delete_Module( (MODULE*) Item, DC );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_DIMENSION_T:
|
2011-09-20 15:07:52 +00:00
|
|
|
DeleteDimension( (DIMENSION*) Item, DC );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
case PCB_TARGET_T:
|
|
|
|
DeleteTarget( (PCB_TARGET*) Item, DC );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_LINE_T:
|
2007-08-04 00:56:53 +00:00
|
|
|
Delete_Segment_Edge( (DRAWSEGMENT*) Item, DC );
|
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_TEXT_T:
|
2007-08-04 00:56:53 +00:00
|
|
|
Delete_Texte_Pcb( (TEXTE_PCB*) Item, DC );
|
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_TRACE_T:
|
2007-08-04 00:56:53 +00:00
|
|
|
Delete_Track( DC, (TRACK*) Item );
|
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_VIA_T:
|
2007-08-04 00:56:53 +00:00
|
|
|
Delete_Segment( DC, (TRACK*) Item );
|
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_ZONE_T:
|
2011-07-16 16:04:49 +00:00
|
|
|
Delete_OldZone_Fill( (SEGZONE*) Item );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_ZONE_AREA_T:
|
2013-07-09 05:48:26 +00:00
|
|
|
{
|
|
|
|
SetCurItem( NULL );
|
2014-02-25 10:47:27 +00:00
|
|
|
int netcode = ( (ZONE_CONTAINER*) Item )->GetNetCode();
|
2013-07-09 05:48:26 +00:00
|
|
|
Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
|
|
|
|
TestNetConnection( NULL, netcode );
|
|
|
|
SetMsgPanel( GetBoard() );
|
|
|
|
}
|
|
|
|
break;
|
2009-04-07 11:53:58 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MARKER_T:
|
2007-10-29 15:51:48 +00:00
|
|
|
if( Item == GetCurItem() )
|
|
|
|
SetCurItem( NULL );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
( (MARKER_PCB*) Item )->Draw( m_canvas, DC, GR_XOR );
|
2007-10-29 15:51:48 +00:00
|
|
|
|
2009-07-29 13:10:36 +00:00
|
|
|
// delete the marker, and free memory. Don't use undo stack.
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->Delete( Item );
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_PAD_T:
|
|
|
|
case PCB_MODULE_TEXT_T:
|
|
|
|
case PCB_MODULE_EDGE_T:
|
2007-08-04 00:56:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TYPE_NOT_INIT:
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_T:
|
2007-08-04 00:56:53 +00:00
|
|
|
default:
|
2013-07-09 05:48:26 +00:00
|
|
|
{
|
|
|
|
wxString msg = wxString::Format(
|
|
|
|
wxT( "Remove: item type %d unknown." ), Item->Type() );
|
|
|
|
DisplayError( this, msg );
|
|
|
|
}
|
|
|
|
break;
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-06-11 21:21:00 +00:00
|
|
|
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer )
|
2007-06-11 21:21:00 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
LAYER_ID curLayer = GetActiveLayer();
|
2015-01-10 10:27:49 +00:00
|
|
|
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Check if the specified layer matches the present layer
|
2010-01-24 02:05:07 +00:00
|
|
|
if( layer == curLayer )
|
2007-08-04 00:56:53 +00:00
|
|
|
return;
|
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Copper layers cannot be selected unconditionally; how many
|
|
|
|
// of those layers are currently enabled needs to be checked.
|
2013-04-09 16:00:46 +00:00
|
|
|
if( IsCopperLayer( layer ) )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-10-10 21:35:41 +00:00
|
|
|
// If only one copper layer is enabled, the only such layer
|
2010-01-24 02:05:07 +00:00
|
|
|
// that can be selected to is the "Back" layer (so the
|
2007-10-10 21:35:41 +00:00
|
|
|
// selection of any other copper layer is disregarded).
|
2010-01-31 20:01:46 +00:00
|
|
|
if( GetBoard()->GetCopperLayerCount() < 2 )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( layer != B_Cu )
|
2007-10-10 21:35:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// If more than one copper layer is enabled, the "Copper"
|
|
|
|
// and "Component" layers can be selected, but the total
|
|
|
|
// number of copper layers determines which internal
|
|
|
|
// layers are also capable of being selected.
|
|
|
|
else
|
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( layer != B_Cu && layer != F_Cu && layer >= GetBoard()->GetCopperLayerCount() - 1 )
|
2007-10-10 21:35:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
EDA_ITEM* current = GetScreen()->GetCurItem();
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// See if we are drawing a segment; if so, add a via?
|
2014-06-24 16:17:18 +00:00
|
|
|
if( GetToolId() == ID_TRACK_BUTT && current )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( current->Type() == PCB_TRACE_T && current->IsNew() )
|
2007-08-04 00:56:53 +00:00
|
|
|
{
|
2007-10-10 21:35:41 +00:00
|
|
|
// Want to set the routing layers so that it switches properly -
|
|
|
|
// see the implementation of Other_Layer_Route - the working
|
|
|
|
// layer is used to 'start' the via and set the layer masks appropriately.
|
2010-01-24 02:05:07 +00:00
|
|
|
GetScreen()->m_Route_Layer_TOP = curLayer;
|
2008-04-29 16:22:39 +00:00
|
|
|
GetScreen()->m_Route_Layer_BOTTOM = layer;
|
2010-01-24 02:05:07 +00:00
|
|
|
|
2014-03-21 10:17:47 +00:00
|
|
|
SetActiveLayer( curLayer );
|
2008-02-01 21:30:45 +00:00
|
|
|
|
2007-12-14 22:31:45 +00:00
|
|
|
if( Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC ) )
|
|
|
|
{
|
2015-01-10 10:27:49 +00:00
|
|
|
if( displ_opts->m_ContrastModeDisplay )
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2007-12-14 22:31:45 +00:00
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-12-14 22:31:45 +00:00
|
|
|
// if the via was allowed by DRC, then the layer swap has already
|
2008-02-01 21:30:45 +00:00
|
|
|
// been done by Other_Layer_Route(). if via not allowed, then
|
2010-01-24 02:05:07 +00:00
|
|
|
// return now so assignment to setActiveLayer() below doesn't happen.
|
2007-12-14 22:31:45 +00:00
|
|
|
return;
|
2007-08-04 00:56:53 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-10 21:35:41 +00:00
|
|
|
}
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Is yet more checking required? E.g. when the layer to be selected
|
|
|
|
// is a non-copper layer, or when switching between a copper layer
|
|
|
|
// and a non-copper layer, or vice-versa?
|
|
|
|
// ...
|
2007-08-04 00:56:53 +00:00
|
|
|
|
2014-03-21 10:17:47 +00:00
|
|
|
SetActiveLayer( layer );
|
2007-10-10 21:35:41 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
if( displ_opts->m_ContrastModeDisplay )
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2007-06-11 21:21:00 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
int id = aEvent.GetId();
|
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == id )
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2015-01-10 10:27:49 +00:00
|
|
|
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
// Stop the current command and deselect the current tool.
|
|
|
|
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
switch( id )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_NO_TOOL_SELECTED:
|
|
|
|
SetToolID( id, m_canvas->GetDefaultCursor(), wxEmptyString );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_TRACK_BUTT:
|
|
|
|
if( g_Drc_On )
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) );
|
|
|
|
else
|
|
|
|
SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
2014-07-09 11:50:27 +00:00
|
|
|
Compile_Ratsnest( &dc, true );
|
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_MODULE_BUTT:
|
2015-11-17 16:18:00 +00:00
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add footprint" ) );
|
2014-07-09 11:50:27 +00:00
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_ZONES_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add zones" ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
if( displ_opts->m_DisplayZonesMode != 0 )
|
2014-07-09 11:50:27 +00:00
|
|
|
DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
|
2012-07-13 18:55:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
if( !GetBoard()->IsHighLightNetON() && (GetBoard()->GetHighLightNetCode() > 0 ) )
|
|
|
|
HighLight( &dc );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_KEEPOUT_AREA_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add keepout" ) );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_MIRE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust zero" ) );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_PLACE_GRID_COORD_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_ADD_LINE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic line" ) );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_ARC_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic arc" ) );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_CIRCLE_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic circle" ) );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_ADD_TEXT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_COMPONENT_BUTT:
|
2015-11-17 16:18:00 +00:00
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Add footprint" ) );
|
2014-07-09 11:50:27 +00:00
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_DIMENSION_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add dimension" ) );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_DELETE_ITEM_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_HIGHLIGHT_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Highlight net" ) );
|
|
|
|
break;
|
2014-02-17 17:21:00 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
case ID_PCB_SHOW_1_RATSNEST_BUTT:
|
|
|
|
SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
|
2014-02-28 14:46:05 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|
|
|
|
Compile_Ratsnest( &dc, true );
|
2014-02-17 17:21:00 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
break;
|
2014-02-17 17:21:00 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
2015-02-12 03:22:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
void PCB_EDIT_FRAME::moveExact()
|
|
|
|
{
|
|
|
|
wxPoint translation;
|
|
|
|
double rotation = 0;
|
|
|
|
|
|
|
|
DIALOG_MOVE_EXACT dialog( this, translation, rotation );
|
|
|
|
int ret = dialog.ShowModal();
|
|
|
|
|
2015-02-22 14:43:44 +00:00
|
|
|
if( ret == wxID_OK )
|
2015-02-12 03:22:24 +00:00
|
|
|
{
|
2015-03-22 09:42:41 +00:00
|
|
|
if( BOARD_ITEM* item = GetScreen()->GetCurItem() )
|
|
|
|
{
|
|
|
|
// When a pad is modified, the full footprint is saved
|
|
|
|
BOARD_ITEM* itemToSave = item;
|
2015-02-22 09:39:58 +00:00
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
if( item->Type() == PCB_PAD_T )
|
|
|
|
itemToSave = item->GetParent();
|
2015-02-22 09:39:58 +00:00
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
// Could be moved or rotated
|
|
|
|
SaveCopyInUndoList( itemToSave, UR_CHANGED );
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
item->Move( translation );
|
|
|
|
item->Rotate( item->GetPosition(), rotation );
|
|
|
|
m_canvas->Refresh();
|
|
|
|
}
|
2015-02-12 03:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
}
|
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
void PCB_EDIT_FRAME::duplicateItems( bool aIncrement )
|
2015-02-12 03:22:24 +00:00
|
|
|
{
|
|
|
|
BOARD_ITEM* item = GetScreen()->GetCurItem();
|
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
if( !item )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// In the board editor, the pads or fp texts can be edited
|
|
|
|
// but cannot be duplicated (only the fp editor can do that).
|
|
|
|
// only the footprint can be duplicated
|
|
|
|
if( item->Type() == PCB_PAD_T || item->Type() == PCB_MODULE_TEXT_T )
|
2015-02-18 19:30:14 +00:00
|
|
|
item = static_cast<MODULE*>( item )->GetParent();
|
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
PCB_BASE_EDIT_FRAME::duplicateItem( item, aIncrement );
|
|
|
|
}
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
void PCB_BASE_EDIT_FRAME::duplicateItem( BOARD_ITEM* aItem, bool aIncrement )
|
|
|
|
{
|
|
|
|
if( !aItem )
|
|
|
|
return;
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
// The easiest way to handle a duplicate item command
|
|
|
|
// is to simulate a block copy command, which gives us the undo management
|
|
|
|
// for free
|
|
|
|
if( GetScreen()->m_BlockLocate.GetState() == STATE_NO_BLOCK )
|
2015-02-12 03:22:24 +00:00
|
|
|
{
|
2015-03-22 09:42:41 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
wxPoint crossHairPos = GetCrossHairPosition();
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
const BLOCK_COMMAND_T blockType = aIncrement ? BLOCK_COPY_AND_INCREMENT : BLOCK_COPY;
|
|
|
|
|
|
|
|
if( !HandleBlockBegin( &dc, blockType, crossHairPos ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Add the item to the block copy pick list:
|
|
|
|
PICKED_ITEMS_LIST& itemsList = GetScreen()->m_BlockLocate.GetItems();
|
|
|
|
ITEM_PICKER picker( NULL, UR_UNSPECIFIED );
|
|
|
|
|
|
|
|
picker.SetItem ( aItem );
|
|
|
|
itemsList.PushItem( picker );
|
|
|
|
|
|
|
|
// Set 2 coordinates updated by the mouse, because our simulation
|
|
|
|
// does not use the mouse to call HandleBlockEnd()
|
|
|
|
GetScreen()->m_BlockLocate.SetLastCursorPosition( crossHairPos );
|
|
|
|
GetScreen()->m_BlockLocate.SetEnd( crossHairPos );
|
|
|
|
HandleBlockEnd( &dc );
|
2015-02-12 03:22:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
class LEGACY_ARRAY_CREATOR: public ARRAY_CREATOR
|
2015-02-12 03:22:24 +00:00
|
|
|
{
|
2016-04-02 12:52:29 +00:00
|
|
|
public:
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
LEGACY_ARRAY_CREATOR( PCB_BASE_EDIT_FRAME& editFrame ):
|
|
|
|
ARRAY_CREATOR( editFrame ),
|
|
|
|
m_item( m_parent.GetScreen()->GetCurItem() )
|
|
|
|
{}
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
private:
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
int getNumberOfItemsToArray() const //override
|
2015-02-12 03:22:24 +00:00
|
|
|
{
|
2016-04-02 12:52:29 +00:00
|
|
|
// only handle single items
|
|
|
|
return (m_item != NULL) ? 1 : 0;
|
|
|
|
}
|
2015-02-18 19:30:14 +00:00
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
BOARD_ITEM* getNthItemToArray( int n ) const //override
|
|
|
|
{
|
|
|
|
wxASSERT_MSG( n == 0, "Legacy array tool can only handle a single item" );
|
|
|
|
return m_item;
|
|
|
|
}
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
BOARD* getBoard() const //override
|
|
|
|
{
|
|
|
|
return m_parent.GetBoard();
|
|
|
|
}
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
MODULE* getModule() const //override
|
|
|
|
{
|
|
|
|
return dynamic_cast<MODULE*>( m_item->GetParent() );
|
|
|
|
}
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
wxPoint getRotationCentre() const //override
|
|
|
|
{
|
|
|
|
return m_item->GetCenter();
|
|
|
|
}
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
void finalise() // override
|
|
|
|
{
|
|
|
|
m_parent.GetCanvas()->Refresh();
|
|
|
|
}
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
BOARD_ITEM* m_item; // only have the one
|
|
|
|
};
|
2015-02-12 03:22:24 +00:00
|
|
|
|
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
void PCB_BASE_EDIT_FRAME::createArray()
|
|
|
|
{
|
|
|
|
LEGACY_ARRAY_CREATOR array_creator( *this );
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2016-04-02 12:52:29 +00:00
|
|
|
array_creator.Invoke();
|
2015-02-12 03:22:24 +00:00
|
|
|
}
|