Commit Graph

3114 Commits

Author SHA1 Message Date
jean-pierre charras 1f6854f2b8 Make internal errors messages not translatable 2017-08-01 13:12:59 +02:00
jean-pierre charras abe2a46ae7 Pcbnew: Fix plot PDF, broken by commit f3457794cf
Also disable option to use native font in PDF and PS plotter format, because this option has never worked.

Fixes: lp:1707412
https://bugs.launchpad.net/kicad/+bug/1707412
2017-07-31 20:05:30 +02:00
Maciej Suminski 76bd05a69b Prevent creating too many transitions by TOOL_MANAGER
- added TOOL_INTERACTIVE::resetTransitions()
- made protected and moved TOOL_BASE::setTransitions() to TOOL_INTERACTIVE
- TOOL_MANAGER calls TOOL_INTERACTIVE::resetTransitions() instead of
setTransitions()
2017-07-31 15:09:19 +02:00
jean-pierre charras e10f0c729b Fix minor compil warnings 2017-07-30 14:24:21 +02:00
Maciej Suminski 2652cfeafd Restore the cursor position after the context menu is closed
Fixes: lp:1696328
* https://bugs.launchpad.net/kicad/+bug/1696328
2017-07-28 10:55:38 +02:00
Maciej Suminski 7399759b3b Fixed polygon DRAWSEGMENT rendering in OpenGL GAL
Fixes: lp:1704542
* https://bugs.launchpad.net/kicad/+bug/1704542
2017-07-28 10:34:47 +02:00
Tomasz Włostowski b964569db7 pcbnew: enable net selection combobox in Track/Via properties dialog 2017-07-27 16:21:54 +02:00
Maciej Suminski 950d87a920 Removed boost::adaptor from ACTION_MANAGER 2017-07-27 16:06:30 +02:00
Maciej Suminski 75f68061a4 Save the drag origin only on the first click 2017-07-27 10:54:08 +02:00
jean-pierre charras 58c32367ee filter useless autosave tests, and optimization of autosave test in Eechema 2017-07-26 18:06:04 +02:00
Dick Hollenbeck 19e6bde09a Rewrite class UTF8 to contain rather than extend std::string storage.
This forces the compiler class specific features rather than borrowing
from the base class's std::string.  In some cases prior to this,
wxString( std::string ) was being called rather than UTF8::operator
wxString() leading to garbled wxStrings.

Added function UTF8::wx_str() which is of great convenience also.

Implicit conversions still work as before, and hopefully more reliably.
2017-07-26 08:30:12 -04:00
Dick Hollenbeck 4e7de8a761 Reverse commit 4011ed4e31.
This commit was too broad and not cognizant of the purpose of the class
UTF8.

Add MAYBE_VERIFY_UTF8() macro, which can trap non-UTF8 encoded strings in
debug builds.

Use that macro conditionally in class UTF8 to trap non-UTF8 encoded strings
being put into UTF8 instances.
2017-07-26 08:26:56 -04:00
Oliver Walters 161045f17d Speed improvement for select / deselect in GAL
- No longer invalidates the item layers
- For multiple items, this results in a drastic speed improvement
2017-07-25 16:34:03 +02:00
Oliver Walters c27f5b725d Improved various error messages
- Moved developer "jargon" to details pane
- Changed error messages to "WHAT" rather than "WHY" or "WHERE"
2017-07-25 07:37:14 -04:00
Oliver Walters a0a3ca6646 Added extra information to error and info messages
Optional extra information string which is displayed in a drop-down "details" box
2017-07-25 07:37:13 -04:00
Fabrizio Tappero cef616fcd8 fixed text titles that should have only the first word capitilized 2017-07-21 10:19:29 -04:00
Fabrizio Tappero 7be14f774d fixed plot menu labels 2017-07-21 10:19:29 -04:00
Maciej Suminski fe89fdfb24 Removed incorrectly defined assert 2017-07-19 13:05:30 +02:00
jean-pierre charras cb75b72978 Refinements if new color 4D selector 2017-07-19 11:26:28 +02:00
Maciej Suminski 984ac70106 Added COMMIT::GetStatus() and minor refactor
Moved duplicated code to a new function and added
an assert to warn against possible memory leak.
2017-07-19 10:46:10 +02:00
jean-pierre charras 5f4599fb56 Add a new color selector, to adjust color selection for GAL mode, with support of opacity (alpha channel)
Pcbnew: save opacity value in color config, and keep it when switching between legacy and gal mode.
2017-07-18 19:07:47 +02:00
Chris Pavlina 5755582c53 Minor FOOTPRINT_FILTER fix 2017-07-17 15:00:13 -06:00
jean-pierre charras ed66496242 Fix an issue (created by commit 16cb6a6ca0) when converting a color4D to a legacy color
Fixes: lp:1704724
https://bugs.launchpad.net/kicad/+bug/1704724
2017-07-17 09:59:34 +02:00
jean-pierre charras 16cb6a6ca0 color4d: fix incorrect conversion from rgb to HSV when r = g = b. 2017-07-16 17:10:24 +02:00
jean-pierre charras d3b382c281 GAL mode: the grid don't fill the full screen when moving the grid origin to negative values.
Fixes: lp:1703330
https://bugs.launchpad.net/kicad/+bug/1703330
2017-07-14 20:18:37 +02:00
Wayne Stambaugh e01eb29758 Symbol and footprint library table parser fixes.
Fix potential memory leak in both footprint and symbol library table
parsers when a duplicate library nickname entry exists.

