Commit Graph

358 Commits

Author SHA1 Message Date
Maciej Suminski 0aad86435f Adjust iterator after erasing an element 2016-08-10 12:17:56 +02:00
Dick Hollenbeck 7434e68876 Pcbnew: improved track scripting support. 2016-07-19 16:34:09 -04:00
Dick Hollenbeck e24990146d Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.

* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
  These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
  and C++ so that the resultant type name is common in both languages, and
  the types AGREE.

* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.

* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
  NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
  comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.

* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
  Having the name consistent between like types is helpful, and between
  languages.  std::map<> ends up as SOMETHING_MAP.

* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
  instead of hashtables, because swig does not yet support std::unordered_map.

* You can now get to any netclass or net info.   NETNAMES_MAP and NETCODES_MAP
  are traversable basically the same as a python dictionary using a python
  string (not wsString) as the key!  The wxString typemap converts python
  string to wxString before the lookup happens.  Iteration also works.
2016-07-18 13:23:09 -04:00
Dick Hollenbeck c2b8a4ee43 Move from class INSPECTOR as the EDA_ITEM::Visit() callback interface to a std::function
callback.  This improves conciseness and encourages use of Visit() due to the lower cost
of entry in C++.
2016-07-12 15:05:54 -04:00
jean-pierre charras e2cc78b2b5 Code cleanup: remove dead code (some removed methods were broken), and update or add comments. 2016-06-01 11:28:07 +02:00
jean-pierre charras 53c031257d Fix a few shadowed local vars, and coding style issues. 2016-04-22 12:44:08 +02:00
Chris Pavlina 2777182a2c pcbnew: fix Duplicate assertion
Do not assert that the item to be duplicated can be duplicated, just don't
duplicate it. The user can trigger a Duplicate on items that aren't
duplicatable, like field texts - he'll figure out that they can't be duplicated
when they aren't, no need to deliver a scary warning and risk an abort.

