-
-/* Process the command triggered by the left button of the mouse
- * currently: just display info in the message panel.
- */
-void GERBVIEW_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
-{
- SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
-
- GERBER_DRAW_ITEM* DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
-
- GetScreen()->SetCurItem( DrawStruct );
-
- if( DrawStruct == NULL )
- {
- GERBER_FILE_IMAGE* gerber = GetGbrImage( GetActiveLayer() );
-
- if( gerber )
- gerber->DisplayImageInfo( this );
- }
-}
-
-
-/* Called on a double click of left mouse button.
- */
-void GERBVIEW_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
-{
- // Currently: no nothing
-}
diff --git a/include/draw_frame.h b/include/draw_frame.h
index d9d63e5b82..fef732e5bb 100644
--- a/include/draw_frame.h
+++ b/include/draw_frame.h
@@ -425,7 +425,6 @@ public:
virtual void ExecuteRemoteCommand( const char* cmdline ){}
void OnMenuOpen( wxMenuEvent& event );
- void OnMouseEvent( wxMouseEvent& event );
/**
* After calling this function, if the left mouse button
@@ -455,9 +454,6 @@ public:
*/
virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0;
- virtual bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
- EDA_ITEM* aItem = NULL );
-
/**
* Add standard zoom commands and submenu zoom and grid selection to a popup menu
* uses zoom hotkeys info base to add hotkeys info to menu commands
@@ -609,22 +605,6 @@ public:
// EDA_DRAW_FRAME.
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
- /**
- * Perform application specific control using \a aDC at \a aPosition in logical units.
- *
- * Override this function for application specific control. This function gets
- * called on every mouse and key event.
- *
- * @param aDC A device context.
- * @param aPosition The current cursor position in logical (drawing) units.
- * @param aHotKey A key event used for application specific control if not zero.
- * @return true if the hotkey code is handled (captured).
- */
- virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 )
- {
- return false;
- }
-
/**
* Recalculate the size of toolbars and display panel when the frame size changes.
*/
@@ -723,8 +703,6 @@ public:
wxString GetToolMsg() { return m_toolMsg; }
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) {}
- virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) {}
- virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) { return true; }
virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars( const wxPoint& aCenterPosition );
diff --git a/include/legacy_wx/class_drawpanel.h b/include/legacy_wx/class_drawpanel.h
index b0cf925132..a077ee89f7 100644
--- a/include/legacy_wx/class_drawpanel.h
+++ b/include/legacy_wx/class_drawpanel.h
@@ -215,17 +215,6 @@ public:
*/
void OnActivate( wxActivateEvent& event );
- /**
- * Function OnTimer
- * handle timer events
- *
- * The class will start a timer when a mouse-up event is handled. If a
- * double-click event is not handled inside of a specified interval,
- * the timer event will fire, causing the single-click event to be handled.
- * Otherwise, the system will process the double-click.
- */
- void OnTimer( wxTimerEvent& event );
-
/**
* Function DoPrepareDC
* sets up the device context \a aDC for drawing.
@@ -269,10 +258,8 @@ public:
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
void OnMagnify( wxMouseEvent& event );
#endif
- void OnMouseEvent( wxMouseEvent& event );
void OnMouseEntering( wxMouseEvent& aEvent );
void OnMouseLeaving( wxMouseEvent& event );
- void OnKeyEvent( wxKeyEvent& event );
void OnCharHook( wxKeyEvent& event );
void OnPan( wxCommandEvent& event );
@@ -287,13 +274,6 @@ public:
void SetGrid( const wxRealPoint& size );
wxRealPoint GetGrid();
- /**
- * Function OnRightClick
- * builds and displays a context menu on a right mouse button click.
- * @return true if the context menu is shown, or false
- */
- bool OnRightClick( wxMouseEvent& event );
-
/**
* Function IsPointOnDisplay
* @param aPosition The position to test in logical (drawing) units.
@@ -470,33 +450,4 @@ public:
};
-/**
- * Class EDA_CROSS_HAIR_MANAGER
- * is used to hide the cross hair and restore it when the class goes out of scope.
- */
-class EDA_CROSS_HAIR_MANAGER
-{
-public:
- EDA_CROSS_HAIR_MANAGER( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) :
- m_panel( aPanel ),
- m_dc( aDC )
- {
- if( aPanel && aDC )
- aPanel->CrossHairOff( aDC );
- }
-
- ~EDA_CROSS_HAIR_MANAGER()
- {
- if( m_panel && m_dc )
- m_panel->CrossHairOn( m_dc );
- }
-
-private:
- EDA_DRAW_PANEL* m_panel;
- wxDC* m_dc;
-
- DECLARE_NO_COPY_CLASS( EDA_CROSS_HAIR_MANAGER )
-};
-
-
#endif /* #ifndef PANEL_WXSTRUCT_H */
diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h
index 44b06dc4f4..ba7e22e047 100644
--- a/include/pcb_base_frame.h
+++ b/include/pcb_base_frame.h
@@ -240,23 +240,6 @@ public:
*/
virtual bool CreateAndShow3D_Frame( bool aForceRecreateIfNotOwner );
- /**
- * Function PcbGeneralLocateAndDisplay
- * searches for an item under the mouse cursor.
- * Items are searched first on the current working layer.
- * If nothing found, an item will be searched without layer restriction.
- * If more than one item is found meeting the current working layer
- * criterion, then a popup menu is shown which allows the user to pick
- * which item he/she is interested in. Once an item is chosen, then it
- * is make the "current item" and the status window is updated to reflect
- * this.
- *
- * @param aHotKeyCode The hotkey which relates to the caller and determines
- * the type of search to be performed. If zero, then
- * the mouse tools will be tested instead.
- */
- BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 );
-
void ProcessItemSelection( wxCommandEvent& event );
/**
@@ -341,21 +324,6 @@ public:
*/
void PlaceModule( MODULE* aModule, wxDC* aDC, bool aRecreateRatsnest = true );
- // module texts
- void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC );
- void DeleteTextModule( TEXTE_MODULE* Text );
- void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC );
- void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC );
-
- /**
- * Function ResetTextSize
- * resets given field text size and width to current settings in
- * Preferences->Dimensions->Texts and Drawings.
- * @param aItem is the item to be reset, either TEXTE_PCB or TEXTE_MODULE.
- * @param aDC is the drawing context.
- */
- void ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC );
-
void InstallPadOptionsFrame( D_PAD* pad );
void AddPad( MODULE* Module, bool draw );
diff --git a/pagelayout_editor/hotkeys.cpp b/pagelayout_editor/hotkeys.cpp
index 9868af5126..f4869eee0a 100644
--- a/pagelayout_editor/hotkeys.cpp
+++ b/pagelayout_editor/hotkeys.cpp
@@ -139,85 +139,3 @@ EDA_HOTKEY* PL_EDITOR_FRAME::GetHotKeyDescription( int aCommand ) const
}
-bool PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
- EDA_ITEM* aItem )
-{
- wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
- cmd.SetEventObject( this );
-
- /* Convert lower to upper case (the usual toupper function has problem with non ascii
- * codes like function keys */
- if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') )
- aHotkeyCode += 'A' - 'a';
-
- EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_PlEditor_Hotkey_List );
-
- if( HK_Descr == NULL )
- HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_Common_Hotkey_List );
-
- if( HK_Descr == NULL )
- return false;
-
- switch( HK_Descr->m_Idcommand )
- {
- case HK_NOT_FOUND:
- return false;
-
- case HK_LEFT_CLICK:
- OnLeftClick( aDC, aPosition );
- break;
-
- case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
- OnLeftClick( aDC, aPosition );
- OnLeftDClick( aDC, aPosition );
- break;
-
- case HK_NEW:
- cmd.SetId( wxID_NEW );
- GetEventHandler()->ProcessEvent( cmd );
- break;
-
- case HK_OPEN:
- cmd.SetId( wxID_OPEN );
- GetEventHandler()->ProcessEvent( cmd );
- break;
-
- case HK_SAVE:
- cmd.SetId( wxID_SAVE );
- GetEventHandler()->ProcessEvent( cmd );
- break;
-
- case HK_SAVEAS:
- cmd.SetId( wxID_SAVEAS );
- GetEventHandler()->ProcessEvent( cmd );
- break;
-
- case HK_PRINT:
- cmd.SetId( wxID_PRINT );
- GetEventHandler()->ProcessEvent( cmd );
- break;
-
- case HK_RESET_LOCAL_COORD: // Reset the relative coord
- GetScreen()->m_O_Curseur = GetCrossHairPosition();
- break;
-
- case HK_HELP: // Display Current hotkey list
- DisplayHotkeyList( this, PlEditorHotkeysDescr );
- break;
-
- case HK_PREFERENCES:
- cmd.SetId( wxID_PREFERENCES );
- GetEventHandler()->ProcessEvent( cmd );
- break;
-
- case HK_SET_GRID_ORIGIN:
- SetGridOrigin( GetCrossHairPosition() );
- break;
-
- default:
- wxMessageBox( wxT( "Unknown hotkey" ) );
- return false;
- }
-
- return true;
-}
diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h
index 3053922e87..dc97f7515b 100644
--- a/pagelayout_editor/pl_editor_frame.h
+++ b/pagelayout_editor/pl_editor_frame.h
@@ -217,18 +217,6 @@ public:
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
- /**
- * Function OnHotKey.
- * ** Commands are case insensitive **
- * Some commands are relatives to the item under the mouse cursor
- * @param aDC = current device context
- * @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
- * @param aPosition The cursor position in logical (drawing) units.
- * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
- */
- bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
- EDA_ITEM* aItem = NULL ) override;
-
/**
* Function ToPrinter
* Open a dialog frame to print layers
diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 5300e3ce86..f6ede020b5 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -232,31 +232,24 @@ set( PCBNEW_CLASS_SRCS
action_plugin.cpp
array_creator.cpp
array_pad_name_provider.cpp
- attribut.cpp
board_netlist_updater.cpp
build_BOM_from_board.cpp
connect.cpp
- controle.cpp
cross-probing.cpp
deltrack.cpp
dimension.cpp
dragsegm.cpp
drc.cpp
drc_clearance_test_functions.cpp
- edgemod.cpp
edit.cpp
- edit_pcb_text.cpp
edit_track_width.cpp
- editedge.cpp
editrack-part2.cpp
editrack.cpp
- edtxtmod.cpp
event_handlers_tracks_vias_sizes.cpp
files.cpp
footprint_info_impl.cpp
footprint_wizard.cpp
footprint_editor_utils.cpp
- footprint_editor_onclick.cpp
footprint_editor_options.cpp
fp_tree_synchronizing_adapter.cpp
footprint_edit_frame.cpp
@@ -266,10 +259,7 @@ set( PCBNEW_CLASS_SRCS
generate_footprint_info.cpp
grid_layer_box_helpers.cpp
grid_layer_box_helpers.h
- highlight.cpp
hotkeys.cpp
- hotkeys_board_editor.cpp
- hotkeys_footprint_editor.cpp
initpcb.cpp
layer_widget.cpp
load_select_footprint.cpp
@@ -278,10 +268,7 @@ set( PCBNEW_CLASS_SRCS
menubar_pcb_editor.cpp
microwave.cpp
minimun_spanning_tree.cpp
- move-drag_pads.cpp
- move_or_drag_track.cpp
netlist.cpp
- onleftclick.cpp
pad_edit_functions.cpp
pad_naming.cpp
pcb_base_edit_frame.cpp
diff --git a/pcbnew/attribut.cpp b/pcbnew/attribut.cpp
deleted file mode 100644
index 662cdae714..0000000000
--- a/pcbnew/attribut.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
- * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck
- * Copyright (C) 2011 Wayne Stambaugh
- * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-/**
- * @file attribut.cpp
- * @brief Track attribute flags editing.
- */
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#include
-#include
-
-
-/* Attribute change for 1 track segment.
- * Attributes are
- * TRACK_LOCKED protection against global delete
- * TRACK_AR AutoRouted segment
- */
-void PCB_EDIT_FRAME::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
-{
- if( track == NULL )
- return;
-
- OnModify();
- m_canvas->CrossHairOff( DC ); // Erase cursor shape
- track->SetState( TRACK_LOCKED, Flag_On );
- track->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
- m_canvas->CrossHairOn( DC ); // Display cursor shape
-
- MSG_PANEL_ITEMS items;
- track->GetMsgPanelInfo( m_UserUnits, items );
- SetMsgPanel( items );
-}
-
-
-/* Attribute change for an entire track */
-void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
-{
- TRACK* Track;
- int nb_segm;
-
- if( track == NULL )
- return;
-
- m_canvas->CrossHairOff( DC ); // Erase cursor shape
- Track = GetBoard()->MarkTrace( GetBoard()->m_Track, track, &nb_segm, NULL, NULL, true );
- DrawTraces( m_canvas, DC, Track, nb_segm, GR_OR | GR_HIGHLIGHT );
-
- for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- )
- {
- Track->SetState( TRACK_LOCKED, Flag_On );
- Track->SetState( BUSY, false );
- Track = Track->Next();
- }
-
- m_canvas->CrossHairOn( DC ); // Display cursor shape
-
- OnModify();
-}
-
-
-/* Modify the flag TRACK_LOCKED according to Flag_On value,
- * for all the segments related to net_code.
- * if net_code < 0 all the segments are modified.
- */
-void PCB_EDIT_FRAME::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
-{
- TRACK* Track = GetBoard()->m_Track;
-
- /* search the first segment for the selected net_code */
- if( net_code >= 0 )
- {
- for( ; Track != NULL; Track = Track->Next() )
- {
- if( net_code == Track->GetNetCode() )
- break;
- }
- }
-
- m_canvas->CrossHairOff( DC ); // Erase cursor shape
-
- while( Track ) /* Flag change */
- {
- if( ( net_code >= 0 ) && ( net_code != Track->GetNetCode() ) )
- break;
-
- OnModify();
- Track->SetState( TRACK_LOCKED, Flag_On );
- Track->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT );
- Track = Track->Next();
- }
-
- m_canvas->CrossHairOn( DC ); // Display cursor shape
- OnModify();
-}
diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp
deleted file mode 100644
index c8e21c7346..0000000000
--- a/pcbnew/controle.cpp
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
- * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck
- * Copyright (C) 2012 Wayne Stambaugh
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-/**
- * @file pcbnew/controle.cpp
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-//external functions used here:
-extern bool Magnetize( PCB_BASE_EDIT_FRAME* frame, int aCurrentTool,
- wxSize aGridSize, wxPoint on_grid, wxPoint* curpos );
-
-
-/**
- * Function AllAreModulesAndReturnSmallestIfSo
- * tests that all items in the collection are MODULEs and if so, returns the
- * smallest MODULE.
- * @return BOARD_ITEM* - The smallest or NULL.
- */
-static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aCollector )
-{
-#if 0 // Dick: this is not consistent with name of this function, and does not
- // work correctly using 'M' (move hotkey) when another module's (2nd module) reference
- // is under a module (first module) and you want to move the reference.
- // Another way to fix this would be to
- // treat module text as copper layer content, and put the module text into
- // the primary list. I like the coded behavior best. If it breaks something
- // perhaps you need a different test before calling this function, which should
- // do what its name says it does.
- int count = aCollector->GetPrimaryCount(); // try to use preferred layer
- if( 0 == count ) count = aCollector->GetCount();
-#else
- int count = aCollector->GetCount();
-#endif
-
- for( int i = 0; iType() != PCB_MODULE_T )
- return NULL;
- }
-
- // all are modules, now find smallest MODULE
-
- int minDim = 0x7FFFFFFF;
- int minNdx = 0;
-
- for( int i = 0; iGetBoundingBox().GetWidth();
- int ly = module->GetBoundingBox().GetHeight();
-
- int lmin = std::min( lx, ly );
-
- if( lmin < minDim )
- {
- minDim = lmin;
- minNdx = i;
- }
- }
-
- return (*aCollector)[minNdx];
-}
-
-
-// JEY TODO: RETIRE THIS
-BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
-{
- BOARD_ITEM* item;
-
- GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
- auto displ_opts = (PCB_DISPLAY_OPTIONS*)( GetDisplayOptions() );
-
- // Assign to scanList the proper item types desired based on tool type
- // or hotkey that is in play.
-
- const KICAD_T* scanList = NULL;
-
- if( aHotKeyCode )
- {
- // @todo: add switch here and add calls to PcbGeneralLocateAndDisplay( int aHotKeyCode )
- // when searching is needed from a hotkey handler
- }
- else if( GetToolId() == ID_NO_TOOL_SELECTED )
- {
- scanList = (displ_opts->m_DisplayZonesMode == 0) ?
- GENERAL_COLLECTOR::AllBoardItems :
- GENERAL_COLLECTOR::AllButZones;
- }
- else
- {
- switch( GetToolId() )
- {
- case ID_LOCAL_RATSNEST_BUTT:
- scanList = GENERAL_COLLECTOR::PadsOrModules;
- break;
-
- case ID_TRACK_BUTT:
- scanList = GENERAL_COLLECTOR::Tracks;
- break;
-
- case ID_PCB_MODULE_BUTT:
- scanList = GENERAL_COLLECTOR::Modules;
- break;
-
- case ID_PCB_ZONES_BUTT:
- case ID_PCB_KEEPOUT_BUTT:
- scanList = GENERAL_COLLECTOR::Zones;
- break;
-
- default:
- scanList = displ_opts->m_DisplayZonesMode == 0 ?
- GENERAL_COLLECTOR::AllBoardItems :
- GENERAL_COLLECTOR::AllButZones;
- }
- }
-
- m_Collector->Collect( m_Pcb, scanList, RefPos( true ), guide );
-
-#if 0
- // debugging: print out the collected items, showing their priority order too.
- for( int i = 0; iGetCount(); ++i )
- (*m_Collector)[i]->Show( 0, std::cout );
-#endif
-
- // Trigger the selection of the current edge for zones
- for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
- {
- item = (*m_Collector)[ii];
-
- if( item->Type() == PCB_ZONE_AREA_T )
- {
- // We need to do the selection now because the menu text depends on it
- ZONE_CONTAINER *zone = static_cast( item );
- int accuracy = KiROUND( 5 * guide.OnePixelInIU() );
- zone->SetSelectedCorner( RefPos( true ), accuracy );
- }
- }
-
- if( m_Collector->GetCount() <= 1 )
- {
- item = (*m_Collector)[0];
- SetCurItem( item );
- }
-
- // If the count is 2, and first item is a pad or module text, and the 2nd item is its
- // parent module:
- else if( m_Collector->GetCount() == 2
- && ( (*m_Collector)[0]->Type() == PCB_PAD_T || (*m_Collector)[0]->Type() ==
- PCB_MODULE_TEXT_T )
- && (*m_Collector)[1]->Type() == PCB_MODULE_T && (*m_Collector)[0]->GetParent()==
- (*m_Collector)[1] )
- {
- item = (*m_Collector)[0];
- SetCurItem( item );
- }
- // if all are modules, find the smallest one among the primary choices
- else if( ( item = AllAreModulesAndReturnSmallestIfSo( m_Collector ) ) != NULL )
- {
- SetCurItem( item );
- }
-
- else // we can't figure out which item user wants, do popup menu so user can choose
- {
- wxMenu itemMenu;
-
- // Give a title to the selection menu. This is also a cancel menu item
- AddMenuItem( &itemMenu, wxID_NONE, _( "Clarify Selection" ),
- KiBitmap( info_xpm ) );
- itemMenu.AppendSeparator();
-
- int limit = std::min( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
-
- for( int i = 0; iGetSelectMenuText( m_UserUnits );
-
- BITMAP_DEF xpm = item->GetMenuImage();
-
- AddMenuItem( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, KiBitmap( xpm ) );
- }
-
- /* @todo: rather than assignment to true, these should be increment and decrement
- * operators throughout _everywhere_.
- * That way we can handle nesting.
- * But I tried that and found there cases where the assignment to true (converted to
- * a m_IgnoreMouseEvents++ )
- * was not balanced with the -- (now m_IgnoreMouseEvents=false), so I had to revert.
- * Somebody should track down these and make them balanced.
- * m_canvas->SetIgnoreMouseEvents( true );
- */
-
- // this menu's handler is void PCB_BASE_FRAME::ProcessItemSelection()
- // and it calls SetCurItem() which in turn calls DisplayInfo() on the item.
- m_canvas->SetAbortRequest( true ); // changed in false if an item is selected
- PopupMenu( &itemMenu );
-
- m_canvas->MoveCursorToCrossHair();
-
- // The function ProcessItemSelection() has set the current item, return it.
- if( m_canvas->GetAbortRequest() ) // Nothing selected
- item = NULL;
- else
- item = GetCurItem();
- }
-
- return item;
-}
-
-
-bool PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
-{
- // Filter out the 'fake' mouse motion after a keyboard movement
- if( !aHotKey && m_movingCursorWithKeyboard )
- {
- m_movingCursorWithKeyboard = false;
- return false;
- }
-
- // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
- // for next cursor position
- // ( shift or ctrl key down are PAN command with mouse wheel)
- bool snapToGrid = true;
-
- if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
- snapToGrid = false;
-
- wxPoint oldpos = GetCrossHairPosition();
- wxPoint pos = aPosition;
- bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
-
- // Put cursor in new position, according to the zoom keys (if any).
- SetCrossHairPosition( pos, snapToGrid );
-
- /* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the
- * cursor is left off grid this is better to reach items to delete off grid,
- */
- if( GetToolId() == ID_PCB_DELETE_ITEM_BUTT )
- snapToGrid = false;
-
- wxPoint curs_pos = pos;
-
- wxRealPoint gridSize = GetScreen()->GetGridSize();
- wxSize igridsize;
- igridsize.x = KiROUND( gridSize.x );
- igridsize.y = KiROUND( gridSize.y );
-
- if( Magnetize( this, GetToolId(), igridsize, curs_pos, &pos ) )
- {
- SetCrossHairPosition( pos, false );
- }
- else
- {
- // If there's no intrusion and DRC is active, we pass the cursor
- // "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
- if( !Settings().m_legacyDrcOn || !g_CurrentTrackSegment ||
- (BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() ||
- !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
- GetScreen()->m_Active_Layer, RefPos( true ) ) )
- {
- SetCrossHairPosition( curs_pos, snapToGrid );
- }
- }
-
- RefreshCrossHair( oldpos, aPosition, aDC );
-
- if( aHotKey && OnHotKey( aDC, aHotKey, aPosition ) )
- {
- keyHandled = true;
- }
-
- UpdateStatusBar(); // Display new cursor coordinates
-
- return keyHandled;
-}
diff --git a/pcbnew/drag.h b/pcbnew/drag.h
index e3f4e4464c..b9fced958b 100644
--- a/pcbnew/drag.h
+++ b/pcbnew/drag.h
@@ -172,34 +172,4 @@ void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC );
*/
void EraseDragList();
-/**
- * Function Collect_TrackSegmentsToDrag.
- * used to collect track segments in drag track segment
- * Build the list of tracks connected to the ref point by calling
- * AddSegmentToDragList for each selected track
- * Net codes must be up to date, because only tracks having the right net code are tested.
- *
- * @param aPcb A point the the #BOARD object to collect track segment to drag.
- * @param aRefPos = reference point of connection
- * @param aLayerMask = layers mask to collect tracks
- * @param aNetCode = the net code to consider
- * @param aMaxDist = max distance from aRefPos to a track end candidate to collect the track
- */
-void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LSET aLayerMask,
- int aNetCode, int aMaxDist );
-
-/* Add aTrack to the drag list
- * flag = STARTPOINT (if the point to drag is the start point of Track)
- * or ENDPOINT (if the point to drag is the end point of Track)
- */
-void AddSegmentToDragList( int flag, TRACK* aTrack );
-
-/*
- * Undraw the track segments in list, and set the EDIT flag
- * Usually called after the track list is built, to prepare
- * the redraw of the list when the mouse is moved
- */
-void UndrawAndMarkSegmentsToDrag( EDA_DRAW_PANEL* aCanvas, wxDC* aDC );
-
-
#endif // _DRAG_H_
diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp
index 5a5b25d3ba..2c4d53b752 100644
--- a/pcbnew/dragsegm.cpp
+++ b/pcbnew/dragsegm.cpp
@@ -299,108 +299,3 @@ void EraseDragList()
}
-void AddSegmentToDragList( int flag, TRACK* aTrack )
-{
- DRAG_SEGM_PICKER wrapper( aTrack );
-
- if( flag & STARTPOINT )
- {
- wrapper.m_TempFlags |= STARTPOINT;
- aTrack->SetFlags( STARTPOINT );
- }
-
- if( flag & ENDPOINT )
- {
- wrapper.m_TempFlags |= ENDPOINT;
- aTrack->SetFlags( ENDPOINT );
- }
-
- g_DragSegmentList.push_back( wrapper );
-}
-
-
-void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LSET aLayerMask,
- int aNetCode, int aMaxDist )
-{
- TRACK* track = aPcb->m_Track->GetStartNetCode( aNetCode );
-
- for( ; track; track = track->Next() )
- {
- if( track->GetNetCode() != aNetCode ) // not the same netcode: all candidates tested
- break;
-
- if( !( aLayerMask & track->GetLayerSet() ).any() )
- continue; // Cannot be connected, not on the same layer
-
- if( track->IsDragging() )
- continue; // already put in list
-
- STATUS_FLAGS flag = 0;
- int maxdist = std::max( aMaxDist, track->GetWidth() / 2 );
-
- if( (track->GetFlags() & STARTPOINT) == 0 )
- {
- wxPoint delta = track->GetStart() - aRefPos;
-
- if( std::abs( delta.x ) <= maxdist && std::abs( delta.y ) <= maxdist )
- {
- int dist = KiROUND( EuclideanNorm( delta ) );
-
- if( dist <= maxdist )
- {
- flag |= STARTPOINT;
-
- if( track->Type() == PCB_VIA_T )
- flag |= ENDPOINT;
- }
- }
- }
-
- if( (track->GetFlags() & ENDPOINT) == 0 )
- {
- wxPoint delta = track->GetEnd() - aRefPos;
-
- if( std::abs( delta.x ) <= maxdist && std::abs( delta.y ) <= maxdist )
- {
- int dist = KiROUND( EuclideanNorm( delta ) );
-
- if( dist <= maxdist )
- flag |= ENDPOINT;
- }
- }
-
- // Note: vias will be flagged with both STARTPOINT and ENDPOINT
- // and must not be entered twice.
- if( flag )
- {
- AddSegmentToDragList( flag, track );
-
- // If a connected via is found at location aRefPos,
- // collect also tracks connected by this via.
- if( track->Type() == PCB_VIA_T )
- Collect_TrackSegmentsToDrag( aPcb, aRefPos, track->GetLayerSet(),
- aNetCode, track->GetWidth() / 2 );
- }
- }
-}
-
-
-void UndrawAndMarkSegmentsToDrag( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
-{
- for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
- {
- TRACK* track = g_DragSegmentList[ii].m_Track;
-
- track->Draw( aCanvas, aDC, GR_XOR );
- track->SetState( IN_EDIT, false );
- track->SetFlags( IS_DRAGGED );
-
- if( g_DragSegmentList[ii].m_TempFlags & STARTPOINT )
- track->SetFlags( STARTPOINT );
-
- if( g_DragSegmentList[ii].m_TempFlags & ENDPOINT )
- track->SetFlags( ENDPOINT );
-
- track->Draw( aCanvas, aDC, GR_XOR );
- }
-}
diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp
deleted file mode 100644
index d244aa3bfb..0000000000
--- a/pcbnew/edgemod.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck
- * Copyright (C) 2013 Wayne Stambaugh
- * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you may find one here:
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- * or you may search the http://www.gnu.org website for the version 2 license,
- * or you may write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-/**
- * @file edgemod.cpp:
- * @brief Functions to edit graphic items used to draw footprint edges.
- *
- * @todo - Arc functions not compete but menus are ready to use.
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include
-
-
-static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
- bool erase );
-static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC );
-static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
- const wxPoint& aPosition, bool aErase );
-
-static double ArcValue = 900;
-static wxPoint MoveVector; // Move vector for move edge
-static wxPoint CursorInitialPosition; // Mouse cursor initial position for move command
-
-
-void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* aEdge, wxDC* DC )
-{
- if( aEdge == NULL )
- return;
-
- aEdge->Draw( m_canvas, DC, GR_XOR );
- aEdge->SetFlags( IS_MOVED );
- MoveVector.x = MoveVector.y = 0;
- CursorInitialPosition = GetCrossHairPosition();
- m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
- SetCurItem( aEdge );
- m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
-}
-
-
-void FOOTPRINT_EDIT_FRAME::Place_EdgeMod( EDGE_MODULE* aEdge )
-{
- if( aEdge == NULL )
- return;
-
- aEdge->Move( -MoveVector );
-
- aEdge->ClearFlags();
- m_canvas->SetMouseCapture( NULL, NULL );
- SetCurItem( NULL );
- OnModify();
-
- MODULE* module = (MODULE*) aEdge->GetParent();
- module->CalculateBoundingBox();
-
- m_canvas->Refresh( );
-}
-
-
-/* Redraw the current moved graphic item when mouse is moving
- * Use this function to show an existing outline, in move command
-*/
-static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
- const wxPoint& aPosition, bool aErase )
-{
- BASE_SCREEN* screen = aPanel->GetScreen();
- EDGE_MODULE* edge = (EDGE_MODULE*) screen->GetCurItem();
-
- if( edge == NULL )
- return;
-
- MODULE* module = (MODULE*) edge->GetParent();
-
- if( aErase )
- {
- edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
- }
-
- MoveVector = -(aPanel->GetParent()->GetCrossHairPosition() - CursorInitialPosition);
-
- edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
-
- module->CalculateBoundingBox();
-}
-
-
-/* Redraw the current graphic item during its creation
- * Use this function to show a new outline, in begin command
- */
-static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
- bool aErase )
-{
- BASE_SCREEN* screen = aPanel->GetScreen();
- EDGE_MODULE* edge = (EDGE_MODULE*) screen->GetCurItem();
-
- if( edge == NULL )
- return;
-
- MODULE* module = (MODULE*) edge->GetParent();
-
- // if( erase )
- {
- edge->Draw( aPanel, aDC, GR_XOR );
- }
-
- edge->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
-
- // Update relative coordinate.
- edge->SetEnd0( edge->GetEnd() - module->GetPosition() );
-
- wxPoint pt( edge->GetEnd0() );
-
- RotatePoint( &pt, -module->GetOrientation() );
-
- edge->SetEnd0( pt );
-
- edge->Draw( aPanel, aDC, GR_XOR );
-
- module->CalculateBoundingBox();
-}
-
-
-void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
-{
- MODULE* module = GetBoard()->m_Modules;
-
- SaveCopyInUndoList( module, UR_CHANGED );
-
- if( aEdge == NULL )
- {
- for( BOARD_ITEM *item = module->GraphicalItemsList(); item; item = item->Next() )
- {
- aEdge = dyn_cast( item );
-
- if( aEdge )
- aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
- }
- }
- else
- {
- aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
- }
-
- OnModify();
- module->CalculateBoundingBox();
- module->SetLastEditTime();
-}
-
-
-void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
-{
- // note: if aEdge == NULL, all outline segments will be modified
-
- MODULE* module = GetBoard()->m_Modules;
- PCB_LAYER_ID layer = F_SilkS;
- bool modified = false;
-
- if( aEdge )
- layer = aEdge->GetLayer();
-
- // Ask for the new layer
- PCB_LAYER_ID new_layer = SelectLayer( layer, Edge_Cuts );
-
- if( layer < 0 )
- return;
-
- if( IsCopperLayer( new_layer ) )
- {
- // an edge is put on a copper layer, and it is very dangerous.
- // A confirmation is requested
- if( !IsOK( this,
- _( "The graphic item will be on a copper layer.\n"
- "This is very dangerous. Are you sure?" ) ) )
- return;
- }
-
- if( !aEdge )
- {
- for( BOARD_ITEM *item = module->GraphicalItemsList() ; item != NULL;
- item = item->Next() )
- {
- aEdge = dyn_cast( item );
-
- if( aEdge && (aEdge->GetLayer() != new_layer) )
- {
- if( ! modified ) // save only once
- SaveCopyInUndoList( module, UR_CHANGED );
- aEdge->SetLayer( new_layer );
- modified = true;
- }
- }
- }
- else if( aEdge->GetLayer() != new_layer )
- {
- SaveCopyInUndoList( module, UR_CHANGED );
- aEdge->SetLayer( new_layer );
- modified = true;
- }
-
- if( modified )
- {
- module->CalculateBoundingBox();
- module->SetLastEditTime();
- }
-}
-
-
-void FOOTPRINT_EDIT_FRAME::Delete_Edge_Module( EDGE_MODULE* aEdge )
-{
- if( aEdge == NULL )
- return;
-
- if( aEdge->Type() != PCB_MODULE_EDGE_T )
- {
- wxLogDebug( wxT( "StructType error: PCB_MODULE_EDGE_T expected" ) );
- return;
- }
-
- MODULE* module = (MODULE*) aEdge->GetParent();
-
- // Delete segment.
- aEdge->DeleteStructure();
- module->SetLastEditTime();
- module->CalculateBoundingBox();
- OnModify();
-}
-
-
-/* abort function in moving outline.
- */
-static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
-{
- EDGE_MODULE* edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem();
-
- Panel->SetMouseCapture( NULL, NULL );
-
- if( edge && ( edge->Type() == PCB_MODULE_EDGE_T ) )
- {
- if( edge->IsNew() ) // On aborting, delete new outline.
- {
- MODULE* module = (MODULE*) edge->GetParent();
- edge->Draw( Panel, DC, GR_XOR, MoveVector );
- edge->DeleteStructure();
- module->CalculateBoundingBox();
- }
- else // On aborting, move existing outline to its initial position.
- {
- edge->Draw( Panel, DC, GR_XOR, MoveVector );
- edge->ClearFlags();
- edge->Draw( Panel, DC, GR_OR );
- }
- }
-
- Panel->GetScreen()->SetCurItem( NULL );
-}
-
-
-EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
- wxDC* DC,
- STROKE_T type_edge )
-{
- MODULE* module = GetBoard()->m_Modules;
-
- if( module == NULL )
- return NULL;
-
- if( aEdge == NULL ) // Start a new edge item
- {
- SaveCopyInUndoList( module, UR_CHANGED );
-
- aEdge = new EDGE_MODULE( module );
- MoveVector.x = MoveVector.y = 0;
-
- // Add the new item to the Drawings list head
- module->GraphicalItemsList().PushFront( aEdge );
-
- // Update characteristics of the segment or arc.
- aEdge->SetFlags( IS_NEW );
- aEdge->SetAngle( 0 );
- aEdge->SetShape( type_edge );
-
- if( aEdge->GetShape() == S_ARC )
- aEdge->SetAngle( ArcValue );
-
- aEdge->SetWidth( GetDesignSettings().GetLineThickness( GetActiveLayer() ) );
- aEdge->SetLayer( GetActiveLayer() );
-
- // Initialize the starting point of the new segment or arc
- aEdge->SetStart( GetCrossHairPosition() );
-
- // Initialize the ending point of the new segment or arc
- aEdge->SetEnd( aEdge->GetStart() );
-
- // Initialize the relative coordinates
- aEdge->SetStart0( aEdge->GetStart() - module->GetPosition() );
-
- RotatePoint( &aEdge->m_Start0, -module->GetOrientation() );
-
- aEdge->m_End0 = aEdge->m_Start0;
- module->CalculateBoundingBox();
- m_canvas->SetMouseCapture( ShowNewEdgeModule, Abort_Move_ModuleOutline );
- }
- /* Segment creation in progress.
- * The ending coordinate is updated by the function
- * ShowNewEdgeModule() called on move mouse event
- * during the segment creation
- */
- else
- {
- if( type_edge == S_SEGMENT )
- {
- if( aEdge->m_Start0 != aEdge->m_End0 )
- {
- aEdge->Draw( m_canvas, DC, GR_OR );
-
- EDGE_MODULE* newedge = new EDGE_MODULE( *aEdge );
-
- // insert _after_ aEdge, which is the same as inserting before aEdge->Next()
- module->GraphicalItemsList().Insert( newedge, aEdge->Next() );
- aEdge->ClearFlags();
-
- aEdge = newedge; // point now new item
-
- aEdge->SetFlags( IS_NEW );
- aEdge->SetWidth( GetDesignSettings().GetLineThickness( aEdge->GetLayer() ) );
- aEdge->SetStart( GetCrossHairPosition() );
- aEdge->SetEnd( aEdge->GetStart() );
-
- // Update relative coordinate.
- aEdge->SetStart0( aEdge->GetStart() - module->GetPosition() );
-
- wxPoint pt( aEdge->GetStart0() );
-
- RotatePoint( &pt, -module->GetOrientation() );
-
- aEdge->SetStart0( pt );
-
- aEdge->SetEnd0( aEdge->GetStart0() );
-
- module->CalculateBoundingBox();
- module->SetLastEditTime();
- OnModify();
- }
- }
- else
- {
- wxLogDebug( wxT( "Begin_Edge() error" ) );
- }
- }
-
- return aEdge;
-}
-
-
-void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* aEdge )
-{
- MODULE* module = GetBoard()->m_Modules;
-
- if( aEdge )
- {
- aEdge->ClearFlags();
-
- // If last segment length is 0: remove it
- if( aEdge->GetStart() == aEdge->GetEnd() )
- aEdge->DeleteStructure();
- }
-
- module->CalculateBoundingBox();
- module->SetLastEditTime();
- OnModify();
- m_canvas->SetMouseCapture( NULL, NULL );
-}
diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp
index fdf79ff3e1..cd8e87f96a 100644
--- a/pcbnew/edit.cpp
+++ b/pcbnew/edit.cpp
@@ -48,6 +48,8 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
@@ -79,16 +81,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case wxID_COPY:
case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
- case ID_POPUP_PCB_PLACE_THROUGH_VIA:
- case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA:
- case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
- case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
- case ID_POPUP_PCB_PLACE_MICROVIA:
- case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
- case ID_POPUP_PCB_FILL_ALL_ZONES:
- case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES:
- case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
- case ID_POPUP_PCB_FILL_ZONE:
break;
default: // Finish (abort) the command
@@ -179,137 +171,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
InstallNetlistFrame( &dc );
break;
- case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
- /* change the position of initial segment when creating new tracks
- * switch from _/ to -\ .
- * If a track is in progress, it will be redrawn
- */
- if( m_canvas->IsMouseCaptured() )
- m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
-
- g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
-
- if( m_canvas->IsMouseCaptured() )
- m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
-
- break;
-
- case ID_POPUP_PCB_PLACE_MICROVIA:
- if( !IsMicroViaAcceptable() )
- break;
- // fall through
- case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
- case ID_POPUP_PCB_PLACE_THROUGH_VIA:
- case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA:
- case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
- m_canvas->MoveCursorToCrossHair();
-
- if( GetCurItem()->IsDragging() )
- {
- // JEY TODO: reachable?
- PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
- }
- else
- {
- 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;
- }
-
- // place via and switch layer.
- 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 );
-
- wxPoint dlgPosition;
-
- wxGetMousePosition( &dlgPosition.x, &dlgPosition.y );
-
- PCB_LAYER_ID layer = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask(), dlgPosition );
-
- m_canvas->SetIgnoreMouseEvents( false );
- m_canvas->MoveCursorToCrossHair();
-
- if( GetActiveLayer() != layer )
- {
- GetScreen()->m_Route_Layer_TOP = GetActiveLayer();
- GetScreen()->m_Route_Layer_BOTTOM = layer;
- Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
- }
- }
-
- else
- Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
-
- settings.m_CurrentViaType = v_type;
-
- if( displ_opts->m_ContrastModeDisplay )
- m_canvas->Refresh();
- }
- break;
-
- case ID_POPUP_PCB_FILL_ALL_ZONES:
- m_canvas->MoveCursorToCrossHair();
- Fill_All_Zones();
- m_canvas->Refresh();
- SetMsgPanel( GetBoard() );
- break;
-
- case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
- if( ( GetCurItem() )->Type() == PCB_ZONE_AREA_T )
- {
- ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
- zone_container->UnFill();
- GetBoard()->GetConnectivity()->Update( zone_container );
- OnModify();
- SetMsgPanel( GetBoard() );
- m_canvas->Refresh();
- }
-
- Compile_Ratsnest( &dc, false );
- SetCurItem( NULL );
- break;
-
- case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
- for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
- {
- // Remove filled areas in zone
- ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii );
- zone_container->UnFill();
- GetBoard()->GetConnectivity()->Update( zone_container );
- }
-
- Compile_Ratsnest( &dc, false );
- SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer
- OnModify();
- SetMsgPanel( GetBoard() );
- m_canvas->Refresh();
- break;
-
- case ID_POPUP_PCB_FILL_ZONE:
- {
- m_canvas->MoveCursorToCrossHair();
- ZONE_FILLER filler( GetBoard() );
- filler.Fill( { (ZONE_CONTAINER*) GetCurItem() } );
- SetMsgPanel( GetBoard() );
- m_canvas->Refresh();
- break;
- }
-
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
SelectCopperLayerPair();
break;
@@ -321,14 +182,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->Refresh( true );
break;
- case ID_POPUP_PCB_MOVE_EXACT:
- moveExact();
- break;
-
- case ID_POPUP_PCB_CREATE_ARRAY:
- createArray();
- break;
-
case ID_MENU_PCB_CLEAN:
Clean_Pcb();
break;
@@ -369,75 +222,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
-void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
-{
- if( Item == NULL )
- return;
-
- switch( Item->Type() )
- {
- case PCB_MODULE_T:
- Delete_Module( (MODULE*) Item, DC );
- break;
-
- case PCB_DIMENSION_T:
- DeleteDimension( (DIMENSION*) Item, DC );
- break;
-
- case PCB_TARGET_T:
- DeleteTarget( (PCB_TARGET*) Item, DC );
- break;
-
- case PCB_LINE_T:
- Delete_Segment_Edge( (DRAWSEGMENT*) Item, DC );
- break;
-
- case PCB_TEXT_T:
- Delete_Texte_Pcb( (TEXTE_PCB*) Item, DC );
- break;
-
- case PCB_TRACE_T:
- Delete_Track( DC, (TRACK*) Item );
- break;
-
- case PCB_VIA_T:
- Delete_Segment( DC, (TRACK*) Item );
- break;
-
- case PCB_ZONE_AREA_T:
- {
- SetCurItem( NULL );
- int netcode = ( (ZONE_CONTAINER*) Item )->GetNetCode();
- Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
- TestNetConnection( NULL, netcode );
- SetMsgPanel( GetBoard() );
- }
- break;
-
- case PCB_MARKER_T:
- if( Item == GetCurItem() )
- SetCurItem( NULL );
-
- ( (MARKER_PCB*) Item )->Draw( m_canvas, DC, GR_XOR );
-
- // delete the marker, and free memory. Don't use undo stack.
- GetBoard()->Delete( Item );
- break;
-
- case PCB_PAD_T:
- case PCB_MODULE_TEXT_T:
- case PCB_MODULE_EDGE_T:
- break;
-
- case TYPE_NOT_INIT:
- case PCB_T:
- default:
- wxLogDebug( wxT( "Remove: item type %d unknown." ), Item->Type() );
- break;
- }
-}
-
-
void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
{
PCB_LAYER_ID curLayer = GetActiveLayer();
@@ -719,3 +503,61 @@ void PCB_BASE_EDIT_FRAME::createArray()
array_creator.Invoke();
}
+
+
+void PCB_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
+{
+ switch( aItem->Type() )
+ {
+ case PCB_TRACE_T:
+ case PCB_VIA_T:
+ Edit_TrackSegm_Width( aDC, static_cast