Parse entire symbol library table before raising duplicate nickname
exception.

Improve the duplicate library table nickname error message to make
life easier for users to fix broken tables.
2017-07-13 10:09:38 -04:00
Maciej Suminski d5095252a0 eeschema: Fixed use-after-free on exit when paste operation is aborted 2017-07-13 13:33:13 +02:00
jean-pierre charras c93ab4d5da Fix possible crash and issues when a incorrect fp lib table is loaded:
correct lines are loaded, and pcbnew / eeschema is no more aborted.
Fixes: lp:1701627
https://bugs.launchpad.net/kicad/+bug/1701627
2017-07-12 20:24:35 +02:00
Maciej Suminski 08c4a0bc7b Fixed SELECTION_TOOL::selectCursor()
In the previous version the method did not work correctly
when an action was invoked from context menu. In such case,
the cursor position was obtained in the moment of selecting
the action, instead of using the right click location.
2017-07-12 09:34:20 +02:00
jean-pierre charras 969209c2cc Fix a few doxygen warnings and add a few comments. 2017-07-04 11:08:27 +02:00
Maciej Suminski 098814e205 Fixed a memory leak in BLOCK_SELECTOR 2017-07-04 10:14:58 +02:00
Maciej Suminski e18475f220 Renamed remaining constants to match the action (see ab44e7cc) 2017-07-04 10:08:33 +02:00
Kristoffer Ödmark 4fb2f80dd4 Eeschema copy/cut/paste to ctrl+c/x/v cut is now undoable Highlight net is now at ctrl+b by default 2017-07-03 16:41:47 +02:00
jean-pierre charras f074b57094 Pcbnew: fix minor issue in %TO.C advanced attribute, and avoid creating an unused D10 tool in Gerber files. 2017-07-02 16:41:31 +02:00
Maciej Suminski 3afef4e19d Display an error when pcbnew.kiface is not available for FP selector
DIALOG_COMPONENT_CHOOSE displays footprint preview when pcbnew kiface
is available, but it crashed when it was not in the same directory
as the executable. Now it displays an error message that allows the
user to quickly identify the problem.

Fixes: lp:1695005
* https://bugs.launchpad.net/kicad/+bug/1695005
2017-06-30 23:01:21 +02:00
jean-pierre charras e3d69b619f Pcbnew: fix issue in dialog_fp_lib_table: when the only changes were the plugin name, changes were not taken in account.
Because the FP_LIB_TABLE::operator == was incorrect
2017-06-30 16:03:17 +02:00
jean-pierre charras 1e770f56a6 Fix a non ASCII7 string in a message. Only ASCII7 chars can be used in sources.
Non ASCII7 symbols are not allowed because the encoding is OS dependent.
2017-06-24 20:05:11 +02:00
jean-pierre charras 0719b99ad8 Minor enhancement in color selection on Windows 2017-06-24 10:45:26 +02:00
Tomasz Włostowski 5c0edbabab Fixes for the connectivity & board cleanup algorithms 2017-06-23 11:12:38 +02:00
Tomasz Włostowski de7f4d7aa4 fixed unresolved symbols while running cvpcb 2017-06-23 11:12:37 +02:00
Tomasz Włostowski 3b16d3cffe further DLIST/Iterators cleanup, some code formatting 2017-06-23 11:12:37 +02:00
Tomasz Włostowski 9ad886344b New connectivity algorithm. 2017-06-23 11:12:36 +02:00
jean-pierre charras 996bcdf458 Fix a few doxygen warnings 2017-06-16 09:18:31 +02:00
jean-pierre charras 2476e88c9d Fix a few doxygen warnings 2017-06-15 13:13:24 +02:00
Wayne Stambaugh 66e97fa905 Doxygen comment improvements.
Fix lots of Doxygen warnings.

Fix Doxygen comment for IO_MGR::FootprintEnumerate() which was recently
changed.
2017-06-13 19:47:46 -04:00
Kristoffer Ödmark 19d5cc7548 Removed all exception specifiers since deprecated.
Exception specifiers are deprecated in cpp11, so went through them all
and removed them from the code.
2017-06-12 13:54:55 -04:00
Maciej Suminski dcc803ecb1 VIEW_CONTROLS::GetMousePosition() returns the mouse position in world coordinates. 2017-06-12 16:24:52 +02:00
jean-pierre charras ad48cd435d Replace SetToolID( ID_NO_TOOL_SELECTED, ...) by SetNoToolSelected() in code 2017-06-12 16:17:48 +02:00
jean-pierre charras 6ed4f9b208 Make EDA_DRAW_FRAME::SetToolID and mouse cursor shape setting working in GAL canvases, and uses same mouse cursor shapes in legacy and gal canvases.
Starting fixing incorrect UI behavior of Zoom to selection in Pcbnew.
2017-06-12 15:16:09 +02:00
Wayne Stambaugh 3cec63e9b9 Pcbnew: plugin improvements.
Allow partial library reads in libraries that support footprint per file.
This includes the KiCad and GEDA footprint libraries.