TODO: Don't pick up the duplicated selection if none of the items in it were
actually duplicated, it's misleading.
2016-03-18 06:28:11 -04:00
Tomasz Wlostowski ee3418e90b One-click PCB update improvements
- Fix repetitive undo/redo segfaults & assertions.
- Add Update menu entry on PCB side.
- Fix Python build error
- Add spread footprints after updating
2016-01-29 15:43:40 +01:00
Tomasz Wlostowski 5ef6001e06 pcbnew: support for removing NETINFO_ITEMS from BOARD for proper netlist undo 2016-01-29 11:29:56 +01:00
Tomasz Wlostowski 9e609acae3 made netlist entries and netlist update undoable 2016-01-29 11:21:13 +01:00
Jon Neal f309eaab00 Pcbnew: spread and pick up new footprints when loaded. 2016-01-10 16:24:13 -05:00
unknown 1ee7458140 1. Fixed copy paste error in append_board_to_current.cpp ruining a if else condition, should fix a possible bounding box computation bug
2. Whole bunch of pointless casts removed
3. Unused variables removed
4. Fix bug caused by JP on April 25, 2015 where strings were adjusted for translation and the hotkeys section table accidentally swapped the footprint editor title with tag, resulting in "footprint editor" being exported instead of "[footprinteditor]"
No functional changes besides #4, technically it'll "break" imports hotkeys files but April 25 broke imports as well.
2015-11-04 09:48:34 +01:00
jean-pierre charras 289897e364 Pcbnew, Netlist reader: when replacing footprints, activate option "use library local settings values" for new footprints which replace old footprints, prepared by rev 6274. 2015-10-23 09:14:11 +02:00
jean-pierre charras d63c017a0a Exchange footprints: remove duplicate code, and keep the "Locked" attribute state after exchange/replace. 2015-10-22 18:50:27 +02:00
Dick Hollenbeck b27176f230 Pcbnew: fix segfault after deleting a pad from a footprint then performing a DRC action such as a via drag. 2015-09-23 19:02:40 -04:00
Tomasz Wlostowski 63b35f40a7 Removed all dependencies on boost::polygon except for bitmap2component. Replaced almost all instances of CPOLYGONS_LIST with SHAPE_POLY_SET. 2015-07-27 21:45:57 +02:00
Maciej Suminski d2ebf688f9 Reverted commits that remove boost::polygon dependency (need more testing). 2015-07-14 22:23:13 +02:00
Tomasz Wlostowski 41c753b05d Removed all dependencies on boost::polygon except for bitmap2component. Replaced almost all instances of CPOLYGONS_LIST with SHAPE_POLY_SET. 2015-07-14 13:36:24 +02:00
unknown be42bd163b BOARD::chainMarkedSegments() : fix coding style, bad comments, and better debug messages. 2015-07-10 18:43:25 +02:00
Maciej Suminski d3e276387d Ratsnest fix (GAL). 2015-07-02 11:25:59 +02:00
unknown 71b3125d8e Cleanup: remove unnecessary macros EXCHG and NEGATE. add MIRROR macro. 2015-06-26 15:41:56 +02:00
Henner Zeller e211a77d8b Pcbnew: fix ADD_APPEND option in BOARD::Add() so using version control for board files is practical. 2015-06-18 15:23:01 -04:00
Tomasz Wlostowski b562cfb8bb WX_HTML_REPORT_PANEL: a REPORTER widget on steroids. 2015-06-16 14:20:42 +02:00
Maciej Suminski 42215f2388 Moved GetLayerSet() to BOARD_ITEM. 2015-06-04 14:54:07 +02:00
https://launchpad.net/~john-j-beard 0350290499 Fix Bug #1426675 (Undo and cancel commands don't have effect for Duplicate operation in legacy mode) 2015-03-22 10:42:41 +01:00
jean-pierre charras 9004ed8801 Remove a few coverity warnings. Fix some comments which were incorrect, due to the changes in code. Remove not compiled code (kept as comments), now outdated or useless
legacy plugin: better compatibility with old brd files (current track width and current vias size, stored in SETUP section, were not read from file and incorrectly set)
2015-03-13 17:48:42 +01:00
jean-pierre charras d6c6b4debb Fix some coverity warnings (mainly not initialized vars). 2015-02-27 15:33:13 +01:00
Maciej Suminski 84517d0e79 BOARD::DuplicateAndAddItem() handles vias too. 2015-02-19 14:55:46 +01:00
Maciej Suminski 9bed4814a3 Ratsnest update in 'Create array' tool (GAL). 2015-02-18 20:29:52 +01:00
Maciej Suminski f06690c8d3 Merged lp:~john-j-beard/kicad/moveexact. 2015-02-18 20:27:00 +01:00
jean-pierre charras 6312f8386a Temporary fix a crash I created in rev 5427, when erasing all modules on a board and read the netlist. Will be fully fixed later.
Very minor fixes: remove duplicate #define in vrml_v2_modelparser.cpp, and "undo" a very minor change I made in class_board.cpp when I tried to fix a Pcbnew crash.
2015-02-17 21:32:49 +01:00
jean-pierre charras 39497b109e Pcbnew: fix Bug #1422093 (pcbnew crashes after editing a footprint cominng from the board with the fp editor and saving it on a librray and trying to load it to the board)
Some other very minor fixes.
2015-02-17 17:32:47 +01:00
Miguel Angel Ajo 1e2af7fed1 Add GetLayerID method to BOARD.
This method is added for scripting purposes, to be able to query
specific board layer names thru a board object.

If no board specific layer name is found, it will fallback to
standard layer names.
2015-02-15 14:31:47 +01:00
John Beard 8c6313ac1a Extend arrays and duplicate to pcbnew (GAL and legacy), covering modules, text, lines, tracks, dimensions and targets.
Text arrays can now use "%s" as a placeholder to be substituted with the array index.

Also expand menu options for move exact, arrays and duplicate.

Minor fixes for arrays - use proper unit parsing, add numbering start for circular arrays

