Commit Graph

67 Commits

Author SHA1 Message Date
jean-pierre charras 210671b10a Gerbview, Excellon reader: add preference to configure default coordinates format. In Excellon drill files, the coordinate format is not specified, and sometimes units and zero option are even not specified, so some drill files cannot be read. In Preferences, default setting options are now added to specify by hand missing info. 2021-08-02 12:55:41 +02:00
Mike Williams f2241d25c6 Gerbview: implement ;FILE_FORMAT parsing
Apparently Altium likes to output drill files with a specific header
setting the number format

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7519
2021-08-02 08:48:15 +00:00
jean-pierre charras b1fd462d28 Gerbview, Excellon reader: use Leading Zeros format when not specified in file.
Some very poor files do not specify the coordinates format.
In this case, the default is INCH,LZ that looks like the more usual.
2021-08-01 11:44:45 +02:00
jean-pierre charras 70b5e26ff3 Gerbview, Excellon reader: fix incorrect size of tools when the size is embedded.
Some files embed the tool declaration size in Tool selection. In this case, the
tool size was not read.
2021-08-01 10:22:08 +02:00
Jeff Young 6aaf4413b3 Fix kicad_string.h / string.cpp mismatch.
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
2021-07-29 16:03:25 +01:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Marek Roszko e955f83c51 Use a unique_ptr for ensuring clean up when reading excellon files 2021-05-01 14:23:01 -04:00
Ian McInerney ecd9bf696e Be consistent about using nullptr instead of 0
0 can be too easily overloaded into an int, so ensure we use nullptr
when we mean pointers.
2021-04-22 22:20:34 +01:00
Marek Roszko e49ac45b84 HTML_MESSAGE_BOX is a dialog 2020-10-25 20:01:12 -04:00
Marek Roszko e928b2d8fd Split EDA_UNITS out from common. 2020-10-25 00:02:52 -04:00
Marek Roszko 1d559108c8 Move LOCALE_IO out of common.h 2020-10-23 21:49:42 -04:00
jean-pierre charras 13304d0870 more cleanup about removing useless include 2020-10-02 13:40:00 +02:00
Jeff Young 88635ee5b6 Clean up error messages.
Convert a lot of nags to InfoBar errors/warnings/messages, and some
that never should have been exposed to wxFAIL_MSGs.
2020-08-31 14:19:57 +01:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
jean-pierre charras 8d649b5351 Gerbview: cleanup code.
Remove GERBER_FILE_IMAGE_LIST dependency to EDA_ITEM, useless.
GERBER_FILE_IMAGE: replace DLIST by std::deque to store gerber draw items.
Remove dead code
2019-12-31 11:58:43 +01:00
Ian McInerney 0259e0ba07 Cleanup struct initialization and formatting 2019-12-17 16:09:32 +00:00
Seth Hillbrand b5f021ff9f Cleanup: Replace push_back with emplace_back
In cases where we create a new item and immediately push into a
container, the emplace idiom is faster and more efficient.
2019-12-05 13:41:21 -08:00
Jeff Young a25368cc6b Improve spelling.
The groundwork here is thanks to kunda1.

Fixes: lp:1831510
* https://bugs.launchpad.net/kicad/+bug/1831510
2019-08-20 19:14:05 +01:00
Jeff Young 8f84c3ec4f Grid rid of GetCanvas/GetGalCanvas distinction now that there's only gal. 2019-06-13 19:58:37 +01:00
jean-pierre charras ff73f69d3e Gerbview: fix crash when reading a .gbrjob, and when a file given by the .gbrjob is not found.
A incorrect gerber image was created, creating crash on exit or when enable the layer view.
2019-03-24 17:32:57 +01:00
jean-pierre charras 542c57ff27 Gerbview, Excellon (NC) drill files reader: routing mode: better handling of malformed files.
Routing mode starts by M15 (or G01, G02, G03) and ends by M16 or M17.
Accept now a end routing if a G00 (start move) G05 (switch to drill mode) or M30 (end of file) is encountered.
2018-11-26 10:55:36 +01:00
jean-pierre charras 0980f7232c Gerbview: minor fixes. 2018-11-08 16:49:50 +01:00
Seth Hillbrand d03b08a03f gerbview: Prevent NULL dereference
There was a possible NULL dereference when executing tool_up even
though we should never hit it, we protect against bad files.

Also converts a couple untranslated error strings.
2018-10-11 14:23:07 -07:00
jean-pierre charras 4136aca221 Gerbview: Excellon drill files reader: add a better support of routing mode.
Previously, the M and G00, G01, G02 and G03 commands were read, but nothing was actually done.
The current support is a bit rough, but it allows reading some drill files with routing commands.
2018-09-24 13:12:47 +02:00
jean-pierre charras c291505830 Gerbview, read Excellon files: fix a few issues.
The main issue is the fact Excellon files have no coordinate fine format definition.
Only the units are defined.
Units are floating point numbers or integer numbers.
Integer numbers can be defined as 3.3 or 2.4 numbers (mm/inches)
However some files (altium drill files for instance) use an other notation.
This fix is a workaround to accept 2.x (inch) or 3.x (mm) notations.