Allow for partially cached libraries rather than ignoring all valid files
when an error occurs.
2017-06-11 16:21:19 -04:00
jean-pierre charras 526b5e2cd3 Fix broken behavior of the "Zoom to selection" tool in Gerbview and Eeschema. 2017-06-10 09:07:17 +02:00
Fabrizio Tappero 1a30b4fb05 Launch correct default system PDF viewer on Linux.
The is a bug in the wxMimeTypeManager object that sets the wrong default
PDF viewer on Linux.  Using wxLaunchDefaultApplication resolves the issue.

Remove angle brackets <> from error message as this causes issues with
controls that interpret HTML text.

Remove GetChars() from string formatting functions since it is not
required with wxWidgets 3 or greater.
2017-06-07 12:41:04 -04:00
Fabrizio Tappero ac9a64a173 general UI fix. Fixed a lot of icons and a lot of menu.
Also a few no longer used .cpp icon files are removed.
2017-06-02 11:51:11 +02:00
Maciej Suminski e79f97860c Bezier2Poly refactor
Before the refactor library browser display Bezier curves correctly only
once, at other times they were just straight lines or crashed the
application.
2017-05-16 17:58:09 +02:00
jean-pierre charras 5ad1a13096 Fix a compil issue on Windows (W7 32bits). Could be an obscure conflict in var/keyword names. 2017-05-10 14:32:36 +02:00
Maciej Suminski b71fc5564a Code formatting fixes 2017-05-10 11:40:49 +02:00
Oliver Walters cd738297b0 SELECTION_AREA color now indicates selection mode
BLUE = Normal
GREEN = Addition
RED = Subtraction

Line color indicates "window" or "crossing" selection mode
2017-05-10 10:57:29 +02:00
Oliver Walters 1f1143743e HitTest improvement for EDA_TEXT 2017-05-10 10:57:29 +02:00
Oliver Walters b53ba56ac2 Use CTRL modifier to deselect items 2017-05-10 10:57:29 +02:00
Oliver Walters 8b49c6e5ed Alter selection area colours based on selection mode
- Left to Right is slightly blue (as current)
- Right to left is slightly green
2017-05-10 10:57:29 +02:00
Oliver Walters f338d46476 HitTest for Rectangular pads
HitTest for Rectangular pads

- Works at any rotation, even with Shape Offset
- Fixed bugs in D_PAD BoundingBox calculation
2017-05-10 10:57:28 +02:00
Oliver Walters f8734bd057 Fixed ::HitTest for Circle shape
- Testing against rectangle intersection now works correctly
- Previously tested against BoundingBox() not circle outline
2017-05-10 10:57:28 +02:00
Maciej Suminski 99f65f4dbf Added const T& to Eagle PCB import plugin methods 2017-05-04 15:44:14 +02:00
Alejandro García Montoro 9cf934ef17 Moves Eagle XML parser to common, replacing boost with wx.
All E'STRUCTS' are moved to common except for ERULES (which is
specific to pcbnew and needs its internal units), still in
pcbnew/eagle_plugin.{h,cpp}

In order to get rid of another boost dependency, this also changes
the parsing of the XML from Boost.PropertyTree to wxXml.

To replace boost::optional, an OPTIONAL_XML_ATTRIBUTE class has
been implemented. This could be replaced with std::optional when
C++17 is ready.
2017-05-04 15:29:45 +02:00
jean-pierre charras 4f2ed1b05f Plot gerber: fix a minor issue: an aperture attribute was incorrectly set on non copper layers when drawing some pads. 2017-05-04 08:55:17 +02:00
Wayne Stambaugh 096d9fbbf9 Pcbnew: continue loading footprints after first failure.
The footprint library cache handler would throw an exception on the
first error it encountered preventing all subsequent footprint files
from being parsed even if there was nothing wrong with them.  This
commit queues errors until all of the footprint files in the folder
have been parsed.

Fixes lp:1416736

https://bugs.launchpad.net/kicad/+bug/1416736
2017-05-03 15:27:07 -04:00
Eldar Khayrullin f3457794cf Pcbnew: add option to plot DXF editable text
Add option to plot DXF oneline ASCII text as editable text (in non-outline mode)

