1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
|
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 Jean-Pierre Charras, jp.charras@wanadoo.fr
* 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 wxPcbStruct.h
*/
#ifndef WXPCB_STRUCT_H_
#define WXPCB_STRUCT_H_
#include <pcb_base_edit_frame.h>
#include <config_params.h>
#include <class_macros_record.h>
#include <class_undoredo_container.h>
#include <zones.h>
/* Forward declarations of classes. */
class PCB_SCREEN;
class BOARD;
class TEXTE_PCB;
class MODULE;
class TRACK;
class SEGZONE;
class VIA;
class D_PAD;
class TEXTE_MODULE;
class PCB_TARGET;
class DIMENSION;
class EDGE_MODULE;
class DRC;
class ZONE_CONTAINER;
class DRAWSEGMENT;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
class PCB_LAYER_WIDGET;
class MARKER_PCB;
class BOARD_ITEM;
class PCB_LAYER_BOX_SELECTOR;
class NETLIST;
class REPORTER;
struct PARSE_ERROR;
struct IO_ERROR;
class FP_LIB_TABLE;
namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
/**
* Class PCB_EDIT_FRAME
* is the main frame for Pcbnew.
*
* See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.
*/
#define PCB_EDIT_FRAME_NAME wxT( "PcbFrame" )
class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
{
friend struct PCB::IFACE;
friend class PCB_LAYER_WIDGET;
void updateTraceWidthSelectBox();
void updateViaSizeSelectBox();
int m_RecordingMacros;
MACROS_RECORDED m_Macros[10];
/// The auxiliary right vertical tool bar used to access the microwave tools.
wxAuiToolBar* m_microWaveToolBar;
/**
* Function loadFootprints
* loads the footprints for each #COMPONENT in \a aNetlist from the list of libraries.
*
* @param aNetlist is the netlist of components to load the footprints into.
* @param aReporter is the #REPORTER object to report to.
* @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
* occurs while reading footprint library files.
*/
void loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
throw( IO_ERROR, PARSE_ERROR );
protected:
PCB_LAYER_WIDGET* m_Layers;
DRC* m_drc; ///< the DRC controller, see drc.cpp
PARAM_CFG_ARRAY m_configSettings; ///< List of Pcbnew configuration settings.
wxString m_lastNetListRead; ///< Last net list read with relative path.
// The Tool Framework initalization
void setupTools();
// we'll use lower case function names for private member functions.
void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu );
void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu );
void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
void createPopUpBlockMenu( wxMenu* menu );
void createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu );
/**
* an helper function to enable some menus only active when the display
* is switched to GAL mode and which do nothing in legacy mode
*/
void enableGALSpecificMenus();
// Has meaning only if DKICAD_SCRIPTING_WXPYTHON option is on
/**
* @return the frame name identifier for the python console frame
*/
static const wxChar * pythonConsoleNameId()
{
return wxT( "PythonConsole" );
}
/**
* @return a pointer to the python console frame, or NULL if not exist
*/
static wxWindow * findPythonConsole()
{
return FindWindowByName( pythonConsoleNameId() );
}
/**
* Function syncLayerWidgetLayer
* updates the currently layer "selection" within the PCB_LAYER_WIDGET.
* The currently selected layer is defined by the return value of GetActiveLayer().
* <p>
* This function cannot be inline without including layer_widget.h in
* here and we do not want to do that.
* </p>
*/
void syncLayerWidgetLayer();
/**
* Function syncRenderStates
* updates the "Render" checkboxes in the layer widget according
* to current toggle values determined by IsElementVisible(), and is helpful
* immediately after loading a BOARD which may have state information in it.
*/
void syncRenderStates();
/**
* Function syncLayerVisibilities
* updates each "Layer" checkbox in the layer widget according
* to each layer's current visibility determined by IsLayerVisible(), and is
* helpful immediately after loading a BOARD which may have state information in it.
*/
void syncLayerVisibilities();
virtual void unitsChangeRefresh();
/**
* Function doAutoSave
* performs auto save when the board has been modified and not saved within the
* auto save interval.
*
* @return true if the auto save was successful.
*/
virtual bool doAutoSave();
/**
* Function isautoSaveRequired
* returns true if the board has been modified.
*/
virtual bool isAutoSaveRequired() const;
/**
* Function duplicateZone
* duplicates the given zone.
* @param aDC is the current Device Context.
* @param aZone is the zone to duplicate
*/
void duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone );
/**
* Function moveExact
* Move the selected item exactly
*/
void moveExact();
/**
* Function duplicateItems
* Duplicate selected item if possible and start a move
* @param aIncrement increment the item number if appropriate
*/
void duplicateItems( bool aIncrement ); //override
// protected so that PCB::IFACE::CreateWindow() is the only factory.
PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
public:
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
wxChoice* m_SelTrackWidthBox; // a choice box to display and select current track width
wxChoice* m_SelViaSizeBox; // a choice box to display and select current via diameter
bool m_show_microwave_tools;
bool m_show_layer_manager_tools;
virtual ~PCB_EDIT_FRAME();
void OnQuit( wxCommandEvent& event );
/**
* Function GetAutoSaveFilePrefix
*
* @return the string to prepend to a file name for automatic save.
*/
static wxString GetAutoSaveFilePrefix();
/**
* Execute a remote command send by Eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
* this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest().
* @param cmdline = received command from socket
*/
virtual void ExecuteRemoteCommand( const char* cmdline );
void KiwayMailIn( KIWAY_EXPRESS& aEvent ); // virtual overload from KIWAY_PLAYER
/**
* Function ToPlotter
* Open a dialog frame to create plot and drill files
* relative to the current board
*/
void ToPlotter( wxCommandEvent& event );
/**
* Function ToPrinter
* Install the print dialog
*/
void ToPrinter( wxCommandEvent& event );
/**
* Function SVG_Print
* shows the print SVG file dialog.
*/
void SVG_Print( wxCommandEvent& event );
// User interface update command event handlers.
void OnUpdateSave( wxUpdateUIEvent& aEvent );
void OnUpdateLayerPair( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
void OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent );
void OnUpdateShowModuleRatsnest( wxUpdateUIEvent& aEvent );
void OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent );
void OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
void OnUpdateShowMicrowaveToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent );
void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent );
void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateSelectCustomTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent );
void OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent );
void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent );
void OnLayerColorChange( wxCommandEvent& aEvent );
void OnConfigurePaths( wxCommandEvent& aEvent );
/**
* Function RecordMacros.
* records sequence of hotkeys and cursor positions to a macro.
* @param aDC = current device context
* @param aNumber The current number macros.
*/
void RecordMacros( wxDC* aDC, int aNumber );
/**
* Function CallMacros
* play hotkeys and cursor position from a recorded macro.
* @param aDC = current device context
* @param aPosition The current cursor position in logical (drawing) units.
* @param aNumber The current number macros.
*/
void CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber );
void SaveMacros();
void ReadMacros();
/**
* Function PrintPage , virtual
* used to print a page
* Print the page pointed by the current screen, set by the calling print function
* @param aDC = wxDC given by the calling print function
* @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LSET aPrintMaskLayer, bool aPrintMirrorMode,
void* aData = NULL );
void GetKicadAbout( wxCommandEvent& event );
/**
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
virtual bool IsGridVisible() const;
/**
* Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown
*/
virtual void SetGridVisibility( bool aVisible );
/**
* Function GetGridColor() , virtual
* @return the color of the grid
*/
virtual EDA_COLOR_T GetGridColor() const;
/**
* Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
virtual void SetGridColor( EDA_COLOR_T aColor );
///> @copydoc EDA_DRAW_FRAME::SetCursorShape()
virtual void SetCursorShape( int aCursorShape );
// Configurations:
void Process_Config( wxCommandEvent& event );
/**
* Function GetProjectFileParameters
* returns a project file parameter list for Pcbnew.
* <p>
* Populate a project file parameter array specific to Pcbnew.
* Creating the parameter list at run time has the advantage of being able
* to define local variables. The old method of statically building the array
* at compile time requiring global variable definitions by design.
* </p>
* @return PARAM_CFG_ARRAY - it is only good until SetBoard() is called, so
* don't keep it around past that event.
*/
PARAM_CFG_ARRAY GetProjectFileParameters();
/**
* Function SaveProjectSettings
* saves changes to the project settings to the project (.pro) file.
* @param aAskForSave = true to open a dialog before saving the settings
*/
void SaveProjectSettings( bool aAskForSave );
/**
* Load the current project's file configuration settings which are pertinent
* to this PCB_EDIT_FRAME instance.
*
* @return always returns true.
*/
bool LoadProjectSettings();
/**
* Function GetConfigurationSettings
* returns the Pcbnew applications settings list.
*
* This replaces the old statically defined list that had the project
* file settings and the application settings mixed together. This
* was confusing and caused some settings to get saved and loaded
* incorrectly. Currently, only the settings that are needed at start
* up by the main window are defined here. There are other locally used
* settings that are scattered throughout the Pcbnew source code. If you need
* to define a configuration setting that needs to be loaded at run time,
* this is the place to define it.
*
* @return - Reference to the list of applications settings.
*/
PARAM_CFG_ARRAY& GetConfigurationSettings();
void LoadSettings( wxConfigBase* aCfg ); // override virtual
void SaveSettings( wxConfigBase* aCfg ); // override virtual
wxConfigBase* GetSettings() { return config(); };
/**
* Get the last net list read with the net list dialog box.
*
* @return - Absolute path and file name of the last net list file successfully read.
*/
wxString GetLastNetListRead();
/**
* Set the last net list successfully read by the net list dialog box.
*
* Note: the file path is converted to a path relative to the project file path. If
* the path cannot be made relative, than m_lastNetListRead is set to and empty
* string. This could happen when the net list file is on a different drive than
* the project file. The advantage of relative paths is that is more likely to
* work when opening the same project from both Windows and Linux.
*
* @param aNetListFile - The last net list file with full path successfully read.
*/
void SetLastNetListRead( const wxString& aNetListFile );
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
/**
* 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 );
/**
* Function OnHotkeyDeleteItem
* Delete the item found under the mouse cursor
* Depending on the current active tool::
* Tool track
* if a track is in progress: Delete the last segment
* else delete the entire track
* Tool module (footprint):
* Delete the module.
* @param aDC = current device context
* @return true if an item was deleted
*/
bool OnHotkeyDeleteItem( wxDC* aDC );
/**
* Function OnHotkeyPlaceItem
* Place the item (footprint, track, text .. ) found under the mouse cursor
* An item can be placed only if there is this item currently edited
* Only a footprint, a pad or a track can be placed
* @param aDC = current device context
* @return true if an item was placed
*/
bool OnHotkeyPlaceItem( wxDC* aDC );
bool OnHotkeyEditItem( int aIdCommand );
/**
* Function OnHotkeyCopyItem
* returns the copy event id for copyable items.
* @return Event id of a suitable copy event, zero when no copyable item found.
*/
int OnHotkeyCopyItem();
/**
* Function OnHotkeyDuplicateOrArrayItem
* Duplicate an item (optionally incrementing if necessary and possible)
* or invoke array dialog and create an array
* @param aIdCommand = the hotkey command id
* @return true if item duplicated or arrayed
*/
bool OnHotkeyDuplicateOrArrayItem( int aIdCommand );
/**
* Function OnHotkeyMoveItem
* Moves or drag the item (footprint, track, text .. ) found under the mouse cursor
* Only a footprint or a track can be dragged
* @param aIdCommand = the hotkey command id
* @return true if an item was moved
*/
bool OnHotkeyMoveItem( int aIdCommand );
/**
* Function OnHotkeyRotateItem
* Rotate the item (text or footprint) found under the mouse cursor
* @note This command can be used with an item currently in edit.
* Only some items can be rotated (footprints and texts).
* @param aIdCommand = the hotkey command id
* @return true if an item was moved
*/
bool OnHotkeyRotateItem( int aIdCommand );
/**
* Function OnHotkeyFlipItem
* Flip the item (text or footprint) found under the mouse cursor
* @note This command can be used with an item currently in edit.
* Only some items can be rotated (footprints and texts).
* @param aIdCommand = the hotkey command id
* @return true if an item was moved
*/
bool OnHotkeyFlipItem( int aIdCommand );
/**
* Function OnHotkeyBeginRoute
* If the current active layer is a copper layer,
* and if no item currently edited, start a new track segmenton
* the current copper layer.
* If a new track is in progress, terminate the current segment and
* start a new one.
* @param aDC = current device context
* @return a reference to the track if a track is created, or NULL
*/
TRACK * OnHotkeyBeginRoute( wxDC* aDC );
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
/**
* Function OnResetModuleTextSizes
* resets text size and width of all module text fields of given field
* type to current settings in Preferences
*/
void OnResetModuleTextSizes( wxCommandEvent& event );
void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateAuxiliaryToolbar();
void ReCreateVToolbar();
void ReCreateMicrowaveVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
/**
* Re create the layer Box by clearing the old list, and building
* le new one, from the new layers names and cole layers
* @param aForceResizeToolbar = true to resize the parent toolbar
* false if not needed (mainly in parent toolbar creation,
* or when the layers names are not modified)
*/
void ReCreateLayerBox( bool aForceResizeToolbar = true );
/**
* Function SetCurrentNetClass
* Must be called after a netclass selection (or after a netclass parameter change
* calls BOARD_DESIGN_SETTINGS::SetCurrentNetClass() and update trace width and via size
* combo boxes on main toolbar
* Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar
* and some others parameters (netclass name ....)
* @param aNetClassName = the new netclass name
* @return true if lists of tracks and vias sizes are modified
*/
bool SetCurrentNetClass( const wxString& aNetClassName );
/**
* Function OnModify
* must be called after a board change to set the modified flag.
* <p>
* Reloads the 3D view if required and calls the base PCB_BASE_FRAME::OnModify function
* to update auxiliary information.
* </p>
*/
virtual void OnModify();
/**
* Function SetActiveLayer
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
virtual void SetActiveLayer( LAYER_ID aLayer );
/**
* Function IsElementVisible
* tests whether a given element category is visible. Keep this as an
* inline function.
* @param aElement is from the enum by the same name
* @return bool - true if the element is visible.
* @see enum PCB_VISIBLE
*/
bool IsElementVisible( int aElement ) const;
/**
* Function SetElementVisibility
* changes the visibility of an element category
* @param aElement is from the enum by the same name
* @param aNewState = The new visibility state of the element category
* @see enum PCB_VISIBLE
*/
void SetElementVisibility( int aElement, bool aNewState );
/**
* Function SetVisibleAlls
* Set the status of all visible element categories and layers to VISIBLE
*/
void SetVisibleAlls();
/**
* Function ReFillLayerWidget
* changes out all the layers in m_Layers and may be called upon
* loading a new BOARD.
*/
void ReFillLayerWidget();
/**
* Function Show3D_Frame
* displays the 3D view of current printed circuit board.
*/
void Show3D_Frame( wxCommandEvent& event );
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
void UseGalCanvas( bool aEnable );
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
/**
* Function ShowDesignRulesEditor
* displays the Design Rules Editor.
*/
void ShowDesignRulesEditor( wxCommandEvent& event );
/* toolbars update UI functions: */
void PrepareLayerIndicator();
/* mouse functions events: */
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
/**
* Function OnRightClick
* populates a popup menu with the choices appropriate for the current context.
* The caller will add the ZOOM menu choices afterward.
* @param aMousePos The current mouse position
* @param aPopMenu The menu to add to.
*/
bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
/**
* Function SaveCopyInUndoList.
* Creates a new entry in undo list of commands.
* add a picker to handle aItemToCopy
* @param aItemToCopy = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
* @param aTransformPoint = the reference point of the transformation, for
* commands like move
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
UNDO_REDO_T aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
/**
* Function SaveCopyInUndoList (overloaded).
* Creates a new entry in undo list of commands.
* add a list of pickers to handle a list of items
* @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
* @param aTransformPoint = the reference point of the transformation, for
* commands like move
*/
virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
UNDO_REDO_T aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
/**
* Function PutDataInPreviousState
* Used in undo or redo command.
* Put data pointed by List in the previous state, i.e. the state memorized by List
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
* @param aRedoCommand = a bool: true for redo, false for undo
* @param aRebuildRatsnet = a bool: true to rebuild ratsnest (normal use), false
* to just retrieve last state (used in abort commands that do not need to
* rebuild ratsnest)
*/
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList,
bool aRedoCommand,
bool aRebuildRatsnet = true );
/**
* Function RestoreCopyFromRedoList
* Redo the last edition:
* - Save the current board in Undo list
* - Get an old version of the board from Redo list
* @return none
*/
void RestoreCopyFromRedoList( wxCommandEvent& aEvent );
/**
* Function RestoreCopyFromUndoList
* Undo the last edition:
* - Save the current board in Redo list
* - Get an old version of the board from Undo list
* @return none
*/
void RestoreCopyFromUndoList( wxCommandEvent& aEvent );
/* Block operations: */
/**
* Function BlockCommand
* Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...)
* corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when
* block command is started by dragging the mouse.
* @param aKey = the key modifiers (Alt, Shift ...)
* @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
*/
virtual int BlockCommand( int aKey );
/**
* Function HandleBlockPlace()
* Called after HandleBlockEnd, when a block command needs to be
* executed after the block is moved to its new place
* (bloc move, drag, copy .. )
* Parameters must be initialized in GetScreen()->m_BlockLocate
*/
virtual void HandleBlockPlace( wxDC* DC );
/**
* Function HandleBlockEnd()
* Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
virtual bool HandleBlockEnd( wxDC* DC );
/**
* Function Block_SelectItems
* Uses GetScreen()->m_BlockLocate
* select items within the selected block.
* selected items are put in the pick list
*/
void Block_SelectItems();
/**
* Function Block_Delete
* deletes all items within the selected block.
*/
void Block_Delete();
/**
* Function Block_Rotate
* Rotate all items within the selected block.
* The rotation center is the center of the block
*/
void Block_Rotate();
/**
* Function Block_Flip
* Flip items within the selected block.
* The flip center is the center of the block
*/
void Block_Flip();
/**
* Function Block_Move
* move all items within the selected block.
* New location is determined by the current offset from the selected
* block's original location.
*/
void Block_Move();
/**
* Function Block_Mirror_X
* mirrors all items within the currently selected block in the X axis.
*/
void Block_Mirror_X();
/**
* Function Block_Duplicate
* Duplicate all items within the selected block.
* New location is determined by the current offset from the selected
* block's original location.
*/
void Block_Duplicate( bool aIncrement );
void Process_Settings( wxCommandEvent& event );
void OnConfigurePcbOptions( wxCommandEvent& aEvent );
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
/**
* Function GenFootprintsPositionFile
* Calls DoGenFootprintsPositionFile to create a footprint position file
* See DoGenFootprintsPositionFile for options and file format
*/
void GenFootprintsPositionFile( wxCommandEvent& event );
/**
* Function DoGenFootprintsPositionFile
* Creates an ascii footprint position file
* @param aFullFileName = the full file name of the file to create
* @param aUnitsMM = false to use inches, true to use mm in coordinates
* @param aForceSmdItems = true to force all footprints with smd pads in list
* = false to put only footprints with option "INSERT" in list
* @param aSide = 0 to list footprints on BACK side,
* 1 to list footprints on FRONT side
* 2 to list footprints on both sides
* @return the number of footprints found on aSide side,
* or -1 if the file could not be created
*/
int DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM,
bool aForceSmdItems, int aSide );
/**
* Function GenFootprintsReport
* Calls DoGenFootprintsReport to create a footprint reprot file
* See DoGenFootprintsReport for file format
*/
void GenFootprintsReport( wxCommandEvent& event );
/**
* Function DoGenFootprintsReport
* Creates an ascii footprint report file giving some infos on footprints
* and board outlines
* @param aFullFilename = the full file name of the file to create
* @param aUnitsMM = false to use inches, true to use mm in coordinates
* @return true if OK, false if error
*/
bool DoGenFootprintsReport( const wxString& aFullFilename, bool aUnitsMM );
void InstallDrillFrame( wxCommandEvent& event );
void GenD356File( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
/**
* Function Files_io
* @param event is the command event handler.
* do nothing else than call Files_io_from_id with the
* wxCommandEvent id
*/
void Files_io( wxCommandEvent& event );
/**
* Function Files_io_from_id
* Read and write board files
* @param aId is an event ID ciming from file command events:
* ID_LOAD_FILE
* ID_MENU_READ_BOARD_BACKUP_FILE
* ID_MENU_RECOVER_BOARD_AUTOSAVE
* ID_APPEND_FILE
* ID_NEW_BOARD
* ID_SAVE_BOARD
* ID_COPY_BOARD_AS
* ID_SAVE_BOARD_AS
* Files_io_from_id prepare parameters and calls the specialized function
*/
void Files_io_from_id( int aId );
/**
* Function OpenProjectFiles (was LoadOnePcbFile)
* loads a KiCad board (.kicad_pcb) from \a aFileName.
*
* @param aFileSet - hold the BOARD file to load, a vector of one element.
*
* @param aCtl - KICTL_ bits, one to indicate that an append of the board file
* aFileName to the currently loaded file is desired.
* @see #KIWAY_PLAYER for bit defines.
*
* @return bool - false if file load fails, otherwise true.
bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
bool aForceFileDialog = false );
*/
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 );
/**
* Function AppendBoardFile
* appends a board file onto the current one, creating God knows what.
* the main purpose is only to allow panelizing boards.
*/
bool AppendBoardFile( const wxString& aFullFileName, int aCtl );
/**
* Function SavePcbFile
* writes the board data structures to \a a aFileName
* Creates backup when requested and update flags (modified and saved flgs)
*
* @param aFileName The file name to write or wxEmptyString to prompt user for
* file name.
* @param aCreateBackupFile Creates a back of \a aFileName if true. Helper
* definitions #CREATE_BACKUP_FILE and #NO_BACKUP_FILE
* are defined for improved code readability.
* @return True if file was saved successfully.
*/
bool SavePcbFile( const wxString& aFileName, bool aCreateBackupFile = CREATE_BACKUP_FILE );
/**
* Function SavePcbCopy
* writes the board data structures to \a a aFileName
* but unlike SavePcbFile, does not make anything else
* (no backup, borad fliename change, no flag changes ...)
* Used under a project mgr to save under a new name the current board
*
* When not under a project mgr, the full SavePcbFile is used.
* @param aFileName The file name to write.
* @return True if file was saved successfully.
*/
bool SavePcbCopy( const wxString& aFileName );
// BOARD handling
/**
* Function Clear_Pcb
* delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to initialize silently
*/
bool Clear_Pcb( bool aQuery );
///> @copydoc PCB_BASE_FRAME::SetBoard()
void SetBoard( BOARD* aBoard );
///> @copydoc PCB_BASE_FRAME::SetPageSettings()
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload
// Drc control
/* function GetDrcController
* @return the DRC controller
*/
DRC* GetDrcController() { return m_drc; }
/**
* Function RecreateBOMFileFromBoard
* Recreates a .cmp file from the current loaded board
* this is the same as created by CvPcb.
* can be used if this file is lost
*/
void RecreateCmpFileFromBoard( wxCommandEvent& aEvent );
/**
* Function ArchiveModulesOnBoard
* Save modules in a library:
* @param aStoreInNewLib:
* true : save modules in a existing lib. Existing footprints will be kept
* or updated.
* This lib should be in fp lib table, and is type is .pretty
* false: save modules in a new lib. It it is an existing lib,
* previous footprints will be removed
*/
void ArchiveModulesOnBoard( bool aStoreInNewLib );
/**
* Function RecreateBOMFileFromBoard
* Creates a BOM file from the current loaded board
*/
void RecreateBOMFileFromBoard( wxCommandEvent& aEvent );
/**
* Function ExportToGenCAD
* creates a file in GenCAD 1.4 format from the current board.
*/
void ExportToGenCAD( wxCommandEvent& event );
/**
* Function OnExportVRML
* will export the current BOARD to a VRML file.
*/
void OnExportVRML( wxCommandEvent& event );
/**
* Function ExportVRML_File
* Creates the file(s) exporting current BOARD to a VRML file.
*
* @note When copying 3D shapes files, the new filename is build from the full path
* name, changing the separators by underscore. This is needed because files
* with the same shortname can exist in different directories
* @note ExportVRML_File generates coordinates in board units (BIU) inside the file.
* @todo Use mm inside the file. A general scale transform is applied to the whole
* file (1.0 to have the actual WRML unit im mm, 0.001 to have the actual WRML
* unit in meters.
* @note For 3D models built by a 3D modeler, the unit is 0,1 inches. A specific scale
* is applied to 3D models to convert them to internal units.
*
* @param aFullFileName = the full filename of the file to create
* @param aMMtoWRMLunit = the VRML scaling factor:
* 1.0 to export in mm. 0.001 for meters
* @param aExport3DFiles = true to copy 3D shapes in the subir a3D_Subdir
* @param aUseRelativePaths set to true to use relative paths instead of absolute paths
* in the board VRML file URLs.
* @param aUsePlainPCB set to true to export a board with no copper or silkskreen;
* this is useful for generating a VRML file which can be
* converted to a STEP model.
* @param a3D_Subdir = sub directory where 3D shapes files are copied. This is only used
* when aExport3DFiles == true
* @param aXRef = X value of PCB (0,0) reference point
* @param aYRef = Y value of PCB (0,0) reference point
* @return true if Ok.
*/
bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit,
bool aExport3DFiles, bool aUseRelativePaths,
bool aUsePlainPCB, const wxString & a3D_Subdir,
double aXRef, double aYRef );
/**
* Function ExportToIDF3
* will export the current BOARD to a IDFv3 board and lib files.
*/
void ExportToIDF3( wxCommandEvent& event );
/**
* Function ExporttoSPECCTRA
* Ask for a filename and call ExportSpecctraFile to export the current BOARD
* to a specctra dsn file.
*/
void ExportToSpecctra( wxCommandEvent& event );
/**
* Function ExportSpecctraFile
* will export the current BOARD to a specctra dsn file.
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
* specification.
* @return true if OK
*/
bool ExportSpecctraFile( const wxString& aFullFilename );
/**
* Function ImportSpecctraSession
* will import a specctra *.ses file and use it to relocate MODULEs and
* to replace all vias and tracks in an existing and loaded BOARD.
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
* specification.
*/
void ImportSpecctraSession( wxCommandEvent& event );
/**
* Function ImportSpecctraDesign
* will import a specctra *.dsn file and use it to replace an entire BOARD.
* The new board will not have any graphics, only components, tracks and
* vias.
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
* specification.
*/
void ImportSpecctraDesign( wxCommandEvent& event );
/**
* Function Access_to_External_Tool
* Run an external tool (like freeroute )
*/
void Access_to_External_Tool( wxCommandEvent& event );
/**
* Function ListAndSelectModuleName
* builds and shows a list of existing modules on board that the user can select.
* @return a pointer to the selected module or NULL.
*/
MODULE* ListAndSelectModuleName();
/**
* Function ListNetsAndSelect
* called by a command event
* displays the sorted list of nets in a dialog frame
* If a net is selected, it is highlighted
*/
void ListNetsAndSelect( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event );
// Handling texts on the board
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC );
TEXTE_PCB* CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText = NULL );
void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aErase = true );
void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC );
// Graphic Segments type DRAWSEGMENT
void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC );
// Footprint edition (see also PCB_BASE_FRAME)
void InstallModuleOptionsFrame( MODULE* Module, wxDC* DC );
/**
* Function StartMoveModule
* Initialize a drag or move pad command
* @param aModule = the module to move or drag
* @param aDC = the current device context
* @param aDragConnectedTracks = true to drag connected tracks,
* false to just move the module
*/
void StartMoveModule( MODULE* aModule, wxDC* aDC, bool aDragConnectedTracks );
/**
* Function DlgGlobalChange_PadSettings
* Function to change pad caracteristics for the given footprint
* or all footprints which look like the given footprint
* Options are set by the opened dialog.
* @param aPad is the pattern. The given footprint is the parent of this pad
* @param aRedraw: if true: redraws the footprint
*/
void DlgGlobalChange_PadSettings( D_PAD* aPad, bool aRedraw );
/**
* Function Delete Module
* Remove a footprint from m_Modules linked list and put it in undelete buffer
* The ratsnest and pad list are recalculated
* @param aModule = footprint to delete
* @param aDC = currentDevice Context. if NULL: do not redraw new ratsnest
*/
bool Delete_Module( MODULE* aModule, wxDC* aDC );
/**
* Function Change_Side_Module
* Flip a footprint (switch layer from component or component to copper)
* The mirroring is made from X axis
* if a footprint is not on copper or component layer it is not flipped
* (it could be on an adhesive layer, not supported at this time)
* @param Module the footprint to flip
* @param DC Current Device Context. if NULL, no redraw
*/
void Change_Side_Module( MODULE* Module, wxDC* DC );
int InstallExchangeModuleFrame( MODULE* ExchangeModuleModule );
/**
* Function Exchange_Module
* Replaces OldModule by NewModule, using OldModule settings:
* position, orientation, pad netnames ...)
* OldModule is deleted or put in undo list.
* @param aOldModule = footprint to replace
* @param aNewModule = footprint to put
* @param aUndoPickList = the undo list used to save OldModule. If null,
* OldModule is deleted
*/
void Exchange_Module( MODULE* aOldModule, MODULE* aNewModule,
PICKED_ITEMS_LIST* aUndoPickList );
// loading modules: see PCB_BASE_FRAME
// Board handling
void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
/**
* Function OnEditItemRequest
* Install the corresponding dialog editor for the given item
* @param aDC = the current device context
* @param aItem = a pointer to the BOARD_ITEM to edit
*/
void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem );
/**
* Locate track or pad and highlight the corresponding net.
* @return The Netcode, or -1 if no net located.
*/
int SelectHighLight( wxDC* DC );
/**
* Function HighLight.
* highlights the net at the current cursor position.
*/
void HighLight( wxDC* DC );
// Track and via edition:
void Via_Edit_Control( wxCommandEvent& event );
/**
* Function IsMicroViaAcceptable
* return true if a microvia can be placed on the board.
* <p>
* A microvia is a small via restricted to 2 near neighbor layers
* because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer
* </p>
*/
bool IsMicroViaAcceptable( void );
/**
* Function Other_Layer_Route
* operates in one of two ways. If argument track is NULL, then swap the
* active layer between m_Route_Layer_TOP and m_Route_Layer_BOTTOM. If a
* track is in progress (track is not NULL), and if DRC allows it, place
* a via on the end of the current track, and then swap the current active
* layer and start a new segment on the new layer.
* @param track A TRACK* to append the via to or NULL.
* @param DC A device context to draw on.
* @return bool - true if the operation was successful, else false such as
* the case where DRC would not allow a via.
*/
bool Other_Layer_Route( TRACK* track, wxDC* DC );
void HighlightUnconnectedPads( wxDC* DC );
/**
* Function Delete_Segment
* removes a track segment.
* If a new track is in progress: delete the current new segment.
* Otherwise, delete segment under the mouse cursor.
*/
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
void Delete_Track( wxDC* DC, TRACK* Track );
void Delete_net( wxDC* DC, TRACK* Track );
/**
* Function Remove_One_Track
* removes 1 track/
* The leading segment is removed and all adjacent segments
* until a pad or a junction point of more than 2 segments is found
*/
void Remove_One_Track( wxDC* DC, TRACK* pt_segm );
/**
* Function Reset_All_Tracks_And_Vias_To_Netclass_Values
* Reset all tracks width and/or vias diameters and drill
* to their default Netclass value
* @param aTrack : bool true to modify tracks
* @param aVia : bool true to modify vias
*/
bool Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia );
/**
* Function Change_Net_Tracks_And_Vias_Sizes
* Reset all tracks width and vias diameters and drill
* to their default Netclass value or current values
* @param aNetcode : the netcode of the net to edit
* @param aUseNetclassValue : bool. True to use netclass values, false to
* use current values
*/
bool Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue );
/**
* Function Edit_Track_Width
* Modify a full track width (using DRC control).
* a full track is the set of track segments between 2 ends: pads or a
* point that has more than 2 segments ends connected
* @param aDC = the curred device context (can be NULL)
* @param aTrackSegment = a segment or via on the track to change
*/
void Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment );
/**
* Function Edit_TrackSegm_Width
* Modify one track segment width or one via diameter (using DRC control).
* @param aDC = the current device context (can be NULL)
* @param aTrackItem = the track segment or via to modify
*/
void Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem );
/**
* Function Begin_Route
* Starts a new track and/or establish of a new track point.
*
* For a new track:
* - Search the netname of the new track from the starting point
* if it is on a pad or an existing track
* - Highlight all this net
* If a track is in progress:
* - Call DRC
* - If DRC is OK: finish the track segment and starts a new one.
* @param aTrack = the current track segment, or NULL to start a new track
* @param aDC = the current device context
* @return a pointer to the new track segment or null if not created (DRC error)
*/
TRACK* Begin_Route( TRACK* aTrack, wxDC* aDC );
/**
* Function End_Route
* Terminates a track currently being created
* @param aTrack = the current track segment in progress
* @param aDC = the current device context
* @return true if the track was created, false if not (due to a DRC error)
*/
bool End_Route( TRACK* aTrack, wxDC* aDC );
void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On );
void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On );
void Attribut_net( wxDC* DC, int net_code, bool Flag_On );
/**
* Function StartMoveOneNodeOrSegment
* initializes the parameters to move one via or/and a terminal point of a track segment
* The terminal point of other connected segments (if any) are moved too.
*/
void StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aCommand );
bool PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC );
/**
* @todo This function is broken, because it merge segments having different
* widths or without any connectivity test.
* 2 collinear segments can be merged only if no other segment or via is
* connected to the common point and if they have the same width. See
* cleanup.cpp for merge functions and consider MarkTrace() to locate segments
* that can be merged
*/
bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, LAYER_ID layer );
/**
* Function Add45DegreeSegment
* adds a track segment between 2 tracks segments if these 2 segments
* make a 90 deg angle, in order to have 45 deg track segments
* Its only works on horizontal or vertical segments.
*
* @param aDC The wxDC device context to draw on.
* @return A bool value true if ok or false if not.
*/
bool Add45DegreeSegment( wxDC* aDC );
/**
* Function EraseRedundantTrack
* Called after creating a track
* Remove (if exists) the old track that have the same starting and the
* same ending point as the new created track
* (this is the redunding track)
* @param aDC = the current device context (can be NULL)
* @param aNewTrack = the new created track (a pointer to a segment of the
* track list)
* @param aNewTrackSegmentsCount = number of segments in this new track
* @param aItemsListPicker = the list picker to use for an undo command
* (can be NULL)
*/
int EraseRedundantTrack( wxDC* aDC,
TRACK* aNewTrack,
int aNewTrackSegmentsCount,
PICKED_ITEMS_LIST* aItemsListPicker );
/**
* Function SetTrackSegmentWidth
* Modify one track segment width or one via diameter (using DRC control).
* Basic routine used by other routines when editing tracks or vias
* @param aTrackItem = the track segment or via to modify
* @param aItemsListPicker = the list picker to use for an undo command
* (can be NULL)
* @param aUseNetclassValue = true to use NetClass value, false to use
* current designSettings value
* @return true if done, false if no not change (because DRC error)
*/
bool SetTrackSegmentWidth( TRACK* aTrackItem,
PICKED_ITEMS_LIST* aItemsListPicker,
bool aUseNetclassValue );
// zone handling
/**
* Function Delete_OldZone_Fill (obsolete)
* Used for compatibility with old boards
* Remove the zone filling which include the segment aZone, or the zone
* which have the given time stamp.
* For old boards, a zone is a group of SEGZONE segments which have the same TimeStamp
* @param aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone ==
* NULL
*/
void Delete_OldZone_Fill( SEGZONE* aZone, time_t aTimestamp = 0 );
/**
* Function Delete_LastCreatedCorner
* Used only while creating a new zone outline
* Remove and delete the current outline segment in progress
* @return 0 if no corner in list, or corner number
*/
int Delete_LastCreatedCorner( wxDC* DC );
/**
* Function Begin_Zone
* either initializes the first segment of a new zone, or adds an
* intermediate segment.
* A new zone can be:
* created from scratch: the user will be prompted to define parameters (layer, clearence ...)
* created from a similar zone (s_CurrentZone is used): parameters are copied from
* s_CurrentZone
* created as a cutout (an hole) inside s_CurrentZone
*/
int Begin_Zone( wxDC* DC );
/**
* Function End_Zone
* terminates (if no DRC error ) the zone edge creation process
* @param DC = current Device Context
* @return true if Ok, false if DRC error
*/
bool End_Zone( wxDC* DC );
/**
* Function Fill_Zone
* Calculate the zone filling for the outline zone_container
* The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks.
* If exists the old filling is removed
* @param aZone = zone to fill
* @return error level (0 = no error)
*/
int Fill_Zone( ZONE_CONTAINER* aZone );
/**
* Function Fill_All_Zones
* Fill all zones on the board
* The old fillings are removed
* @param aActiveWindow = the current active window, if a progress bar is shown
* = NULL to do not display a progress bar
* @param aVerbose = true to show error messages
*/
int Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose = true );
/**
* Function Add_Zone_Cutout
* Add a cutout zone to a given zone outline
* @param DC = current Device Context
* @param zone_container = parent zone outline
*/
void Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Add_Similar_Zone
* Add a zone to a given zone outline.
* if the zones are overlapping they will be merged
* @param DC = current Device Context
* @param zone_container = parent zone outline
*/
void Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Edit_Zone_Params
* Edit params (layer, clearance, ...) for a zone outline
*/
void Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Start_Move_Zone_Corner
* Prepares a move corner in a zone outline,
* called from a move corner command (IsNewCorner = false),
* or a create new cornet command (IsNewCorner = true )
*/
void Start_Move_Zone_Corner( wxDC* DC,
ZONE_CONTAINER* zone_container,
int corner_id,
bool IsNewCorner );
/**
* Function Start_Move_Zone_Corner
* Prepares a drag edge in an existing zone outline,
*/
void Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
ZONE_CONTAINER* zone_container,
int corner_id );
/**
* Function End_Move_Zone_Corner_Or_Outlines
* Terminates a move corner in a zone outline, or a move zone outlines
* @param DC = current Device Context (can be NULL)
* @param zone_container: the given zone
*/
void End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function End_Move_Zone_Corner_Or_Outlines
* Remove the currently selected corner in a zone outline
* the .m_CornerSelection is used as corner selection
*/
void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Delete_Zone
* Remove the zone which include the segment aZone, or the zone which have
* the given time stamp. A zone is a group of segments which have the
* same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param zone_container = zone to modify
* the member .m_CornerSelection is used to find the outline to remove.
* if the outline is the main outline, all the zone is removed
* otherwise, the hole is deleted
*/
void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Start_Move_Zone_Outlines
* Initialize parameters to move an existing zone outlines.
* @param DC = current Device Context (can be NULL)
* @param zone_container: the given zone to move
*/
void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
// Target handling
PCB_TARGET* CreateTarget( wxDC* DC );
void DeleteTarget( PCB_TARGET* aTarget, wxDC* DC );
void BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC );
void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC );
void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC );
// Graphic segments type DRAWSEGMENT handling:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( LAYER_ID aLayer );
// Dimension handling:
void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );
DIMENSION* EditDimension( DIMENSION* aDimension, wxDC* aDC );
void DeleteDimension( DIMENSION* aDimension, wxDC* aDC );
void BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC );
void PlaceDimensionText( DIMENSION* aItem, wxDC* DC );
// netlist handling:
void InstallNetlistFrame( wxDC* DC );
/**
* Function ReadPcbNetlist
* reads \a aNetlistFileName and updates the footprints (load missing footprints and
* delete on demand extra footprints) on the board.
* Update connectivity info, references, values and "TIME STAMP"
*
* @param aNetlistFileName = netlist file name (*.net)
* @param aCmpFileName = cmp/footprint link file name (*.cmp).
* if not found or empty, only the netlist will be used
* @param aReporter is a pointer to a #REPORTER object to write display messages.
* can be NULL.
* @param aChangeFootprint if true, footprints that have changed in netlist will be changed
* @param aDeleteBadTracks if true, erroneous tracks will be deleted
* @param aDeleteExtraFootprints if true, remove unlocked footprints that are not in netlist
* @param aSelectByTimestamp if true, use timestamp instead of reference to identify
* footprints from components (use after reannotation of the
* schematic)
* @param aDeleteSinglePadNets if true, remove nets counting only one pad
* and set net code to 0 for these pads
* @param aIsDryRun performs a dry run without making any changes if true.
*/
void ReadPcbNetlist( const wxString& aNetlistFileName,
const wxString& aCmpFileName,
REPORTER* aReporter,
bool aChangeFootprint,
bool aDeleteBadTracks,
bool aDeleteExtraFootprints,
bool aSelectByTimestamp,
bool aDeleteSinglePadNets,
bool aIsDryRun );
/**
* Function RemoveMisConnectedTracks
* finds all track segments which are mis-connected (to more than one net).
* When such a bad segment is found, it is flagged to be removed.
* All tracks having at least one flagged segment are removed.
* @return true if any change is made
*/
bool RemoveMisConnectedTracks();
// Autoplacement:
void OnPlaceOrRouteFootprints( wxCommandEvent& event );
/**
* Function ScriptingConsoleEnableDisable
* enables or disabled the scripting console
*/
void ScriptingConsoleEnableDisable( wxCommandEvent& aEvent );
void OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent );
void OnSelectAutoPlaceMode( wxCommandEvent& aEvent );
/**
* Function OnOrientFootprints
* install the dialog box for the common Orient Footprints
*/
void OnOrientFootprints( wxCommandEvent& event );
/**
* Function ReOrientModules
* Set the orientation of footprints
* @param ModuleMask = mask (wildcard allowed) selection
* @param Orient = new orientation
* @param include_fixe = true to orient locked footprints
* @return true if some footprints modified, false if no change
*/
bool ReOrientModules( const wxString& ModuleMask, double Orient, bool include_fixe );
void LockModule( MODULE* aModule, bool aLocked );
/**
* Function SpreadFootprints
* Footprints (after loaded by reading a netlist for instance) are moved
* to be in a small free area (outside the current board) without overlapping.
* @param aFootprintsOutsideBoardOnly: true to move only
* footprints outside the board outlines
* (they are outside if the position of a footprint is outside
* the board outlines bounding box
*/
void SpreadFootprints( bool aFootprintsOutsideBoardOnly );
/**
* Function AutoPlaceModule
* automatically places footprints within the confines of the PCB edges.
* The components with the FIXED status are not moved. If the menu is
* calling the placement of 1 module, it will be replaced.
*/
void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC );
// Autorouting:
int Solve( wxDC* DC, int two_sides );
void Reset_Noroutable( wxDC* DC );
void Autoroute( wxDC* DC, int mode );
void ReadAutoroutedTracks( wxDC* DC );
void GlobalRoute( wxDC* DC );
/**
* Function Show_1_Ratsnest
* draw ratsnest.
*
* The net edge pad with mouse or module locates the mouse.
* Delete the ratsnest if no module or pad is selected.
*/
void Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC );
/**
* Function Clean_Pcb
* Clean up the board (remove redundant vias, not connected tracks
* and merges collinear track segments)
* Install the cleanup dialog frame to know what should be cleaned
* and run the cleanup function
*/
void Clean_Pcb();
void InstallFindFrame();
/**
* Function SendMessageToEESCHEMA
* sends a message to the schematic editor so that it may move its cursor
* to a part with the same reference as the objectToSync
* @param objectToSync The object whose reference is used to synchronize Eeschema.
*/
void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
/**
* Function Edit_Gap
* edits the GAP module if it has changed the position and/or size of the pads that
* form the gap get a new value.
*/
void Edit_Gap( wxDC* DC, MODULE* Module );
/**
* Function CreateMuWaveBaseFootprint
* create a basic footprint for micro wave applications.
* @param aValue = the text value
* @param aTextSize = the size of ref and value texts ( <= 0 to use board default values )
* @param aPadCount = number of pads
* Pads settings are:
* PAD_ATTRIB_SMD, rectangular, H size = V size = current track width.
*/
MODULE* CreateMuWaveBaseFootprint( const wxString& aValue, int aTextSize, int aPadCount );
/**
* Create_MuWaveComponent
* creates a module "GAP" or "STUB" used in micro wave designs.
* This module has 2 pads:
* PAD_ATTRIB_SMD, rectangular, H size = V size = current track width.
* the "gap" is isolation created between this 2 pads
*/
MODULE* Create_MuWaveComponent( int shape_type );
MODULE* Create_MuWavePolygonShape();
void Begin_Self( wxDC* DC );
/**
* Function Genre_Self
* creates a self-shaped coil for microwave applications.
* - Length Mself.lng
* - Extremities Mself.m_Start and Mself.m_End
*
* We must determine:
* Mself.nbrin = number of segments perpendicular to the direction
* (The coil nbrin will demicercles + 1 + 2 1 / 4 circle)
* Mself.lbrin = length of a strand
* Mself.radius = radius of rounded parts of the coil
* Mself.delta = segments extremities connection between him and the coil even
*
* The equations are
* Mself.m_Size.x = 2 * Mself.radius + Mself.lbrin
* Mself.m_Size.y * Mself.delta = 2 + 2 * Mself.nbrin * Mself.radius
* Mself.lng = 2 * Mself.delta / / connections to the coil
+ (Mself.nbrin-2) * Mself.lbrin / / length of the strands except 1st and last
+ (Mself.nbrin 1) * (PI * Mself.radius) / / length of rounded
* Mself.lbrin + / 2 - Melf.radius * 2) / / length of 1st and last bit
*
* The constraints are:
* Nbrin >= 2
* Mself.radius < Mself.m_Size.x
* Mself.m_Size.y = Mself.radius * 4 + 2 * Mself.raccord
* Mself.lbrin> Mself.radius * 2
*
* The calculation is conducted in the following way:
* Initially:
* Nbrin = 2
* Radius = 4 * m_Size.x (arbitrarily fixed value)
* Then:
* Increasing the number of segments to the desired length
* (Radius decreases if necessary)
*
*/
MODULE* Genere_Self( wxDC* DC );
void ShowChangedLanguage(); // override EDA_BASE_FRAME virtual
/**
* Function UpdateTitle
* sets the main window title bar text.
* <p>
* If file name defined by PCB_SCREEN::m_FileName is not set, the title is set to the
* application name appended with no file. Otherwise, the title is set to the full path
* and file name and read only is appended to the title if the user does not have write
* access to the file.
* </p>
*/
void UpdateTitle();
DECLARE_EVENT_TABLE()
};
#endif // WXPCB_STRUCT_H_
|