Add circle radius indicator to array dialogue
2015-02-12 03:22:24 +00:00
jean-pierre charras b556fb2324 Class BOARD: Rename an overloaded method named SetLayer with the better name SetLayerDescr, and comment it. It also remove some warnings when compiled with option -Woverloaded-virtual 2015-01-29 17:01:48 +01:00
jean-pierre charras f0a52644ea Pcbnew: fix Bug #1413701 (Segfault on highlight "unconnected" net 0 in Pcbnew ). Also, remove now useless code and other very minor fixes. 2015-01-23 12:24:32 +01:00
jean-pierre charras ebb967c46f Pcbnew: fix issues and potential issues when reading board files and mainly old board files, and enhance the DRC tests and Delete Single Pad Net option when reading a netlist:
* Delete Single Pad Net option does not delete the net if a zone use this net (i.e. is attached to this pad).
* pcb_parser accept now negative netcodes in zones (can happen with old files, which previously could crash Pcbnew)
* pcb_parser accept now files with incorrect or missing net count  (can happen with old files, which previously could crash Pcbnew)
* if a zone has a non-existent net name it now keep this net name, and DRC detect it (previously, the net name was lost, and the DRC did not tected this issue).
* Drc test: now detect a "dead" net, i.e. a net with 0 pads, but still used by a zone. It happens easily after a schematic modification, when a net disappears or is renamed.
2015-01-22 13:06:34 +01:00
Maciej Suminski 03f7003c00 pcbnew: Unconnected items share the same NETINFO_ITEM, even if on different boards. 2014-11-24 16:34:47 +01:00
Wayne Stambaugh 1dc5178095 Message panel consistency improvements and coding policy fixes.
* Make title capitalization consistant.
* Replace some instances of module with footprint.
* Use angle instead of orientation where appropriate.
* Remove abbreviations where it made sense.
* Coding policy fixes.
2014-11-15 14:06:05 -05:00
Maciej Suminski d84567ae40 pcbnew: fixes crash when a new part footprint is changed. 2014-11-13 11:06:41 +01:00
jean-pierre charras e6274f70b0 BOARD::Add(): fix an issue for tracks: parent not set (could be an issue only in python scripts, because the parent is set by the constructor)
*.i : fix coding style issues.
python method: add BOARD_ITEM Duplicate, which is a wrapper to Clone(). ( defined as Cast_to_BOARD_ITEM(selt.Clone()).Cast() )
update some .py examples.
2014-10-02 19:09:32 +02:00
Lorenzo Marcantonio 424aac6cf2 TEXTE_MODULE cleanup in preparation for text on different layers
- Removed the friends MODULE and FOOTPRINT_EDIT_FRAME from TEXTE_MODULE
  (as in the @todo comment)

- Refactored the Rotate/Flip/Mirror for text in modules into the
  TEXTE_MODULE class itself (members RotateWithModule, FlipWithModule,
  MirrorWithModule)

- New behaviour in coloring text on screen: reference and value still
  take the color from the MOD_TEXT_FR_VISIBLE and MOD_TEXT_BK_VISIBLE
  visibles; other text takes the color of the layer containing it
  (except when hidden, obviously) but still get its visibility
  controlled by those visibles (probably the most intuitive and useful
  behaviour)

- Still need to decide: should text on a layer be hidden when the layer
  is? Probably yes (still to be implemented);

- Some comment fixed and many cast converted to static_cast
2014-09-10 17:18:42 +02:00
jean-pierre charras 3d83434275 Very minor fixes. 2014-08-29 08:47:05 +02:00
jean-pierre charras 5a38d2b657 Rework on env. variable KISYS3DMOD. Until now, was used in different files using different ways, so no consistency between files.
code cleanup.
2014-08-24 09:05:07 +02:00
Dick Hollenbeck 7e483f69bd Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
     get disassociated from their true PROJECT.
  *) Allow loading eeschema library editor from kicad.exe
  *) Allow loading pcbnew library editor from kicad.exe
  *) Rename LIB_COMPONENT to LIB_PART.
  *) Add class PART_LIBS, and PART_LIB.
  *) Make PART_LIBS non-global, i.e. PROJECT specific.
  *) Implement "data on demand" for PART_LIBS
  *) Implement "data on demand" for schematic SEARCH_STACK.
  *) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
  *) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
     a weak pointer.
  *) Remove all chdir() calls so projects don't need to be CWD.
  *) Romove APPEND support from OpenProjectFiles().
  *) Make OpenProjectFiles() robust, even for creating new projects.
  *) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
     and save them in the .eeschema config file, not in the project file.
  *) Fix bug with wxDir() while accessing protected dirs in kicad.exe
  *) Consolidate template copying into PROJECT class, not in kicad.exe source.
  *) Generally untangle eeschema, making its libraries not global but rather
     held in the PROJECT.
2014-08-13 15:28:54 -05:00
jean-pierre charras 13b0784cd5 Fix overflow in track len calculations and display (Bug #1347878). 2014-07-24 08:43:23 +02:00
Maciej Suminski 95a4f61eee wxWidgets 2.8 compatibility fix. 2014-07-09 14:23:13 +02:00
Maciej Suminski 9a47f4c645 Created a specialization of EDA_DRAW_PANEL_GAL: PCB_DRAW_PANEL_GAL.
Moved View related routines & fields from PCB_{BASE,EDIT}_FRAME & BOARD to PCB_DRAW_PANEL_GAL.
2014-07-09 10:57:32 +02:00
Dick Hollenbeck e460b4a524 fix export_gencad.cpp 2014-06-30 10:03:20 -05:00
Dick Hollenbeck 575f13d887 fix VIA::IsOnLayer() 2014-06-29 23:40:16 -05:00
Dick Hollenbeck ad750defb6 LAYER_ID work 2014-06-29 08:05:51 -05:00
jean-pierre charras 013296cb1a Make gerbview compilable and working (does not use now layers and layer masks from Pcbnew).
Export to Pcbnew is broken, but it is a very rarely used feature. It will be fixed later.
2014-06-27 19:07:42 +02:00
Dick Hollenbeck 4578ea8b9e 1) Add 32 Cu Layers.
2) Change from legacy Cu stack to counting down from top=(F_Cu or 0).
   The old Cu stack required knowing the count of Cu layers to make
   sense of the layer number when converting to many exported file types.
   The new Cu stack is more commonly used, although ours still gives
   B_Cu a fixed number.