Fixes: lp:1423515
* https://bugs.launchpad.net/kicad/+bug/1423515
2017-05-02 15:07:19 -04:00
Oliver a39856485c Added component table dialog
- Allows grouping of matched components
- Bulk edit of components in a spreadsheet window
- User can choose to save / undo changes
- All changes are pushed to the undo stack in a single operation
- Export table to HTML / CSV output
2017-05-02 09:39:01 -04:00
jean-pierre charras c8706e9c15 Fix compil issue in Python support. 2017-05-01 14:19:38 +02:00
jean-pierre charras afe92c7bfc Pcbnew: Add creation of Drill Files in Gerber X2 format.
Gerbview: add support of drill files in Gerber format.
Fix also an issue in drill dialog: Axis choice is now common to plot a drill files.
2017-05-01 12:43:40 +02:00
jean-pierre charras a92ea8c75b Fixes: lp:1687014 Footpring editor disappearing axes crosshair
https://bugs.launchpad.net/kicad/+bug/1687014
2017-04-29 11:43:02 +02:00
Eldar Khayrullin 0af5695e51 Pcbnew: add option to plot DXF lines in outline mode.
Add option to plot dialog to plot DXF layers *.Cu, *.Adhes, *.Paste, and
*.Mask in outline mode or line mode.

Fixes lp:1643330

https://bugs.launchpad.net/kicad/+bug/1643330
2017-04-25 08:24:55 -04:00
jean-pierre charras 0e6723bb10 Fix color management in DXF files, broken since a long time. 2017-04-21 16:44:15 +02:00
jean-pierre charras 873e57e63e remove useless or incorrect wxASSERTs 2017-04-21 14:32:06 +02:00
Maciej Suminski 481fd233d4 Enable cursor snapping by default
Fixes: lp:1671869
* https://bugs.launchpad.net/kicad/+bug/1671869
2017-04-20 15:04:05 +02:00
Maciej Suminski 74847bf8ff Code formatting and clean-up 2017-04-20 14:01:38 +02:00
jean-pierre charras e97c91b025 Fixes: lp:1683128 (pcbnew: the cairo canvas ignore arc width)
https://bugs.launchpad.net/kicad/+bug/1683128
2017-04-16 19:21:31 +02:00
jean-pierre charras 88105f891f Fixes Pcbnew bug: Drag Zone Outlines no longer working in legacy view 2017-04-16 18:32:47 +02:00
jean-pierre charras 50fd7a27cf Fix a few coding issues in dialog_edit_module_for_Modedit.
(Mainly, remove OnOkClick and OnCancelClick to use default handlers, and use TransferDataFromWindow to update fields)
Fix also a minor issue in lib_id
2017-04-16 15:09:05 +02:00
Miles McCoo b321efffaf Minor Pcbnew Python scripting fix to expose SHAPE_POLY_SET interface
The recent refactoring work to move zones from CPolyLine to
SHAPE_POLY_SET resulted in a reduction in pcbnew's python
capabilities.  This change exposed SHAPE_POLY_SET to restore
that functionality (albeit with slightly different method names)
2017-04-14 10:23:42 -04:00
Konrad Beckmann c4ea54227e Remove redundant statement in DSNLEXER::PopReader 2017-04-13 14:03:37 -04:00
Simon Wells 117faf898f Disable icons in menus by default on osx 2017-04-13 13:49:55 -04:00
jean-pierre charras 80371134d7 better fix than commit 6c083ebf4c, because the issue was existing in other dialogs
Fix incorrect frame deletion, only noticeable when eeschema is run in stand alone mode.
After selecting a footprint using the footprint viewer, the application cannot be closed.
Reason:
the footprint viewer ctor creates an instance (not shown) of a FRAME_PCB.
Unfortunately, this pcb frame was not deleted by Eeschema, in stand alone mode,
preventing the application to be closed because a frame was still active after closing the schematic editor frame.
Now the footprint viewer ctor delete this instance after use, if it was not previously existing.
2017-04-13 18:28:16 +02:00
jean-pierre charras 6c083ebf4c FOOTPRINT_SELECT_WIDGET: fix incorrect frame deletion, only noticeable when eeschema is run in stand alone mode.
After selecting a footprint using the footprint viewer, the application cannot be closed.
Reason:
the footprint viewer ctor creates an instance (not shown) of a FRAME_PCB.
Unfortunately, this pcb frame was not deleted by Eeschema, in stand alone mode,
preventing the application to be closed because a frame was still active after closing the schematic editor frame.
2017-04-13 15:17:30 +02:00
jean-pierre charras 57ded58231 Cvpcb: fix not working footprint filtering by component keyword. 2017-04-11 08:27:20 +02:00
jean-pierre charras ba37d6fca3 Temporary fix of broken command add corner to zone in GAL mode.
Fixes: lp:1680339
https://bugs.launchpad.net/kicad/+bug/1680339
2017-04-06 19:04:47 +02:00
Maciej Suminski bf590780b8 Do not store 'force cursor position' setting in VIEW_CONTROLS::SETTINGS
Fixes: lp:1678875
* https://bugs.launchpad.net/kicad/+bug/1678875
2017-04-04 00:57:54 +02:00
jean-pierre charras 6eb2000b69 fix Coverity warning (CID 151565) (CID 155147) 2017-04-01 20:05:33 +02:00
jean-pierre charras 04e24282a8 Fix bug: Render->Grid(Color) doesn't saved between kicad sessions.
Fixes: lp:1670084
https://bugs.launchpad.net/kicad/+bug/1670084
2017-04-01 11:48:02 +02:00
Wayne Stambaugh 9c2ebf32f1 Initial symbol library table implementation prep work.
Add loading symbol library table code to schematic PROJECT object.

