Commit Graph

94 Commits

Author SHA1 Message Date
jean-pierre charras 72ce955066 Gerbview: fix some issues related to comments and primitives in macros:
- comments on more than one line were not fully skipped, creating read errors
- in macros, some primitives (not all) were incorrectly rotated: they must be
rotated around the aperture macro origin, not the primitive origin.
- a new test file with rotated primitives in macros is added.
Fixes #16049
https://gitlab.com/kicad/code/kicad/-/issues/16049
2023-11-08 10:45:13 +01:00
Marek Roszko 3cd60007c5 Dont leak richio into everything 2023-09-07 22:29:40 -04:00
Ian McInerney 6b218ff764 Remove uneeded file pointer in gerbview code 2022-09-25 15:41:39 +01:00
Marek Roszko d807ab3089 Fix unused var warnings 2022-08-26 20:12:00 -04:00
Seth Hillbrand 35ac39844f Clean up some auto usage
Don't make new copies of shared_ptr if we can use references.  Keep auto
usage down to hard-to-type-out sequences
2022-08-15 11:29:45 -07:00
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 7043498875 Gerbview: handle unexpected invalid char
Attempting to print this as a char was causing wxWidgets to assert since
some input is neither ASCII or valid UTF-8.

Reproducable by trying to open zip files as gerber files from the
command line.
2022-01-24 08:40:49 -05: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 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
Jeff Young d40712d9d6 Formatting and message consistency. 2021-08-01 21:31:23 +01: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
Marek Roszko 850a22c3ae Try/catch gerber file loading in attempt to catch oom
Potentially help with #7444
2021-05-01 12:46:18 -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
Jeff Young 9c7c05c161 Mostly formatting cleanup but a few type-casting cleanups too. 2020-11-24 22:16:41 +00:00
Marek Roszko e49ac45b84 HTML_MESSAGE_BOX is a dialog 2020-10-25 20:01:12 -04:00
Marek Roszko 1d559108c8 Move LOCALE_IO out of common.h 2020-10-23 21:49:42 -04:00
jean-pierre charras 0044c6b48a Add missing includes 2020-10-18 19:22:15 +02:00
jean-pierre charras 04aa5519d0 Gerbview: code cleanup. Remove many include, now useless. 2020-09-30 12:56:55 +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
jean-pierre charras ce77106994 Remove code only used during a test. 2020-01-02 20:44:43 +01: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
jean-pierre charras c59fa1b672 Gerbview: Fix outdated warning message about missing D-Codes and old RS274D files.
RS274X Gerber files using only regions (polygons) can be valid, and are not old RS274D files
Now a warning is raised only if there are some missing D codes definitions
(RS274D file or broken RS274X file)

Remove unused var and add comments

Fixes: lp:1850821
https://bugs.launchpad.net/kicad/+bug/1850821
2019-11-01 08:34:24 +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 0980f7232c Gerbview: minor fixes. 2018-11-08 16:49:50 +01:00
jean-pierre charras 8da242c593 Gerbview: accept any structured comment as X2 attribute.
A structured comment is a comment line starting by "G04 #@! " and in fact containing
a X2 attribute. It is used to create Gerber files contianing X2 metadata, but compatible
with X1 file format
2018-05-14 09:05:09 +02:00
jean-pierre charras fa41026f36 Fix issue in aperture macro with some strange gerber files.
Fixes: lp:1755623
https://bugs.launchpad.net/kicad/+bug/1755623
2018-03-14 14:55:51 +01:00
jean-pierre charras 66d5d10b49 Gerbview: bigger line buffer to read some gerber files that have only one (very long) line.
small code refactor.
2018-03-14 10:42:18 +01:00
Jon Evans 5292829e05 Fix edge case GERBER_FILE_IMAGE creation logic 2018-02-26 14:26:47 -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
Simon Richter a9ccf1161b Fix quotes in UI messages
This replaces all single and angle bracket quotes in UI messages with
double quotes, for consistency.

Sorry to all translators.
2017-12-15 07:33:07 -05:00
Seth Hillbrand 5b2248fad8 gerbview: Corrects handling of %FSD statement 2017-09-29 07:40:58 +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
jean-pierre charras 50164e9968 Add Gerber job file writer in Pcbnew, and a basic reader in Gerbview. Currently disabled
Fix also very minor issues in Gerbview
2017-08-30 11:04:33 +02:00
jean-pierre charras b0bfbd4f41 Gerbview: remove analysis of fully outdated (and never used) gerber commands 2017-08-11 11:21:33 +02:00
jean-pierre charras ba517db96c Gerbview: fix a subtle issue when reading parameter values in Gerber files.
In Gerber files the char 'X' is used as separator.
But when reading parameter values, the sequence "0xnnn" is a number in hexadecimal format, and the 'X' char is not seen as separator by usual strtod or strtol C functions.
This is now fixed.
2017-04-08 12:53:40 +02:00
jean-pierre charras dbd9b5e49e Gerbview: minor code cleanup. 2016-06-18 11:37:36 +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 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 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
Wayne Stambaugh 40779a08ce More missing source license fixes. 2014-10-21 14:36:45 -04: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
jean-pierre charras 820153c7d4 Gerbview: remove fully outdated code (about reading DCode files) and fix erroneous comments. 2013-06-28 12:49:43 +02:00