3) Introduce class LSET and enum LAYER_ID.
4) Change *.kicad_pcb file format version to 4 from 3.
5) Change fixed names Inner1_Cu-Inner14_Cu to In1_Cu-In30_Cu and their
   meanings are typically flipped.
6) Moved the #define LAYER_N_* stuff into legacy_plugin.cpp where they
   can die a quiet death, and switch to enum LAYER_ID symbols throughout.
7) Removed the LEGACY_PLUGIN::Save() and FootprintSave() functions.
   You will need to convert to the format immediately, *.kicad_pcb and
   *.kicad_mod (=pretty) since legacy format was never going to know
   about 32 Cu layers and additional technical layers and the reversed Cu
   stack.
2014-06-24 11:17:18 -05:00
Maciej Suminski f31f92e45e Fixes the bug that causes pcbnew crash, when there are multiple net classes and the plot dialog was opened.
Changed NETCLASS* to boost::shared_ptr<NETCLASS>.
2014-05-20 11:29:37 +02:00
Maciej Suminski 4fcaf4c586 Minor BOARD_DESIGN_SETTINGS refactoring.
Removed SetCurrentClassName() (it was not used anywhere and less safe than SetCurrentClass()).
Added BOARD_DESIGN_SETTIGNS::GetDefault() to make some pieces of shorter and clearer.
2014-05-15 10:51:08 +02:00
Maciej Suminski d9eb15c9fa Moved NETCLASSES to BOARD_DESIGN_SETTINGS.
Most of the changes are just adding GetDesignSettings() before every occurence of m_NetClasses.
More complex changes:
class_netclass.cpp - NETCLASS does not store the pointer to the parent BOARD anymore. Added function SetParams( BOARD_DESIGN_SETTINGS& ).
class_netclass.h - Removed GetTrackMinWidth(), GetViaMinDiameter(), GetViaMinDrill(), GetuViaMinDiameter(), GetuViaMinDrill() as they were refering to BOARD_DESIGN_SETTINGS anyway (they are not net class specific).
kicad_plugin.cpp - filters out empty nets (that are anyway not saved) when storing net class information. Previously it was done in NETCLASS::Format() function.
2014-05-13 11:22:51 +02:00
Maciej Suminski cd8aaee160 Moved most of the board design rules related fields & methods to BOARD_DESIGN_SETTINGS class. 2014-05-13 11:22:51 +02:00
Maciej Suminski ffe212ea5e Initial support for custom track width & via size. 2014-05-13 11:22:51 +02:00
Lorenzo Marcantonio 7b4b3297db - Better way to iterate on vias in the track list (GetFirstVia)
- Converted the Next/Prev C casts to static casts and removed the type
  unsafe ones
- Splitted as virtual the VIA::Flip member instead of using RTTI
- Heavily refactored the 'unconnected track' cleanup routine
- Misc constification
2014-04-30 21:16:22 +02:00
Lorenzo Marcantonio c2af94ac03 Reworked the endpoint designator constants FLG_BEGIN and FLG_END in a
ENDPOINT_T enum type
2014-04-25 19:13:33 +02:00
Lorenzo Marcantonio 3f2c0e1a8d TRACK/SEGVIA cleanup
- SEGVIA becomes VIA
- Drill size moved from TRACK to VIA
- Removed shape from TRACK, becomes ViaType in VIA
- GetTrace becomes GetTrack, for uniformity
- Some minor constification and typo fixes
2014-04-25 08:00:04 +02:00
Dick Hollenbeck 6bfff89fe5 merge tip in, resolve. 2014-03-20 01:24:33 -05:00
Dick Hollenbeck 2c67c3ff80 * KIWAY Milestone A): Make major modules into DLL/DSOs.
!   The initial testing of this commit should be done using a Debug build so that
    all the wxASSERT()s are enabled.  Also, be sure and keep enabled the
    USE_KIWAY_DLLs option.  The tree won't likely build without it.  Turning it
    off is senseless anyways.  If you want stable code, go back to a prior version,
    the one tagged with "stable".