Fix minor issues with loading global symbol library table.

Add default symbol library path environment variable to the environment
variable list and change the variable name to KICAD_SYMBOL_DIR.

Add code to SCH_SCREENS to test if all library nicknames of the symbol
library IDs are empty.

Remove unnecessary KICAD_USE_SCH_IO_MANAGER build option.
2017-03-31 16:29:34 -04:00
John Beard c3ff34e0df Add reset text attributes function to GAL - use for arc tool
Independent drawing functions (that don't expect any particular state to
be set up fo them) on the GAL need to reset the GAL properties they
use. This adds GAL::ResetTextAttributes() to make this easier.

This is important, as failing to reset mirroring can cause asserts in
OpenGL.

This is used in the Ruler tool (which previously did it one attribute at
a time) and also the Arc layout assistant, which previously failed to
reset mirroring.

Also reset on GAL construction, as these members appear to be
uninitialised.
2017-03-31 15:59:31 +02:00
Jon Evans 8cd1df0524 Add output stream operator for COLOR4D 2017-03-31 06:48:04 -04:00
Chris Pavlina 3234087dc9 Move wxDataViewCtrl manipulators out of dialog_choose_component.cpp
Fixes: lp:1677925
* https://bugs.launchpad.net/kicad/+bug/1677925
2017-03-30 21:47:14 -04:00
Wayne Stambaugh b4e2757119 Make FP_TBL_MODEL reusable.
Factor out the FP_LIB_TABLE specific content from FP_TBL_MODEL into a new
LIB_TABLE_GRID class that can be used for any library table grid mix in.

Create new FP_LIB_TABLE_GRID object for the footprint library edit dialog.

Add method GetEnvVariables() to return any environment variables found in
a LIB_TABLE object.
2017-03-30 18:36:37 -04:00
Jon Evans 3ec28e2acf Refactor layer enumerations to all live in the same place 2017-03-30 16:01:48 -04:00
John Beard ef9f8d40c6 Init GAL class members (Coverity fixes)
Fixes: CID 157139 (GAL)
       CID 157138 (CAIRO_GAL)
2017-03-30 16:05:56 +02:00
John Beard fc7dad600f Ruler tool: reset text mirror/bold/italic before painting
This is required as the OpenGL GAL doesn't support mirrored
text, and if the state is not cleared after painting other mirrored
text, this is what is attempted.

Fixes: lp:1677210
* https://bugs.launchpad.net/kicad/+bug/1677210
2017-03-29 23:27:44 +02:00
Chris Pavlina c8cdb51fa8 Add relational operators to component search
Fixes: lp:1578264
* https://bugs.launchpad.net/kicad/+bug/1578264
2017-03-27 21:26:49 -04:00
Chris Pavlina 4011ed4e31 Convert UTF8 to/from wxString correctly around LIB_ID
Fixes: lp:1675942
* https://bugs.launchpad.net/kicad/+bug/1675942
2017-03-24 21:38:00 -04:00
Chris Pavlina 849b3c2a4b Add footprint select dropdown to component chooser, serious refactoring
- DIALOG_CHOOSE_COMPONENT has footprint select widget
- FOOTPRINT_SELECT_WIDGET
- FOOTPRINT_CHOICE widget (customized wxComboCtrl)
- FOOTPRINT_FILTER class
- FOOTPRINT_INFO rework:
    - FOOTPRINT_ASYNC_LOADER to load without freezing UI
    - Rewrite loader threads as queue-driven thread pool
    - Make FOOTPRINT_INFO available via kiway
- FP_LIB_TABLE::PrefetchLib
- Access to global fp-lib-table via kiway
- SYNC_QUEUE threadsafe queue template
- Remove KICAD_FOOTPRINT_SELECTOR build option
2017-03-24 09:20:27 -04:00
Alejandro García Montoro f68ce306bd CPolyLine -> SHAPE_POLY_SET refactor.
Removes the need of using the legacy code in polygon/PolyLine.{h,cpp},
refactoring all CPolyLine instances with SHAPE_POLY_SET instances.

The remaining legacy methods have been ported to SHAPE_POLY_SET;
mainly: Chamfer, Fillet, {,Un}Hatch.

The iteration over the polygon vertices have been simplified using the
family of ITERATOR classes.
2017-03-24 10:43:47 +01:00
John Beard 5aa1610362 Remove unused g_ShowPageLimits global variable
This variable was only defined, not declared in any header.
2017-03-23 12:47:05 -04:00
John Beard f723a5319c Move some unit related util function to base_units.h 2017-03-23 12:47:05 -04:00
John Beard e98ae3e463 Move executable name constants to own file
The executable name constants are only used by two files, they do not
have to be in common.h.

Also converted to const wxString for better type-safety and removed
old-style wxT macros.
2017-03-23 09:23:45 -04:00
John Beard ece7eeb280 Move SystemDirsAppend to own header
This function is called only from three sites, it doesn't need to be in
common.h.

