Commit Graph

73 Commits

Author SHA1 Message Date
Jeff Young 4e3109a633 Wide string decls for gerbview. 2022-02-05 22:34:45 +00:00
Seth Hillbrand 54b20cb049 Fix overflow vulnerability in Gerbview
Corrects an unguarded read that could lead to arbitrary code execution
in specifically crafted gerber files.

Fixes https://gitlab.com/kicad/code/kicad/issues/10700
2022-02-01 15:50:27 -08:00
Mike Williams da2e7e158b Gerbview: Attempt to parse unknown files as gerber/drill
Test parsing function transmogrified from gerbv 2.7.0. gEDA suite is GPL
2+ so should be license compatible with our GPL3.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/1848
2022-01-24 08:40:49 -05:00
Jeff Young 4a05b36bc6 Prefer EDA_ANGLE to naked radians. 2022-01-20 21:10:04 +00:00
Marek Roszko ea613cf448 Another batch of point changes 2022-01-01 13:17:12 -05:00
Jeff Young 3aae3c6f65 Dark mode for a bunch of HTML dialogs.
WX_HTML_REPORT_BOX
WX_HTML_REPORT_PANEL
HTML_MESSAGEBOX
DIALOG_DISPLAY_HTML_TEXT

Fixes https://gitlab.com/kicad/code/kicad/issues/9157

Fixes https://gitlab.com/kicad/code/kicad/issues/9156
2021-09-14 21:23:57 +01:00
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