*   Relocate all functionality out of the wxApp derivative into more finely
    targeted purposes:
    a) DLL/DSO specific
    b) PROJECT specific
    c) EXE or process specific
    d) configuration file specific data
    e) configuration file manipulations functions.

    All of this functionality was blended into an extremely large wxApp derivative
    and that was incompatible with the desire to support multiple concurrently
    loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
    An amazing amount of organization come from simply sorting each bit of
    functionality into the proper box.

*   Switch to wxConfigBase from wxConfig everywhere except instantiation.
*   Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
    PGM_SINGLE_TOP,
*   Remove "Return" prefix on many function names.
*   Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
*   Fix building boost for use in a DSO on linux.
*   Remove some of the assumptions in the CMakeLists.txt files that windows had
    to be the host platform when building windows binaries.
*   Reduce the number of wxStrings being constructed at program load time via
    static construction.
*   Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
    these functions are useful even when the wxConfigBase comes from another
    source, as is the case in the KICAD_MANAGER_FRAME.
*   Move the setting of the KIPRJMOD environment variable into class PROJECT,
    so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
*   Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
    its child wxFrames and wxDialogs now have a Kiway() member function which
    returns a KIWAY& that that window tree branch is in support of.  This is like
    wxWindows DNA in that child windows get this member with proper value at time
    of construction.
*   Anticipate some of the needs for milestones B) and C) and make code
    adjustments now in an effort to reduce work in those milestones.
*   No testing has been done for python scripting, since milestone C) has that
    being largely reworked and re-thought-out.
2014-03-19 19:42:08 -05:00
Maciej Suminski 505b38416d Removed a few memory leaks. 2014-03-03 17:15:41 +01:00
Maciej Suminski 75026d8754 Renamed BOARD_CONNECTED_ITEM::GetNet() -> GetNetCode()
Renamed BOARD_CONNECTED_ITEM::SetNet() -> SetNetCode()
Added BOARD_CONNECTED_ITEM::GetNet() for accessing NETINFO_ITEM* of a given item.
Fixed module editor crash when launched to edit a module from a PCB.
Replaced some BOARD::FindNet( item->GetNet() ) calls with BOARD_CONNECTED_ITEM::GetNet().
2014-02-25 11:40:34 +01:00
Maciej Suminski e6a01e5a41 Fixed ratsnest related segfaults on BOARD destruction. 2014-02-11 14:26:33 +01:00
Maciej Suminski 510fee1358 Another way of handling items for the ratsnest (clearer and now finally supports undo/redo of the PNS created tracks). 2014-01-30 15:46:39 +01:00
Maciej Suminski af350eb1e6 RN_DATA::GetNets() -> RN_DATA::GetNet() with an assert to check if someone calls it for the unconnected net.
Only items that belong to a net are removed from ratsnest.
2014-01-29 15:24:19 +01:00
Maciej Suminski b52e5fabda Ratsnest lines are drawn using a more transparent color.
BOARD::chainMarkedSegments() uses a safer method for gettings pads.
2014-01-29 14:51:50 +01:00
Maciej Suminski bec24b6c7f Ratsnest is updated after rotation, flip, undo/redo operations.
Fixed crashes of ratsnest when a pointer for an item has changed after undo/redo operations.
Vias are properly removed from ratsnest (pcbnew/class_board.cpp).
2014-01-29 10:17:14 +01:00
Maciej Suminski c3c7b2e9cc Merged the netnames branch. 2014-01-28 11:59:04 +01:00
Maciej Suminski 7f6bc781aa Upstream merge. 2014-01-28 10:43:55 +01:00
Maciej Suminski 15b8d3d20a Added NETINFO_MAPPING, to ease saving nets with consecutive net codes (without modifying the net codes during the run time).
Now, nets are saved with consecutive net codes (both modern & legacy plugins).
Zones are saved together with their nets, without depending on the fact if there are any pads with such net. Therefore validation of zone net names was removed (pcbnew/class_board.cpp).

Performed tests:
- Changed a pad's net name from empty to existent - ok, name was changed.
- Changed a pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty.
- Changed a pad's net name from existent to empty - ok, net name became empty
- Changed a pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed.