The implementation was already in systemdirsappend.cpp, so a matching
header was created for it.

This reduces the visibility of the function to only the files that need
it and slightly shrinks common.h.
2017-03-23 09:23:45 -04:00
John Beard 27374c0aa3 Move file locking utilities to a separate file
The global ::LockFile() function is used in a single place, but it's in
common.h, so visible to all files.

The GetKicadLockFilePath function is used in only two places, and one of
them is LockFile.

This commit puts them both in a separate header, so they're only visible
to code using them.

The implementation of GetKicadLockFilePath is moved to lockfile.cpp,
where LockFile already was.

Also removed a (large) handful of wxT macros, which aren't needed any
more and make code less readable.
2017-03-23 09:23:45 -04:00
John Beard 0799d9e45c OPENGL_GAL: Init currentTarget
The currentTarget member of OPENGL_GAL is not initialised, but the
currentManager member is.

This commit uses SetTarget to initialise both target and manager to a
consistent state at construction.
2017-03-23 14:08:26 +01:00
John Beard 9fe780f1b3 Rework zone creation in GAL
The zone creation in DRAWING_TOOL was a complex event loop whici
simultaneously managed the event handling, construction of the preview
polygon and the creation and commiting of the zone, all in the same
scope. This has been broken into several pieces:

* POLYGON_ITEM preview item, used to preview the polygon in progress
* POLYGON_GEOM_MANAGER is a class that collects points from user input
  and used them to describe a polygon's geometry, including calculation
  of 45-degree constrained leader lines
* ZONE_CREATE_HELPER is a class which deals with creating zones based on
  geometry from a geometry manager and parameters from the DRAWING_TOOL
* The (much simpler) event loop in DRAWING_TOOL drives the
  POLYGON_GEOM_MANAGER. With a minor refactor, this loop can be reused
  in future for other polygonal tools if wanted.

The polygon preview now has a translucent fill which makes it easier to
visualise the zone.

This also adds the Close Zone Outline and Delete Last Corner actions as
part of the new event loop.

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

Fixes: lp:1667885
* https://bugs.launchpad.net/kicad/+bug/1667885
2017-03-22 17:18:12 +01:00
John Beard d99fbddc22 Enable angle snap for pcbnew GAL ruler tool
This uses the two-point geometry manager to split the logic of the ruler
geometry and the preview item display. This allows the ruler to use that
manager's angle snap feature.
2017-03-22 10:59:47 +01:00
Maciej Suminski ddf4f3b2bc Remove not used cursor fields & methods in Cairo GAL 2017-03-22 10:37:43 +01:00
John Beard b8edecc10f Move cursor shape flag into GAL settings
The motivation here is to concentrate display options in the GAL display
settings, ready for removal of legacy canvases. Instead of having the
property as a member of the DRAW_FRAME, with the GAL canvas retreiving
it from there, it is now in the GAL_DISPLAY_OPTIONS struct, and both GAL
and legacy get it from there.

The options for setting cursor shape are then moved out of the general
options dialog, and into the GAL display options widget, where they can
be used in all GAL-aware programs.

GAL cursor shape works on GAL, but not legacy, so the option is now
available on OSX (but only affects GAL, and is labelled as such).
2017-03-22 10:24:48 +01:00
John Beard b4a4748672 Move sketch mode area in pcbnew display options
This gives a bit more space to the GAL options in the left panel

Also tidy up some code style and unnecessary default arguments in the
GAL display planel widget.
2017-03-22 10:24:48 +01:00
John Beard 01c733bdb5 Dim GAL cursor when forced but no interactive tool
This makes it clearer when a tool is active, otherwise interactive tool
effects like auto-pan can come as a surprise when the cursor is forced
to display all the time.
2017-03-22 10:24:48 +01:00
John Beard 78a5185857 Allow GAL cursor to be always displayed
A new items is added to the GAL display options (and the dialog), and a
hotkey (Ctrl+Shift+x) is added to toggle it.

Fixes: lp:1673633
* https://bugs.launchpad.net/kicad/+bug/1673633
2017-03-22 10:04:56 +01:00
jean-pierre charras c20cf4a3e0 Fix incorrect calculations in GAL DrawGrid() methods, that create very long calculation time when the grid origin is not 0 2017-03-21 13:09:24 +01:00
jean-pierre charras c2227abb36 Specctra import: accept layer names like numbers (i.e. +12). 2017-03-20 19:50:07 +01:00
jean-pierre charras 230980fc9d Compile specctra file with pcbnew files, not with pcbcommon files (they are now used only by pcbnew) 2017-03-20 19:49:10 +01:00
John Beard ce731f8b62 Add GAL microwave tools
This adds the microwave tools to GAL in Pcbnew as a new tool:
MICROWAVE_TOOL.

Some new preview items are introduced to support this:

* TWO_POINT_GEOM_MANAGER for managing construction of two-point
  geometries, such as that used to construct the inductor.
* CENTRELINE_RECT_ITEM a preview item to draw ractangle with a given
  aspect ratio along a line (specified using a TWO_POINT_GEOM_MANAGER)