Fixes: lp:1754121
https://bugs.launchpad.net/kicad/+bug/1754121

Fixes: lp:1782053
https://bugs.launchpad.net/kicad/+bug/1782053
2018-07-17 14:29:28 +02:00
jean-pierre charras 2af5fb51f2 Revert "Perform coordinate format detection on Excellon drill files"
This reverts commit 3e033aee0c.
2018-07-17 14:29:27 +02:00
jean-pierre charras d8687e4eaf Gerbview: minor code cleanup 2018-05-14 09:05:11 +02:00
jean-pierre charras 5b8c35f64d Gerbview: minor fix: do not report error if in header INCH ot METRIC command has no parameter (,LZ or ,TZ format)
I am not sure it should be reported, because LZ or TZ format has no meaning in decimal format, and can be omitted.
2018-03-31 18:40:29 +02:00
Jon Evans a931ac436a Add some safety checks to Excellon number format detection
Fixes: lp:1754121
* https://bugs.launchpad.net/kicad/+bug/1754121
2018-03-21 22:29:43 -04:00
Jon Evans 23f49f014b Code style fixes 2018-03-07 22:14:24 -05:00
Jon Evans 3e033aee0c Perform coordinate format detection on Excellon drill files
Fixes: lp:1754121
* https://bugs.launchpad.net/kicad/+bug/1754121
2018-03-07 22:08:59 -05:00
Jon Evans 1ed7d5f816 Clear out old layer data when loading on top of an existing image
Fixes: lp:1747443
* https://bugs.launchpad.net/kicad/+bug/1747443
2018-02-23 11:59:40 +01:00
jean-pierre charras a0ac1a48c2 Gerbview: fix code after renaming files 2018-01-29 13:26:58 +01:00
Seth Hillbrand 5b2248fad8 gerbview: Corrects handling of %FSD statement 2017-09-29 07:40:58 +02:00
Maciej Suminski 88cab885af Code formatting 2017-09-25 13:35:02 +02:00
Jon Evans 915e51e1f0 GerbView GAL support part 1: changes to existing files
- New GAL draw layers for GerbView
- Improved bounding boxes for Gerber shapes
- Switched to use of SHAPE_POLY_SET for polygons
- Add GAL methods to support selection and rendering
- Add GUI support of editing GAL options
- Rename get/setActiveLayer to Get/SetActiveLayer to match convention
2017-09-25 13:35:01 +02:00
Simon Richter bfb6e0bbb2 Convert remaining occurences of stri[n]cmp to str[n]casecmp.
This also reverses the substitution logic if strcasecmp is missing (config.h.cmake)
2016-08-16 10:27:09 +02:00
jean-pierre charras 5a00c7823c Gerbview: Read excellon files: fix incorrect handling of G85 command. 2016-06-19 11:53:40 +02:00
jean-pierre charras a907e50424 Gerbview: code cleanup (mainly remove g_GERBER_List global variable) 2016-06-17 20:00:29 +02:00
jean-pierre charras f311230874 Gerbview: when running gerbview from a command line, if a filename is given, and if it is a .drl file, it is loaded as drill file (instead of a gerber file, which generate an error message).
Code refactor: remove useless class members,  and move read gerber file and read excellon file from gerbview frame to the corresponding classes
2016-06-05 14:26:39 +02:00
jean-pierre charras 130c6e3639 Gerbview: more code refactoring. 2016-05-26 13:57:43 +02:00
jean-pierre charras 3b379787bc Gerbview: move gerber_file_image_list to a separate file 2016-05-26 09:50:49 +02:00
jean-pierre charras 8c8a1238f1 Gerbview: more code cleanup. Rename class GERBER_IMAGE GERBER_FILE_IMAGE, because it handles the gerber image and the gerber file info. 2016-05-25 16:48:38 +02:00
jean-pierre charras 1c21410f1f Gerbview: code cleanup (with the help of Mark Roszko's work) 2016-05-25 11:45:55 +02:00
jean-pierre charras 75c551f305 Gerbview: accept embedded tool definition (i.e. select tool and define it in the same line, outside the header). A few minor other fixes. 2016-05-24 17:56:52 +02:00
jean-pierre charras 30c7821ba2 Grebview: add info in layer manager for Excellon drill filles, similar to X2 file function info in X2 gerber files. 2014-11-23 12:41:57 +01:00
jean-pierre charras 555ce68efe Gerbview: Add support for recent File Format Attribute metadata, both for X2 Gerber file format and X1 (R274X) format.
Pcbnew already uses this attribute when creating Gerber files.
Because Gerber files using this attribute identify the board layers stackup, Gerbview (if this attribute is defined) can sort gerber images stach up like the board.
(in layer manager, just right click to access to the sort menu)
2014-11-22 12:52:57 +01: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 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 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