- Drawn a zone that belongs to a net, then modified schematics so the net does not exist anymore. After reloading the net list, all pads/tracks are updated. Zones still belongs to the net that does not exist in the schematic (but still exists in .kicad_pcb file). After running DRC, the zone becomes not filled.
- Undo & redo affects assignment of a polygon to a specific net (you may change net of a polygon, refill it and undo/redo the changes).

- KiCad s-expr & legacy, Eagle, P-CAD boards seem to load without any problem (they also contain correct net names assigned to the appropriate pads). All types of board file formats were loaded, then saved in sexpr format and reopened with a KiCad built from the master branch (without my modifications).
- A few boards were also saved using the legacy format and were opened with the master KiCad without any issues.

- Change a net name for a pad, restore with undo/redo - ok
- Remove everything, restore with undo - ok
- Remove everything, reload netlist - ok

Differences observed between files saved by the master branch KiCad and this one:
- list of nets are not saved in any particular order, so net codes may differ
- the default net class does not contain the unconnected net
2014-01-28 10:19:51 +01:00
jean-pierre charras a094f7d5b5 Fix some issues in modview, relative to few incorrect use of some wxAuiManager functions.
Fix not working + and - keys in layers manager.
Fix typo errors and modify some messages to make translator's life more easy.
2014-01-19 14:12:57 +01:00
Maciej Suminski 441e03172c Added iterators for NETINFO_LIST (as net codes for existing net codes may be not consecutive). 2014-01-16 16:47:31 +01:00
Maciej Suminski 8a4e723504 NETINFO_ITEMs are not stored in a vector anymore, instead they are held in a unordered_map. Now, the net codes may be not consecutive. There is another way for assigning net codes (using a static int that holds a possible empty net code and a function that makes sure it is not used [getFreeNetCode()]).
Removed some unused fields (NETINFO_ITEM::m_NbNodes, m_NbLink, m_NbNoconn, m_Flag).
2014-01-16 14:20:51 +01:00
Maciej Suminski d62b47a0df BOARD_CONNECTED_ITEMs do not store net code anymore (m_NetCode field), instead net info is stored using a pointer to NETINFO_ITEM.
GetNet() refers to the net code stored in the NETINFO_ITEM. SetNet() finds an appropriate NETINFO_ITEM and uses it.
Removing GetNet() & SetNet() (and the whole net code idea) requires too many changes in the code (~250 references to the mentioned functions).
BOARD_CONNECTED_ITEMs by default get a pointer to NETINFO_ITEM that stores unconnected items. This requires for all BOARD_CONNECTED_ITEMs to have a parent (so BOARD* is accessible). The only orphaned item is BOARD_DESIGN_SETTINGS::m_Pad_Master, but it does not cause any issues so far.
Items that do not have access to a BOARD (do not have set parents) and therefore cannot get net assigned, by default get const static NETINFO_LIST::ORPHANED.

Performed tests:
- loaded .kicad_pcb, KiCad legacy board, Eagle 6.0 board, P-CAD board - all ok
- load a simple project, reload netlist after changing connections in eeschema - ok
- save & reload a board - ok, but still contain empty nets
- remove everything, restore with undo - ok
- remove everything, reload netlist - ok
- changing net names (all possibilites: empty->existing, empty->not existing, existing->empty, existing->not existing) - all ok
- zones: when net is changed to a net that does not have any nodes besides the zone itself, it does not get filled
2014-01-15 18:03:06 +01:00
Maciej Suminski 3017b61711 Added NETINFO_LIST::UNCONNECTED constant. 2014-01-15 09:34:16 +01:00
Maciej Suminski 78732f13f7 Removed:
- ZONE_CONTAINER::m_Netname field
- ZONE_CONTAINER::SetNetName()
- ZONE_CONTAINER::SetNet() [it uses the one in BOARD_CONNECTED_ITEM]
- ZONE_CONTAINER::GetNetName() [instead BOARD_CONNECTED_ITEM::GetNetname is used]
- ZONE_CONTAINER::SetNetNameFromNetCode()

Performed tests:
- Drawn a zone that belongs to a net, then modified schematics so the net does not exist anymore. After reloading the net list, all pads/tracks are updated. Zones still belongs to the net that does not exist in the schematic (but still exists in .kicad_pcb file). After running DRC, the zone becomes not filled.
- Undo & redo affects assignment of a polygon to a specific net (you may change net of a polygon, refill it and undo/redo the changes).
2014-01-14 11:41:06 +01:00
Maciej Suminski 654e7e556e Removed D_PAD::SetNetname() function and D_PAD::m_Netname, D_PAD::m_ShortNetname fields.
D_PAD::GetNetname() and D_PAD::GetShortNetname() were moved to BOARD_CONNECTED_ITEM. Now they use the net name stored in NETINFO_ITEM.
Moved some one-line functions from class_board_connected_item.cpp to class_board_connected_item.h.
Added a copyright notice, moved Doxygen comments from class_board_connected_item.cpp to class_board_connected_item.h.