PCB_TOOL gets a generic event loops which should be useful for more
than just microwave tools:

* doInteractiveItemPlacement() - handles event loops that wait for a
  click, create an item on click and then allow moving it
  around/flipping, etc.

Fixes: lp:1531323
* https://bugs.launchpad.net/kicad/+bug/1531323
2017-03-20 16:10:51 +01:00
Tomasz Włostowski f599f10a03 gal: reset autopan state when autopanning is disabled
Fixes: lp:1674022
* https://bugs.launchpad.net/kicad/+bug/1674022
2017-03-20 11:45:57 +01:00
jean-pierre charras 2637835a1e First version of courtyard overlap detection 2017-03-19 20:27:45 +01:00
Chris Pavlina 200c3f78a0 LSET: undefined behavior in va_start() 2017-03-17 22:43:54 -04:00
Chris Pavlina 7360bdb7eb SPIN_INCREMENTAL_TEXT_CTRL: unused member warning 2017-03-17 22:42:43 -04:00
John Beard 5f303f7b25 Enhance Pcbnew arc construction
This adds a richer overlay to the arc-by-three-points tool in Pcbnew,
including more guide-lines and a live display of radius and angle.

Also included is ability to go back to the previous step (if setting end
angle, you can go back to setting start point, etc) using Backspace, and
Ctrl snaps the start/end angles to 45 degree multiples.

This adds new classes

* MULTISTEP_GEOM_MANAGER: represents a generic "geometry manager" that
  builds up some geometrical construction based on a sequence of points.
  Used by:
* ARC_GEOM_MANAGER: handles the logical flow of constructing an
  arc by centre-point, set radius, set angle. This moves the logic out
  of the Pcbnew DRAWING_TOOL event loop in drawArc().
* ARC_ASSISTANT: graphical overlay to communicate current arc shape to
  the user during the drawing process
2017-03-17 20:56:54 +01:00
Miles McCoo db174862c8 Minor Pcbnew Python scripting improvements.
Add typedef for wxCoord to wx.i to enable usage of methods like
EDA_RECT.Inflate.

Added id.h to pcbnew.i to expose window toolbar identifier names.

Added Refresh() and WindowZoom() to pcbnew_scripting_helper.
2017-03-17 10:41:00 -04:00
Wayne Stambaugh 9ddb4fe67e Fix uncaught exception in footprint and symbol library table parsers.
Fixes Coverity CID 154580
Fixes Coverity CID 154581
Fixes Coverity CID 154582
Fixes Coverity CID 154583
Fixes Coverity CID 154584
Fixes Coverity CID 154585
2017-03-17 07:56:47 -04:00
John Beard 996cba7e7f Fix GAL display properties spin buttons on Windows 2017-03-16 10:40:06 -04:00
John Beard f2aa4d2911 Make GAL options panel a reusable panel
The primary motivation here is to allow other GAL canvas users (eg
Modedit, and soon Gerbview) to be able to easily modify GAL canvas
options.

For now, this doesn't change the display properties dialog in
appearance, but if more GAL options are added, it might need a bit of
tweak and maybe tabs or similar, like Eeschema preferences.
2017-03-16 08:01:26 -04:00
Tomasz Włostowski 3cc90ce2d2 Fixed center-on-zoom behaviour in the GAL canvas
Fixes: lp:1672868
* https://bugs.launchpad.net/kicad/+bug/1672868
2017-03-15 11:48:35 +01:00
Maciej Suminski fe4f02f5b9 Coverity fixes
CIDs:
- 153097
- 157120
- 157119
- 155148
- 155146
- 153103
- 153099
- 153095
- 153087
- 153086
2017-03-11 22:20:08 +01:00
Jon Evans 082b8dd2a9 Refactor BRIGHT_BOX to common so it can be used by other programs 2017-03-11 21:38:01 +01:00
Chris Pavlina bbaa29fbc4 Refactor FOOTPRINT_PREVIEW_PANEL
- Pull out compound widget bits into FOOTPRINT_PREVIEW_WIDGET
- Move all pcbnew-specific bits *inside* pcbnew; implementation should
  be private for users
- Make a few class members and inner types private
2017-03-10 23:26:45 -05:00
Maciej Suminski f46961d003 Fix a memleak in COLOR_SWATCH 2017-03-10 17:56:41 +01:00
John Beard 8c3b8ee693 Add a ruler tool to pcbnew GAL
This allows to measure between features on a PCB. It uses a preview
EDA_ITEM in common, but due to the use of the IDs, it's currently
Pcbnew/Modedit only.

This also adds several "utils" for graphical functons useful when
drawing preview items on GAL canvases.

Fixes: lp:1467313
* https://bugs.launchpad.net/kicad/+bug/1467313
2017-03-10 16:21:44 +01:00
John Beard 9c08873210 Make SELECTION_AREA a generic overlay item
This simplifies the (already simple) SELECTION_AREA class. It is also
moved into KIGFX::PREVIEW and put in the common library, where it can be
reused by other GAL-aware tools (not just in Pcbnew) in future.
2017-03-10 16:21:44 +01:00
John Beard 5e84e953f3 Add a simple item class for graphical overlays
This introduces SIMPLE_OVERLAT_ITEM, which is an abstract EDA_ITEM,
designed for use as an overlay for assisting interactive tools.

