You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1317 lines
40 KiB

7 years ago
7 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2019 CERN
  5. * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #include <fctsys.h>
  25. #include <kiway.h>
  26. #include <sch_view.h>
  27. #include <sch_edit_frame.h>
  28. #include <sch_sheet.h>
  29. #include <sch_line.h>
  30. #include <connection_graph.h>
  31. #include <erc.h>
  32. #include <eeschema_id.h>
  33. #include <netlist_object.h>
  34. #include <tool/tool_manager.h>
  35. #include <tool/picker_tool.h>
  36. #include <tools/ee_actions.h>
  37. #include <tools/sch_editor_control.h>
  38. #include <tools/ee_selection.h>
  39. #include <tools/ee_selection_tool.h>
  40. #include <advanced_config.h>
  41. #include <simulation_cursors.h>
  42. #include <sim/sim_plot_frame.h>
  43. #include <sch_legacy_plugin.h>
  44. #include <class_library.h>
  45. #include <confirm.h>
  46. #include <sch_painter.h>
  47. #include <status_popup.h>
  48. #include <ws_proxy_undo_item.h>
  49. #include <dialogs/dialog_page_settings.h>
  50. #include <dialogs/dialog_fields_editor_global.h>
  51. #include <invoke_sch_dialog.h>
  52. int SCH_EDITOR_CONTROL::New( const TOOL_EVENT& aEvent )
  53. {
  54. m_frame->NewProject();
  55. return 0;
  56. }
  57. int SCH_EDITOR_CONTROL::Open( const TOOL_EVENT& aEvent )
  58. {
  59. m_frame->LoadProject();
  60. return 0;
  61. }
  62. int SCH_EDITOR_CONTROL::Save( const TOOL_EVENT& aEvent )
  63. {
  64. m_frame->SaveProject();
  65. return 0;
  66. }
  67. int SCH_EDITOR_CONTROL::SaveAs( const TOOL_EVENT& aEvent )
  68. {
  69. m_frame->Save_File( true );
  70. return 0;
  71. }
  72. int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
  73. {
  74. PICKED_ITEMS_LIST undoCmd;
  75. WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( m_frame );
  76. ITEM_PICKER wrapper( undoItem, UR_PAGESETTINGS );
  77. undoCmd.PushItem( wrapper );
  78. m_frame->SaveCopyInUndoList( undoCmd, UR_PAGESETTINGS );
  79. DIALOG_PAGES_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_MILS, MAX_PAGE_SIZE_MILS ) );
  80. dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName );
  81. if( dlg.ShowModal() != wxID_OK )
  82. m_frame->RollbackSchematicFromUndo();
  83. return 0;
  84. }
  85. int SCH_EDITOR_CONTROL::Print( const TOOL_EVENT& aEvent )
  86. {
  87. m_frame->Print();
  88. return 0;
  89. }
  90. int SCH_EDITOR_CONTROL::Plot( const TOOL_EVENT& aEvent )
  91. {
  92. m_frame->PlotSchematic();
  93. return 0;
  94. }
  95. int SCH_EDITOR_CONTROL::Quit( const TOOL_EVENT& aEvent )
  96. {
  97. m_frame->Close( false );
  98. return 0;
  99. }
  100. // A dummy wxFindReplaceData signalling any marker should be found
  101. static wxFindReplaceData g_markersOnly;
  102. int SCH_EDITOR_CONTROL::FindAndReplace( const TOOL_EVENT& aEvent )
  103. {
  104. m_frame->ShowFindReplaceDialog( aEvent.IsAction( &ACTIONS::findAndReplace ));
  105. return UpdateFind( aEvent );
  106. }
  107. int SCH_EDITOR_CONTROL::UpdateFind( const TOOL_EVENT& aEvent )
  108. {
  109. wxFindReplaceData* data = m_frame->GetFindReplaceData();
  110. if( aEvent.IsAction( &ACTIONS::find ) || aEvent.IsAction( &ACTIONS::findAndReplace )
  111. || aEvent.IsAction( &ACTIONS::updateFind ) )
  112. {
  113. m_selectionTool->ClearSelection();
  114. INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* )
  115. {
  116. if( data && item->Matches( *data, nullptr ) )
  117. m_selectionTool->BrightenItem( item );
  118. else if( item->IsBrightened() )
  119. m_selectionTool->UnbrightenItem( item );
  120. return SEARCH_CONTINUE;
  121. };
  122. EDA_ITEM* start = m_frame->GetScreen()->GetDrawItems();
  123. EDA_ITEM::IterateForward( start, inspector, nullptr, EE_COLLECTOR::AllItems );
  124. }
  125. else if( aEvent.Matches( EVENTS::SelectedItemsModified ) )
  126. {
  127. for( EDA_ITEM* item : m_selectionTool->GetSelection() )
  128. {
  129. if( data && item->Matches( *data, nullptr ) )
  130. m_selectionTool->BrightenItem( item );
  131. else if( item->IsBrightened() )
  132. m_selectionTool->UnbrightenItem( item );
  133. }
  134. }
  135. getView()->UpdateItems();
  136. m_frame->GetCanvas()->Refresh();
  137. return 0;
  138. }
  139. EDA_ITEM* nextMatch( SCH_SCREEN* aScreen, EDA_ITEM* after, wxFindReplaceData* data )
  140. {
  141. EDA_ITEM* found = nullptr;
  142. INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
  143. {
  144. if( after )
  145. {
  146. if( after == item )
  147. after = nullptr;
  148. return SEARCH_CONTINUE;
  149. }
  150. if( ( data == &g_markersOnly && item->Type() == SCH_MARKER_T )
  151. || item->Matches( *data, nullptr ) )
  152. {
  153. found = item;
  154. return SEARCH_QUIT;
  155. }
  156. return SEARCH_CONTINUE;
  157. };
  158. EDA_ITEM::IterateForward( aScreen->GetDrawItems(), inspector, nullptr, EE_COLLECTOR::AllItems );
  159. return found;
  160. }
  161. int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
  162. {
  163. // A timer during which a subsequent FindNext will result in a wrap-around
  164. static wxTimer wrapAroundTimer;
  165. wxFindReplaceData* data = m_frame->GetFindReplaceData();
  166. if( aEvent.IsAction( &ACTIONS::findNextMarker ) )
  167. {
  168. if( data )
  169. g_markersOnly.SetFlags( data->GetFlags() );
  170. data = &g_markersOnly;
  171. }
  172. else if( !data )
  173. {
  174. return FindAndReplace( ACTIONS::find.MakeEvent() );
  175. }
  176. bool searchAllSheets = !( data->GetFlags() & FR_CURRENT_SHEET_ONLY );
  177. EE_SELECTION& selection = m_selectionTool->GetSelection();
  178. SCH_SCREEN* afterScreen = m_frame->GetScreen();
  179. EDA_ITEM* afterItem = selection.Front();
  180. EDA_ITEM* item = nullptr;
  181. if( wrapAroundTimer.IsRunning() )
  182. {
  183. afterScreen = nullptr;
  184. afterItem = nullptr;
  185. wrapAroundTimer.Stop();
  186. m_frame->ClearFindReplaceStatus();
  187. }
  188. m_selectionTool->ClearSelection();
  189. if( afterScreen || !searchAllSheets )
  190. item = nextMatch( m_frame->GetScreen(), afterItem, data );
  191. if( !item && searchAllSheets )
  192. {
  193. SCH_SHEET_LIST schematic( g_RootSheet );
  194. SCH_SCREENS screens;
  195. for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
  196. {
  197. if( afterScreen )
  198. {
  199. if( afterScreen == screen )
  200. afterScreen = nullptr;
  201. continue;
  202. }
  203. item = nextMatch( screen, nullptr, data );
  204. if( item )
  205. {
  206. SCH_SHEET_PATH* sheet = schematic.FindSheetForScreen( screen );
  207. wxCHECK_MSG( sheet, 0, "Sheet not found for " + screen->GetFileName() );
  208. *g_CurrentSheet = *sheet;
  209. g_CurrentSheet->UpdateAllScreenReferences();
  210. screen->SetZoom( m_frame->GetScreen()->GetZoom() );
  211. screen->TestDanglingEnds();
  212. m_frame->SetScreen( screen );
  213. UpdateFind( ACTIONS::updateFind.MakeEvent() );
  214. break;
  215. }
  216. }
  217. }
  218. if( item )
  219. {
  220. m_selectionTool->AddItemToSel( item );
  221. m_frame->FocusOnLocation( item->GetBoundingBox().GetCenter(), true );
  222. m_frame->GetCanvas()->Refresh();
  223. }
  224. else
  225. {
  226. wxString msg = searchAllSheets ? _( "Reached end of schematic." )
  227. : _( "Reached end of sheet." );
  228. m_frame->ShowFindReplaceStatus( msg + _( "\nFind again to wrap around to the start." ) );
  229. wrapAroundTimer.StartOnce( 4000 );
  230. }
  231. return 0;
  232. }
  233. bool SCH_EDITOR_CONTROL::HasMatch()
  234. {
  235. wxFindReplaceData* data = m_frame->GetFindReplaceData();
  236. EDA_ITEM* item = m_selectionTool->GetSelection().Front();
  237. return data && item && item->Matches( *data, nullptr );
  238. }
  239. int SCH_EDITOR_CONTROL::ReplaceAndFindNext( const TOOL_EVENT& aEvent )
  240. {
  241. wxFindReplaceData* data = m_frame->GetFindReplaceData();
  242. EDA_ITEM* item = m_selectionTool->GetSelection().Front();
  243. if( !data )
  244. return FindAndReplace( ACTIONS::find.MakeEvent() );
  245. if( item && item->Matches( *data, nullptr ) )
  246. {
  247. item->Replace( *data, g_CurrentSheet );
  248. FindNext( ACTIONS::findNext.MakeEvent() );
  249. }
  250. return 0;
  251. }
  252. int SCH_EDITOR_CONTROL::ReplaceAll( const TOOL_EVENT& aEvent )
  253. {
  254. wxFindReplaceData* data = m_frame->GetFindReplaceData();
  255. if( !data )
  256. return FindAndReplace( ACTIONS::find.MakeEvent() );
  257. SCH_SHEET_LIST schematic( g_RootSheet );
  258. SCH_SCREENS screens;
  259. for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
  260. {
  261. for( EDA_ITEM* item = nextMatch( screen, nullptr, data ); item;
  262. item = nextMatch( screen, item, data ) )
  263. {
  264. item->Replace( *data, schematic.FindSheetForScreen( screen ) );
  265. }
  266. }
  267. return 0;
  268. }
  269. int SCH_EDITOR_CONTROL::CrossProbeToPcb( const TOOL_EVENT& aEvent )
  270. {
  271. doCrossProbeSchToPcb( aEvent, false );
  272. return 0;
  273. }
  274. int SCH_EDITOR_CONTROL::ExplicitCrossProbeToPcb( const TOOL_EVENT& aEvent )
  275. {
  276. doCrossProbeSchToPcb( aEvent, true );
  277. return 0;
  278. }
  279. void SCH_EDITOR_CONTROL::doCrossProbeSchToPcb( const TOOL_EVENT& aEvent, bool aForce )
  280. {
  281. // Don't get in an infinite loop SCH -> PCB -> SCH -> PCB -> SCH -> ...
  282. if( m_probingPcbToSch )
  283. return;
  284. EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  285. SCH_ITEM* item = nullptr;
  286. SCH_COMPONENT* component = nullptr;
  287. if( aForce )
  288. {
  289. EE_SELECTION& selection = selTool->RequestSelection();
  290. if( selection.GetSize() >= 1 )
  291. item = (SCH_ITEM*) selection.Front();
  292. }
  293. else
  294. {
  295. EE_SELECTION& selection = selTool->GetSelection();
  296. if( selection.GetSize() >= 1 )
  297. item = (SCH_ITEM*) selection.Front();
  298. }
  299. if( !item )
  300. {
  301. if( aForce )
  302. m_frame->SendMessageToPCBNEW( nullptr, nullptr );
  303. return;
  304. }
  305. switch( item->Type() )
  306. {
  307. case SCH_FIELD_T:
  308. case LIB_FIELD_T:
  309. component = (SCH_COMPONENT*) item->GetParent();
  310. m_frame->SendMessageToPCBNEW( item, component );
  311. break;
  312. case SCH_COMPONENT_T:
  313. component = (SCH_COMPONENT*) item;
  314. m_frame->SendMessageToPCBNEW( item, component );
  315. break;
  316. case SCH_PIN_T:
  317. component = (SCH_COMPONENT*) item->GetParent();
  318. m_frame->SendMessageToPCBNEW( static_cast<SCH_PIN*>( item ), component );
  319. break;
  320. case SCH_SHEET_T:
  321. if( aForce )
  322. m_frame->SendMessageToPCBNEW( item, nullptr );
  323. break;
  324. default:
  325. break;
  326. }
  327. }
  328. #ifdef KICAD_SPICE
  329. static KICAD_T wires[] = { SCH_LINE_LOCATE_WIRE_T, EOT };
  330. static KICAD_T wiresAndPins[] = { SCH_LINE_LOCATE_WIRE_T, SCH_PIN_T, SCH_SHEET_PIN_T, EOT };
  331. static KICAD_T fieldsAndComponents[] = { SCH_COMPONENT_T, SCH_FIELD_T, EOT };
  332. #define HITTEST_THRESHOLD_PIXELS 5
  333. int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
  334. {
  335. auto picker = m_toolMgr->GetTool<PICKER_TOOL>();
  336. auto simFrame = (SIM_PLOT_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, false );
  337. if( !simFrame ) // Defensive coding; shouldn't happen.
  338. return 0;
  339. // Deactivate other tools; particularly important if another PICKER is currently running
  340. Activate();
  341. picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::VOLTAGE_PROBE ) );
  342. picker->SetClickHandler(
  343. [this, simFrame] ( const VECTOR2D& aPosition )
  344. {
  345. EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  346. EDA_ITEM* item = selTool->SelectPoint( aPosition, wiresAndPins );
  347. if( !item )
  348. return false;
  349. if( item->IsType( wires ) )
  350. {
  351. std::unique_ptr<NETLIST_OBJECT_LIST> netlist( m_frame->BuildNetListBase() );
  352. for( NETLIST_OBJECT* obj : *netlist )
  353. {
  354. if( obj->m_Comp == item )
  355. {
  356. simFrame->AddVoltagePlot( UnescapeString( obj->GetNetName() ) );
  357. break;
  358. }
  359. }
  360. }
  361. else if( item->Type() == SCH_PIN_T )
  362. {
  363. SCH_PIN* pin = (SCH_PIN*) item;
  364. SCH_COMPONENT* comp = (SCH_COMPONENT*) item->GetParent();
  365. wxString param = wxString::Format( _T( "I%s" ), pin->GetName().Lower() );
  366. simFrame->AddCurrentPlot( comp->GetRef( g_CurrentSheet ), param );
  367. }
  368. return true;
  369. } );
  370. picker->SetMotionHandler(
  371. [this, picker] ( const VECTOR2D& aPos )
  372. {
  373. EE_COLLECTOR collector;
  374. collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
  375. collector.Collect( m_frame->GetScreen()->GetDrawItems(), wiresAndPins, (wxPoint) aPos );
  376. EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  377. selectionTool->GuessSelectionCandidates( collector, aPos );
  378. EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
  379. SCH_LINE* wire = dynamic_cast<SCH_LINE*>( item );
  380. wxString netName;
  381. if( wire )
  382. {
  383. item = nullptr;
  384. if( wire->Connection( *g_CurrentSheet ) )
  385. netName = wire->Connection( *g_CurrentSheet )->Name();
  386. }
  387. if( item && item->Type() == SCH_PIN_T )
  388. picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::CURRENT_PROBE ) );
  389. else
  390. picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::VOLTAGE_PROBE ) );
  391. if( m_pickerItem != item )
  392. {
  393. if( m_pickerItem )
  394. selectionTool->UnbrightenItem( m_pickerItem );
  395. m_pickerItem = item;
  396. if( m_pickerItem )
  397. selectionTool->BrightenItem( m_pickerItem );
  398. }
  399. if( m_frame->GetSelectedNetName() != netName )
  400. {
  401. m_frame->SetSelectedNetName( netName );
  402. TOOL_EVENT dummyEvent;
  403. UpdateNetHighlighting( dummyEvent );
  404. }
  405. } );
  406. picker->SetFinalizeHandler(
  407. [this] ( const int& aFinalState )
  408. {
  409. if( m_pickerItem )
  410. m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
  411. if( !m_frame->GetSelectedNetName().IsEmpty() )
  412. {
  413. m_frame->SetSelectedNetName( wxEmptyString );
  414. TOOL_EVENT dummyEvent;
  415. UpdateNetHighlighting( dummyEvent );
  416. }
  417. } );
  418. std::string tool = aEvent.GetCommandStr().get();
  419. m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
  420. return 0;
  421. }
  422. int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
  423. {
  424. PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
  425. // Deactivate other tools; particularly important if another PICKER is currently running
  426. Activate();
  427. picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::CURSOR::TUNE ) );
  428. picker->SetClickHandler(
  429. [this] ( const VECTOR2D& aPosition )
  430. {
  431. EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  432. EDA_ITEM* item = selTool->SelectPoint( aPosition, fieldsAndComponents );
  433. if( !item )
  434. return false;
  435. if( item->Type() != SCH_COMPONENT_T )
  436. {
  437. item = item->GetParent();
  438. if( item->Type() != SCH_COMPONENT_T )
  439. return false;
  440. }
  441. SIM_PLOT_FRAME* simFrame =
  442. (SIM_PLOT_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, false );
  443. if( simFrame )
  444. simFrame->AddTuner( static_cast<SCH_COMPONENT*>( item ) );
  445. return true;
  446. } );
  447. picker->SetMotionHandler(
  448. [this] ( const VECTOR2D& aPos )
  449. {
  450. EE_COLLECTOR collector;
  451. collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
  452. collector.Collect( m_frame->GetScreen()->GetDrawItems(), fieldsAndComponents, (wxPoint) aPos );
  453. EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  454. selectionTool->GuessSelectionCandidates( collector, aPos );
  455. EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
  456. if( m_pickerItem != item )
  457. {
  458. if( m_pickerItem )
  459. selectionTool->UnbrightenItem( m_pickerItem );
  460. m_pickerItem = item;
  461. if( m_pickerItem )
  462. selectionTool->BrightenItem( m_pickerItem );
  463. }
  464. } );
  465. picker->SetFinalizeHandler(
  466. [this] ( const int& aFinalState )
  467. {
  468. if( m_pickerItem )
  469. m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
  470. } );
  471. std::string tool = aEvent.GetCommandStr().get();
  472. m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
  473. return 0;
  474. }
  475. #endif /* KICAD_SPICE */
  476. // A singleton reference for clearing the highlight
  477. static VECTOR2D CLEAR;
  478. // TODO(JE) Probably use netcode rather than connection name here eventually
  479. static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
  480. {
  481. SCH_EDIT_FRAME* editFrame = static_cast<SCH_EDIT_FRAME*>( aToolMgr->GetEditFrame() );
  482. EE_SELECTION_TOOL* selTool = aToolMgr->GetTool<EE_SELECTION_TOOL>();
  483. SCH_EDITOR_CONTROL* editorControl = aToolMgr->GetTool<SCH_EDITOR_CONTROL>();
  484. wxString netName;
  485. bool retVal = true;
  486. if( aPosition != CLEAR )
  487. {
  488. if( TestDuplicateSheetNames( false ) > 0 )
  489. {
  490. wxMessageBox( _( "Error: duplicate sub-sheet names found in current sheet." ) );
  491. retVal = false;
  492. }
  493. else
  494. {
  495. SCH_ITEM* item = (SCH_ITEM*) selTool->GetNode( aPosition );
  496. if( item && item->Connection( *g_CurrentSheet ) )
  497. netName = item->Connection( *g_CurrentSheet )->Name();
  498. }
  499. }
  500. if( netName.empty() )
  501. {
  502. editFrame->SetStatusText( wxT( "" ) );
  503. editFrame->SendCrossProbeClearHighlight();
  504. }
  505. else
  506. {
  507. editFrame->SendCrossProbeNetName( netName );
  508. editFrame->SetStatusText( wxString::Format( _( "Highlighted net: %s" ),
  509. UnescapeString( netName ) ) );
  510. }
  511. editFrame->SetSelectedNetName( netName );
  512. TOOL_EVENT dummy;
  513. editorControl->UpdateNetHighlighting( dummy );
  514. return retVal;
  515. }
  516. int SCH_EDITOR_CONTROL::HighlightNet( const TOOL_EVENT& aEvent )
  517. {
  518. KIGFX::VIEW_CONTROLS* controls = getViewControls();
  519. VECTOR2D cursorPos = controls->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
  520. highlightNet( m_toolMgr, cursorPos );
  521. return 0;
  522. }
  523. int SCH_EDITOR_CONTROL::ClearHighlight( const TOOL_EVENT& aEvent )
  524. {
  525. highlightNet( m_toolMgr, CLEAR );
  526. return 0;
  527. }
  528. int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent )
  529. {
  530. SCH_SCREEN* screen = g_CurrentSheet->LastScreen();
  531. std::vector<EDA_ITEM*> itemsToRedraw;
  532. wxString selectedNetName = m_frame->GetSelectedNetName();
  533. if( !screen )
  534. return 0;
  535. for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() )
  536. {
  537. SCH_CONNECTION* conn = item->Connection( *g_CurrentSheet );
  538. bool redraw = item->IsBrightened();
  539. if( conn && conn->Name() == selectedNetName )
  540. item->SetBrightened();
  541. else
  542. item->ClearBrightened();
  543. redraw |= item->IsBrightened();
  544. if( item->Type() == SCH_COMPONENT_T )
  545. {
  546. SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( item );
  547. redraw |= comp->HasBrightenedPins();
  548. comp->ClearBrightenedPins();
  549. std::vector<LIB_PIN*> pins;
  550. comp->GetPins( pins );
  551. for( LIB_PIN* pin : pins )
  552. {
  553. auto pin_conn = comp->GetConnectionForPin( pin, *g_CurrentSheet );
  554. if( pin_conn && pin_conn->Name( false ) == selectedNetName )
  555. {
  556. comp->BrightenPin( pin );
  557. redraw = true;
  558. }
  559. }
  560. }
  561. else if( item->Type() == SCH_SHEET_T )
  562. {
  563. for( SCH_SHEET_PIN& pin : static_cast<SCH_SHEET*>( item )->GetPins() )
  564. {
  565. auto pin_conn = pin.Connection( *g_CurrentSheet );
  566. bool redrawPin = pin.IsBrightened();
  567. if( pin_conn && pin_conn->Name() == selectedNetName )
  568. pin.SetBrightened();
  569. else
  570. pin.ClearBrightened();
  571. redrawPin |= pin.IsBrightened();
  572. if( redrawPin )
  573. itemsToRedraw.push_back( &pin );
  574. }
  575. }
  576. if( redraw )
  577. itemsToRedraw.push_back( item );
  578. }
  579. // Be sure highlight change will be redrawn
  580. KIGFX::VIEW* view = getView();
  581. for( auto redrawItem : itemsToRedraw )
  582. view->Update( (KIGFX::VIEW_ITEM*)redrawItem, KIGFX::VIEW_UPDATE_FLAGS::REPAINT );
  583. m_frame->GetCanvas()->Refresh();
  584. return 0;
  585. }
  586. int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
  587. {
  588. // TODO(JE) remove once real-time connectivity is a given
  589. if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
  590. m_frame->RecalculateConnections();
  591. std::string tool = aEvent.GetCommandStr().get();
  592. PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
  593. // Deactivate other tools; particularly important if another PICKER is currently running
  594. Activate();
  595. picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
  596. picker->SetClickHandler(
  597. [this] ( const VECTOR2D& aPos )
  598. {
  599. return highlightNet( m_toolMgr, aPos );
  600. } );
  601. m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
  602. return 0;
  603. }
  604. int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent )
  605. {
  606. if( m_frame->GetScreen()->GetUndoCommandCount() <= 0 )
  607. return 0;
  608. // Inform tools that undo command was issued
  609. m_toolMgr->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
  610. /* Get the old list */
  611. PICKED_ITEMS_LIST* List = m_frame->GetScreen()->PopCommandFromUndoList();
  612. /* Undo the command */
  613. m_frame->PutDataInPreviousState( List, false );
  614. /* Put the old list in RedoList */
  615. List->ReversePickersListOrder();
  616. m_frame->GetScreen()->PushCommandToRedoList( List );
  617. EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  618. selTool->RebuildSelection();
  619. m_frame->SetSheetNumberAndCount();
  620. m_frame->TestDanglingEnds();
  621. m_frame->SyncView();
  622. m_frame->GetCanvas()->Refresh();
  623. m_frame->OnModify();
  624. return 0;
  625. }
  626. int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent )
  627. {
  628. if( m_frame->GetScreen()->GetRedoCommandCount() == 0 )
  629. return 0;
  630. // Inform tools that undo command was issued
  631. m_toolMgr->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
  632. /* Get the old list */
  633. PICKED_ITEMS_LIST* List = m_frame->GetScreen()->PopCommandFromRedoList();
  634. /* Redo the command: */
  635. m_frame->PutDataInPreviousState( List, true );
  636. /* Put the old list in UndoList */
  637. List->ReversePickersListOrder();
  638. m_frame->GetScreen()->PushCommandToUndoList( List );
  639. EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  640. selTool->RebuildSelection();
  641. m_frame->SetSheetNumberAndCount();
  642. m_frame->TestDanglingEnds();
  643. m_frame->SyncView();
  644. m_frame->GetCanvas()->Refresh();
  645. m_frame->OnModify();
  646. return 0;
  647. }
  648. bool SCH_EDITOR_CONTROL::doCopy()
  649. {
  650. EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  651. EE_SELECTION& selection = selTool->RequestSelection();
  652. if( !selection.GetSize() )
  653. return false;
  654. STRING_FORMATTER formatter;
  655. SCH_LEGACY_PLUGIN plugin;
  656. plugin.Format( &selection, &formatter );
  657. return m_toolMgr->SaveClipboard( formatter.GetString() );
  658. }
  659. int SCH_EDITOR_CONTROL::Cut( const TOOL_EVENT& aEvent )
  660. {
  661. wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
  662. if( textEntry )
  663. {
  664. textEntry->Cut();
  665. return 0;
  666. }
  667. if( doCopy() )
  668. m_toolMgr->RunAction( ACTIONS::doDelete, true );
  669. return 0;
  670. }
  671. int SCH_EDITOR_CONTROL::Copy( const TOOL_EVENT& aEvent )
  672. {
  673. wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
  674. if( textEntry )
  675. {
  676. textEntry->Copy();
  677. return 0;
  678. }
  679. doCopy();
  680. return 0;
  681. }
  682. int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
  683. {
  684. wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( wxWindow::FindFocus() );
  685. if( textEntry )
  686. {
  687. textEntry->Paste();
  688. return 0;
  689. }
  690. EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  691. DLIST<SCH_ITEM>& dlist = m_frame->GetScreen()->GetDrawList();
  692. SCH_ITEM* last = dlist.GetLast();
  693. std::string text = m_toolMgr->GetClipboard();
  694. if( text.empty() )
  695. return 0;
  696. STRING_LINE_READER reader( text, "Clipboard" );
  697. SCH_LEGACY_PLUGIN plugin;
  698. try
  699. {
  700. plugin.LoadContent( reader, m_frame->GetScreen() );
  701. }
  702. catch( IO_ERROR& e )
  703. {
  704. // If it wasn't content, then paste as text
  705. dlist.Append( new SCH_TEXT( wxPoint( 0, 0 ), text ) );
  706. }
  707. // SCH_LEGACY_PLUGIN added the items to the DLIST, but not to the view or anything
  708. // else. Pull them back out to start with.
  709. //
  710. EDA_ITEMS loadedItems;
  711. SCH_ITEM* next = nullptr;
  712. // We also make sure any pasted sheets will not cause recursion in the destination.
  713. // Moreover new sheets create new sheetpaths, and component alternate references must
  714. // be created and cleared
  715. //
  716. bool sheetsPasted = false;
  717. SCH_SHEET_LIST hierarchy( g_RootSheet );
  718. wxFileName destFn = g_CurrentSheet->Last()->GetFileName();
  719. if( destFn.IsRelative() )
  720. destFn.MakeAbsolute( m_frame->Prj().GetProjectPath() );
  721. for( SCH_ITEM* item = last ? last->Next() : dlist.GetFirst(); item; item = next )
  722. {
  723. next = item->Next();
  724. dlist.Remove( item );
  725. loadedItems.push_back( item );
  726. if( item->Type() == SCH_COMPONENT_T )
  727. {
  728. SCH_COMPONENT* component = (SCH_COMPONENT*) item;
  729. component->SetTimeStamp( GetNewTimeStamp() );
  730. // clear the annotation, but preserve the selected unit
  731. int unit = component->GetUnit();
  732. component->ClearAnnotation( nullptr );
  733. component->SetUnit( unit );
  734. }
  735. if( item->Type() == SCH_SHEET_T )
  736. {
  737. SCH_SHEET* sheet = (SCH_SHEET*) item;
  738. wxFileName srcFn = sheet->GetFileName();
  739. if( srcFn.IsRelative() )
  740. srcFn.MakeAbsolute( m_frame->Prj().GetProjectPath() );
  741. SCH_SHEET_LIST sheetHierarchy( sheet );
  742. if( hierarchy.TestForRecursion( sheetHierarchy, destFn.GetFullPath( wxPATH_UNIX ) ) )
  743. {
  744. auto msg = wxString::Format( _( "The pasted sheet \"%s\"\n"
  745. "was dropped because the destination already has "
  746. "the sheet or one of its subsheets as a parent." ),
  747. sheet->GetFileName() );
  748. DisplayError( m_frame, msg );
  749. loadedItems.pop_back();
  750. }
  751. else
  752. {
  753. // Duplicate sheet names and sheet time stamps are not valid. Use a time stamp
  754. // based sheet name and update the time stamp for each sheet in the block.
  755. timestamp_t uid = GetNewTimeStamp();
  756. sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)uid ) );
  757. sheet->SetTimeStamp( uid );
  758. sheet->SetParent( g_CurrentSheet->Last() );
  759. sheet->SetScreen( nullptr );
  760. sheetsPasted = true;
  761. }
  762. }
  763. }
  764. // Now we can resolve the components and add everything to the screen, view, etc.
  765. //
  766. SYMBOL_LIB_TABLE* symLibTable = m_frame->Prj().SchSymbolLibTable();
  767. PART_LIB* partLib = m_frame->Prj().SchLibs()->GetCacheLibrary();
  768. for( unsigned i = 0; i < loadedItems.size(); ++i )
  769. {
  770. EDA_ITEM* item = loadedItems[i];
  771. if( item->Type() == SCH_COMPONENT_T )
  772. {
  773. SCH_COMPONENT* component = (SCH_COMPONENT*) item;
  774. component->Resolve( *symLibTable, partLib );
  775. component->UpdatePins();
  776. }
  777. else if( item->Type() == SCH_SHEET_T )
  778. {
  779. SCH_SHEET* sheet = (SCH_SHEET*) item;
  780. wxFileName fn = sheet->GetFileName();
  781. SCH_SCREEN* existingScreen = nullptr;
  782. if( !fn.IsAbsolute() )
  783. {
  784. wxFileName currentSheetFileName = g_CurrentSheet->LastScreen()->GetFileName();
  785. fn.Normalize( wxPATH_NORM_ALL, currentSheetFileName.GetPath() );
  786. }
  787. if( g_RootSheet->SearchHierarchy( fn.GetFullPath( wxPATH_UNIX ), &existingScreen ) )
  788. {
  789. sheet->SetScreen( existingScreen );
  790. SCH_SHEET_PATH sheetpath = *g_CurrentSheet;
  791. sheetpath.push_back( sheet );
  792. // Clear annotation and create the AR for this path, if not exists,
  793. // when the screen is shared by sheet paths.
  794. // Otherwise ClearAnnotation do nothing, because the F1 field is used as
  795. // reference default value and takes the latest displayed value
  796. existingScreen->EnsureAlternateReferencesExist();
  797. existingScreen->ClearAnnotation( &sheetpath );
  798. }
  799. else
  800. {
  801. if( !m_frame->LoadSheetFromFile( sheet, g_CurrentSheet, fn.GetFullPath() ) )
  802. m_frame->InitSheet( sheet, sheet->GetFileName() );
  803. }
  804. }
  805. item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED );
  806. m_frame->AddItemToScreenAndUndoList( (SCH_ITEM*) item, i > 0 );
  807. // Reset flags for subsequent move operation
  808. item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED );
  809. // Start out hidden so the pasted items aren't "ghosted" in their original location
  810. // before being moved to the current location.
  811. getView()->Hide( item, true );
  812. }
  813. if( sheetsPasted )
  814. m_frame->SetSheetNumberAndCount();
  815. // Now clear the previous selection, select the pasted items, and fire up the "move"
  816. // tool.
  817. //
  818. m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
  819. m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &loadedItems );
  820. EE_SELECTION& selection = selTool->GetSelection();
  821. if( !selection.Empty() )
  822. {
  823. SCH_ITEM* item = (SCH_ITEM*) selection.GetTopLeftItem();
  824. selection.SetReferencePoint( item->GetPosition() );
  825. m_toolMgr->RunAction( EE_ACTIONS::move, false );
  826. }
  827. return 0;
  828. }
  829. int SCH_EDITOR_CONTROL::EditWithLibEdit( const TOOL_EVENT& aEvent )
  830. {
  831. EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  832. EE_SELECTION& selection = selTool->RequestSelection( EE_COLLECTOR::ComponentsOnly );
  833. SCH_COMPONENT* sym = nullptr;
  834. LIB_EDIT_FRAME* libEdit;
  835. if( selection.GetSize() >= 1 )
  836. sym = (SCH_COMPONENT*) selection.Front();
  837. if( !sym || sym->GetEditFlags() != 0 )
  838. return 0;
  839. m_toolMgr->RunAction( ACTIONS::showSymbolEditor, true );
  840. libEdit = (LIB_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
  841. if( libEdit )
  842. libEdit->LoadComponentAndSelectLib( sym->GetLibId(), sym->GetUnit(), sym->GetConvert() );
  843. return 0;
  844. }
  845. int SCH_EDITOR_CONTROL::Annotate( const TOOL_EVENT& aEvent )
  846. {
  847. wxCommandEvent dummy;
  848. m_frame->OnAnnotate( dummy );
  849. return 0;
  850. }
  851. int SCH_EDITOR_CONTROL::ShowCvpcb( const TOOL_EVENT& aEvent )
  852. {
  853. wxCommandEvent dummy;
  854. m_frame->OnOpenCvpcb( dummy );
  855. return 0;
  856. }
  857. int SCH_EDITOR_CONTROL::EditSymbolFields( const TOOL_EVENT& aEvent )
  858. {
  859. DIALOG_FIELDS_EDITOR_GLOBAL dlg( m_frame );
  860. dlg.ShowQuasiModal();
  861. return 0;
  862. }
  863. int SCH_EDITOR_CONTROL::EditSymbolLibraryLinks( const TOOL_EVENT& aEvent )
  864. {
  865. if( InvokeDialogEditComponentsLibId( m_frame ) )
  866. m_frame->HardRedraw();
  867. return 0;
  868. }
  869. int SCH_EDITOR_CONTROL::ShowPcbNew( const TOOL_EVENT& aEvent )
  870. {
  871. wxCommandEvent dummy;
  872. m_frame->OnOpenPcbnew( dummy );
  873. return 0;
  874. }
  875. int SCH_EDITOR_CONTROL::UpdatePCB( const TOOL_EVENT& aEvent )
  876. {
  877. wxCommandEvent dummy;
  878. m_frame->OnUpdatePCB( dummy );
  879. return 0;
  880. }
  881. int SCH_EDITOR_CONTROL::ExportNetlist( const TOOL_EVENT& aEvent )
  882. {
  883. int result = NET_PLUGIN_CHANGE;
  884. // If a plugin is removed or added, rebuild and reopen the new dialog
  885. while( result == NET_PLUGIN_CHANGE )
  886. result = InvokeDialogNetList( m_frame );
  887. return 0;
  888. }
  889. int SCH_EDITOR_CONTROL::GenerateBOM( const TOOL_EVENT& aEvent )
  890. {
  891. InvokeDialogCreateBOM( m_frame );
  892. return 0;
  893. }
  894. int SCH_EDITOR_CONTROL::DrawSheetOnClipboard( const TOOL_EVENT& aEvent )
  895. {
  896. m_frame->DrawCurrentSheetToClipboard();
  897. return 0;
  898. }
  899. int SCH_EDITOR_CONTROL::ShowBusManager( const TOOL_EVENT& aEvent )
  900. {
  901. InvokeDialogBusManager( m_frame );
  902. return 0;
  903. }
  904. int SCH_EDITOR_CONTROL::EnterSheet( const TOOL_EVENT& aEvent )
  905. {
  906. EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
  907. const EE_SELECTION& selection = selTool->RequestSelection( EE_COLLECTOR::SheetsOnly );
  908. if( selection.GetSize() == 1 )
  909. {
  910. SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
  911. m_toolMgr->RunAction( ACTIONS::cancelInteractive, true );
  912. m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
  913. g_CurrentSheet->push_back( sheet );
  914. m_frame->DisplayCurrentSheet();
  915. }
  916. return 0;
  917. }
  918. int SCH_EDITOR_CONTROL::LeaveSheet( const TOOL_EVENT& aEvent )
  919. {
  920. if( g_CurrentSheet->Last() != g_RootSheet )
  921. {
  922. m_toolMgr->RunAction( ACTIONS::cancelInteractive, true );
  923. m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
  924. g_CurrentSheet->pop_back();
  925. m_frame->DisplayCurrentSheet();
  926. }
  927. return 0;
  928. }
  929. int SCH_EDITOR_CONTROL::ToggleHiddenPins( const TOOL_EVENT& aEvent )
  930. {
  931. m_frame->SetShowAllPins( !m_frame->GetShowAllPins() );
  932. auto painter = static_cast<KIGFX::SCH_PAINTER*>( getView()->GetPainter() );
  933. painter->GetSettings()->m_ShowHiddenPins = m_frame->GetShowAllPins();
  934. getView()->UpdateAllItems( KIGFX::REPAINT );
  935. m_frame->GetCanvas()->Refresh();
  936. return 0;
  937. }
  938. int SCH_EDITOR_CONTROL::ToggleForceHV( const TOOL_EVENT& aEvent )
  939. {
  940. m_frame->SetForceHVLines( !m_frame->GetForceHVLines() );
  941. return 0;
  942. }
  943. void SCH_EDITOR_CONTROL::setTransitions()
  944. {
  945. Go( &SCH_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
  946. Go( &SCH_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
  947. Go( &SCH_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
  948. Go( &SCH_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() );
  949. Go( &SCH_EDITOR_CONTROL::PageSetup, ACTIONS::pageSettings.MakeEvent() );
  950. Go( &SCH_EDITOR_CONTROL::Print, ACTIONS::print.MakeEvent() );
  951. Go( &SCH_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
  952. Go( &SCH_EDITOR_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
  953. Go( &SCH_EDITOR_CONTROL::FindAndReplace, ACTIONS::find.MakeEvent() );
  954. Go( &SCH_EDITOR_CONTROL::FindAndReplace, ACTIONS::findAndReplace.MakeEvent() );
  955. Go( &SCH_EDITOR_CONTROL::FindNext, ACTIONS::findNext.MakeEvent() );
  956. Go( &SCH_EDITOR_CONTROL::FindNext, ACTIONS::findNextMarker.MakeEvent() );
  957. Go( &SCH_EDITOR_CONTROL::ReplaceAndFindNext, ACTIONS::replaceAndFindNext.MakeEvent() );
  958. Go( &SCH_EDITOR_CONTROL::ReplaceAll, ACTIONS::replaceAll.MakeEvent() );
  959. Go( &SCH_EDITOR_CONTROL::UpdateFind, ACTIONS::updateFind.MakeEvent() );
  960. Go( &SCH_EDITOR_CONTROL::UpdateFind, EVENTS::SelectedItemsModified );
  961. Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::SelectedEvent );
  962. Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::UnselectedEvent );
  963. Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::ClearedEvent );
  964. Go( &SCH_EDITOR_CONTROL::ExplicitCrossProbeToPcb, EE_ACTIONS::explicitCrossProbe.MakeEvent() );
  965. #ifdef KICAD_SPICE
  966. Go( &SCH_EDITOR_CONTROL::SimProbe, EE_ACTIONS::simProbe.MakeEvent() );
  967. Go( &SCH_EDITOR_CONTROL::SimTune, EE_ACTIONS::simTune.MakeEvent() );
  968. #endif /* KICAD_SPICE */
  969. Go( &SCH_EDITOR_CONTROL::HighlightNet, EE_ACTIONS::highlightNet.MakeEvent() );
  970. Go( &SCH_EDITOR_CONTROL::ClearHighlight, EE_ACTIONS::clearHighlight.MakeEvent() );
  971. Go( &SCH_EDITOR_CONTROL::HighlightNetCursor, EE_ACTIONS::highlightNetTool.MakeEvent() );
  972. Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, EVENTS::SelectedItemsModified );
  973. Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, EE_ACTIONS::updateNetHighlighting.MakeEvent() );
  974. Go( &SCH_EDITOR_CONTROL::ClearHighlight, ACTIONS::cancelInteractive.MakeEvent() );
  975. Go( &SCH_EDITOR_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
  976. Go( &SCH_EDITOR_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
  977. Go( &SCH_EDITOR_CONTROL::Cut, ACTIONS::cut.MakeEvent() );
  978. Go( &SCH_EDITOR_CONTROL::Copy, ACTIONS::copy.MakeEvent() );
  979. Go( &SCH_EDITOR_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
  980. Go( &SCH_EDITOR_CONTROL::EditWithLibEdit, EE_ACTIONS::editWithLibEdit.MakeEvent() );
  981. Go( &SCH_EDITOR_CONTROL::ShowCvpcb, EE_ACTIONS::assignFootprints.MakeEvent() );
  982. Go( &SCH_EDITOR_CONTROL::ImportFPAssignments, EE_ACTIONS::importFPAssignments.MakeEvent() );
  983. Go( &SCH_EDITOR_CONTROL::Annotate, EE_ACTIONS::annotate.MakeEvent() );
  984. Go( &SCH_EDITOR_CONTROL::EditSymbolFields, EE_ACTIONS::editSymbolFields.MakeEvent() );
  985. Go( &SCH_EDITOR_CONTROL::EditSymbolLibraryLinks,EE_ACTIONS::editSymbolLibraryLinks.MakeEvent() );
  986. Go( &SCH_EDITOR_CONTROL::ShowPcbNew, EE_ACTIONS::showPcbNew.MakeEvent() );
  987. Go( &SCH_EDITOR_CONTROL::UpdatePCB, ACTIONS::updatePcbFromSchematic.MakeEvent() );
  988. Go( &SCH_EDITOR_CONTROL::ExportNetlist, EE_ACTIONS::exportNetlist.MakeEvent() );
  989. Go( &SCH_EDITOR_CONTROL::GenerateBOM, EE_ACTIONS::generateBOM.MakeEvent() );
  990. Go( &SCH_EDITOR_CONTROL::DrawSheetOnClipboard, EE_ACTIONS::drawSheetOnClipboard.MakeEvent() );
  991. Go( &SCH_EDITOR_CONTROL::ShowBusManager, EE_ACTIONS::showBusManager.MakeEvent() );
  992. Go( &SCH_EDITOR_CONTROL::EnterSheet, EE_ACTIONS::enterSheet.MakeEvent() );
  993. Go( &SCH_EDITOR_CONTROL::LeaveSheet, EE_ACTIONS::leaveSheet.MakeEvent() );
  994. Go( &SCH_EDITOR_CONTROL::NavigateHierarchy, EE_ACTIONS::navigateHierarchy.MakeEvent() );
  995. Go( &SCH_EDITOR_CONTROL::ToggleHiddenPins, EE_ACTIONS::toggleHiddenPins.MakeEvent() );
  996. Go( &SCH_EDITOR_CONTROL::ToggleForceHV, EE_ACTIONS::toggleForceHV.MakeEvent() );
  997. }