I have some doubts if changes introduced pcbnew/dialogs/dialog_pad_properties.cpp do not break anything, but I could not find a test case that breaks the pcbnew.

Performed tests:
- changed pad's net name from empty to existent - ok, name was changed
- changed pad's net name from empty to nonexistent - ok, error message is displayed, net name stays empty
- changed pad's net name from existent to empty - ok, net name became empty
- changed pad's net name from existent to nonexistent - ok, error message is displayed, net name is not changed
- (re)reading netlists, including net changes - fine, changes are applied, but empty nets are still kept
- loaded pcbnew/pcad2kicadpcb_plugin/examples/CK1202_V1.pcb to test P-CAD import plugin - ok, net names are correct
- imported an Eagle 6.0 board (Arduino Uno; http://arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip) then saved in .kicad_pcb format and reloaded - ok, net names are correct
- saved demos/video/video.kicad_pcb in legacy format and then loaded it again - ok, net names are correct
2014-01-14 10:41:52 +01:00
Maciej Suminski bf80cc770e Changed the way of looking up NETINFO_ITEM using net names (using boost::unordered_map). Added a hash function (wxString) for that. Introduced NETINFO_ITEM::GetNetItem( wxString ). BOARD::FindNet() uses the map.
Net codes are updated upon net list update. (BOARD::ReplaceNetlist())
Added in some places (mostly class_board.cpp) pad->SetNet() calls to synchronize net codes.
On creation of NETINFO_LIST, the first NETINFO_ITEM is added (the unconnected items net).
Removed COMPONENT_NET::m_netNumber, as it was not used anywhere.
Added an assert to D_PAD::GetNetname(), checking if net code and net name is consistent for unconnected pads. Added an assert for NETINFO_LIST::AppendNet() to assure that appended nets are unique.

It seems that at this point:
- Updating net lists works fine. The only difference between the file ouput is that after changes it contains empty nets as well.
- Nets are not saved in the lexical order. Still, net names and net codes are properly assigned to all items in the .kicad_pcb file. It is going to be addressed in the next commit. I believe it should not create any problems, as pads are sorted by their net names anyway (NETINFO_LIST::buildPadsFullList())

Performed tests:
- Created a blank PCB, saved as pic_programmer.kicad_pcb (from demos folder). Updated net lists. .kicad_pcb file (comparing to the results from master branch) differ with net order (as mentioned before), net codes and timestamps.
- Removed some of components from the above .kicad_pcb file and updated net lists. Modules reappeared. .kicad_pcb file differs in the same way as described above.
- Trying to change a pad net name (via properties dialog) results in assert being fired. It is done on purpose (as there is a call to GetNetname() and net name and net code do not match). This will not happen after the next commit.
- Prepared a simple project (starting with schematics). Imported net list, changed schematic, reimported net list - changes are applied.
- Eagle & KiCad legacy boards seem to load without any problem.
2014-01-10 18:04:07 +01:00
Maciej Suminski aaf857e894 Items removed from board are removed from ratsnest as well. Corrected the way of items removal from ratsnest. 2014-01-07 14:15:40 +01:00
Dick Hollenbeck c264823731 8 bit string relief via class UTF8 2014-01-01 20:17:07 -06:00
Maciej Suminski c6efc451e6 Added ratsnest for GAL 2013-11-25 16:50:03 +01:00
jean-pierre charras 5f01f123de All: GetBoundingBox returns now a const EDA_RECT.
Pcbnew: Code cleaning and bug fix in autoplace functions
Dialog exchange footprints has now a separate button to update the .cmp file, only on request.
2013-11-24 18:48:14 +01:00
Dick Hollenbeck 5f329b472b make PROPERTIES::Value() not inline 2013-11-02 14:49:46 -05:00
Dick Hollenbeck 42ef7f6215 *) Start removing some of the problematic "<%s>.." format strings, which won't
pass into an HTML rendering panel and otherwise look goofey.
*) Implement BOARD::Move() can call it from EAGLE_PLUGIN::Load().
*) When USE_FP_LIB_TABLE, tolerate blank nicknames in FPIDs coming from eeschema.
   See the switch for this in pcbnew/netlist.cpp as ALLOW_PARTIAL_FPID.