The item is drawn only on the GP_OVERLAY layer, and sets the fill,
stroke and line properties before calling a virtual function to draw the
shape, which will depend on the implementaiton of the derived class.

The motivation here is to simplify and unify basic overlays used when
in interactive tools. It is not designed to be the base class of all
possible overlays - more complex ones would be more clearly represented
as their own derivative of EDA_ITEM.

Applications of this class can include: zoom/select rectangles, zone
polygon previews, geometric shape helpers, and so on.
2017-03-10 16:21:44 +01:00
Maciej Suminski 11f8e53e27 Smoother arc rendering in OpenGL GAL
Fixes: lp:1496114
* https://bugs.launchpad.net/kicad/+bug/1496114
2017-03-10 14:08:59 +01:00
Jon Evans 3208d24ad4 Add DrawArcSegment() GAL method, to support drawing outlined arcs 2017-03-10 14:08:59 +01:00
Simon Richter bb61cd5a50 Add missing header
color_swatch.cpp uses std::unique_ptr
2017-03-08 10:39:11 -05:00
Simon Richter ef0a5ff71c Make Mac-specific function conditional
If we want to have an override marker on this function, it needs to be
conditional on Mac.
2017-03-08 10:24:59 -05:00
Maciej Suminski 62235348d1 Use GAL axes instead of a ORIGIN_VIEWITEM in module editor 2017-03-08 10:35:51 +01:00
Jon Evans 2513f0b002 Add setting to have GAL draw axes on the grid 2017-03-08 09:37:40 +01:00
Chris Pavlina cf373e543f Fix Windows (and macOS?) build error caused by 11f4622ea 2017-03-07 17:51:25 -05:00
Chris Pavlina 11f4622ea5 Fix GL assertion failure during GAL teardown 2017-03-07 14:37:02 -05:00
Wayne Stambaugh ef74f245cb Fix broken HTML formatting in about dialog. 2017-03-07 14:18:37 -05:00
Tomasz Włostowski eedf7cb243 Switched coroutine library from Boost libcotext to custom libcontext.
Fixes lp:1658249

https://bugs.launchpad.net/kicad/+bug/1658249
2017-03-07 11:45:29 -05:00
Maciej Suminski 338735c5bf Added a missing include to tool_manager.h
Previously full information about VC_SETTINGS type was not
available, so it was not possible to create a VC_SETTINGS stack
for some compilers.
2017-03-07 17:18:58 +01:00
Maciej Suminski c6e3ac7067 Removed boost::adaptors from TOOL_MANAGER 2017-03-07 17:18:22 +01:00
John Beard c86773462f GAL: Respect SHAPE_LINE_CHAIN closed setting
When drawing polylines using SHAPE_LINE_CHAIN, the polyline is always
was drawn closed in GAL and open in Cairo, regardless of the state of
SHAPE_LINE_CHAIN.
2017-03-07 13:28:14 +01:00
Chris Pavlina f8415633bd Switch component chooser to wxDataViewCtrl, refactor
This refactors COMPONENT_TREE_SEARCH_CONTAINER into a Model-View-Adapter
architecture comprising:

- eeschema/cmp_tree_model.h
    - CMP_TREE_NODE: Base class representing a searchable library
        set with scoring and sorting

        - CMP_TREE_NODE_UNIT
        - CMP_TREE_NODE_ALIAS
        - CMP_TREE_NODE_LIB
        - CMP_TREE_NODE_ROOT

- eeschema/cmp_tree_model_adapter.h
    - CMP_TREE_MODEL_ADAPTER: mediator between wxDataViewCtrl (via
        wxDataViewModel) and CMP_TREE_NODE*

                   +---+                      +------------------+
 +---+  Generates  | A |                      |       VIEW       |
 | M |  from libs  | D |   wxDataViewModel    |------------------|
 | O | <---------- | A | <------------------> |  wxDataViewCtrl  |
 | D |             | P |                      |------------------|
 | E | <---------> | T | <------------------- |    wxTextCtrl    |
 | L | UpdateScore | E | UpdateSearchString() |------------------|
 +---+             | R |                      |                  |
                   +---+                      +------------------+

Representing the data with a proper model allows the wxDataViewCtrl to
be updated in bulk, which is significantly faster than the old method of
populating it one item at a time. This also adds flexibility if more
data is to be added in the future (which may come in handy with the
upcoming .sweet format, as that adds more ways components can be related
to each other).

Replacing the wxTreeListCtrl with a wxDataViewCtrl also significantly
reduces the general GUI quirkiness, as wxDataViewCtrl is much more well
behaved.
2017-03-06 09:50:48 -05:00
Maciej Suminski fc4240886b Store VIEW_CONTROLS settings on a stack
This is the right implementation of the commit b25ded4d.
Previously if there were tools launched from another tool,
the settings could be stored in a wrong TOOL_STATE object.
2017-03-06 15:04:27 +01:00