*) Add an assert and a try catch block to figure out that View does not
   like some eagle pcb board.  bitset::set() is getting a -1 value and firing
   an exception.
2013-11-01 19:24:38 -05:00
Maciej Suminski e13f862145 Merged upstream. 2013-10-28 21:34:06 +01:00
jean-pierre charras a8e57e10e8 Remove wxUSE_UNICODE definition from CMakeLists.txt, because this define comes from wxWidgets and should not be made inside kicad
Remove KICAD_GOST option because it is  now useless: the 2 GOST options are now selectable at run time and are:
* specific page layouts (now user definable, and the GOST page layouts are available in template folder)
* notation for multiple parts per package (made in eeschema, preference menu)
2013-10-11 18:24:43 +02:00
jean-pierre charras dd64b2f284 3D board display: better rendering of the board: the board polygon outlines (generated by the specctra function) is now used to create the 3D body of the board. 2013-10-04 10:42:09 +02:00
jean-pierre charras 25b20c5564 Gerbview: fix incorrect printing of negative objects, when using black and white option
Enhancement in Excellon file reader: accept Feed Rate and Spindle Speed definitions in Tool information line (but does not use them)
Eeschema: better name for m_SheetList (changed to m_SheetPath) member of class NETLIST_OBJECT.
2013-09-30 08:36:40 +02:00
Maciej Suminski 8e472c736a Merged upstream. 2013-09-20 17:54:35 +02:00
Maciej Suminski c00533a150 Merged kicad-gal 2013-09-20 15:48:27 +02:00
jean-pierre charras bb39956057 Fix minor bugs in cleanup dialog options and plot solder mask function (thanks to Lorenzo to locate these bugs) 2013-09-18 21:21:11 +02:00
Wayne Stambaugh ce409e3699 CvPcb footprint library table implementation.
* Add code to CvPcb to handle assigning component footprints from the
  footprint library table instead of the search path method.
* Add code to CvPcb to allow editing of the footprint library table.
* CvPcb footprint and component panes display fully qualified FPID names.
* Make CvPcb library pane display footprint library table nicknames instead
  of library file names.
* Add code to FP_LIB_TABLE object to test the paths in the table against the
  list of libraries loaded from the project file.
* Add code to FP_LIB_TABLE to convert assigned footprints in a NETLIST from
  legacy format to footprint library table format.
* Split out COMPONENT_NET, COMPONENT, and NETLIST objects from netlist_reader
  files and create new pcb_netlist files.
* Fix minor wxListView scroll bar sizing issues.
* Add new token and code to save and load FPID nickname in board file.
* Add new token and code to save and load FPID nickname in s-expression net
  list file.
* Add WX_STRING_REPORT object to dump strings to a wxString object.
2013-09-14 16:33:22 -04:00
Wayne Stambaugh 230c5f8f5a Convert footprint definitions from wxString to FPID.
* Use FPID instead of wxString in MODULE object.
* Use FPID instead of wxString when loading and saving files.
* Use FPID in COMPONENT object.
* Add wxString helper functions and comparison operators to FPID.
* Add fp_lib token to pcb and netlist file formats.
* Add code to load and save FPIDs to pcb file format.
* Fix segfault when deleting invalid footprint library tables in Pcbnew
  in non footprint library table build.
* Fix bug when counting the number of mod files in
  EDA_APP::SetFootprintLibTablePath();
2013-09-08 14:31:21 -04:00
Maciej Suminski 89849cdfa7 Unified Set/GetPosition() for BOARD_ITEMs. 2013-08-29 12:06:06 +02:00
jean-pierre charras 8cca89ffbe Pcbnew: read netlist enhancements: add option to remove single pads nets, add enforce tests to report non existing netnames in zones.
Fix also some very minor errors in comments.
2013-08-24 10:08:55 +02:00
jean-pierre charras 3d40bd7e16 Pcbnew: add more test when reading a netlist file: verify if all pads found in netlist are found in corresponding footprints (no missing pads). 2013-08-23 11:22:19 +02:00
jean-pierre charras 4428d69a63 Pcbnew: Fix a bug when reading a netlist which forces pcbnew to read lib files to find a footprint even if the right footprint is already loaded (which explains the long time to load netlists)
Netlist dialog: add option to report only most important messages. Useful for large boards.
class REPORTER: add features to allow a basic message filtering (flags to report all/warning/error messages)
Fix Bug #1214599 ( tools are deselected on Move command )
2013-08-23 08:38:57 +02:00