Commit Graph

2584 Commits

Author SHA1 Message Date
Jon Evans a52250a91e Change from EDA_COLOR_T to COLOR4D globally; arbitrary color support
eeschema now supports arbitrary colors for all object types, and
pcbnew does in GAL canvas.  When switching from GAL to legacy canvas,
pcbnew will convert colors to the nearest legacy color.
2017-02-22 17:35:00 +01:00
Jon Evans 4c83b0a94d Move TOOL_ACTIONs to their corresponding tools; create COMMON_TOOLS
Some grid/zoom tools are left in PCBNEW_CONTROL because they currently
depend on Pcbnew-specific class members.  Once refactoring is done to
make it possible to use all zoom and grid controls outside of pcbnew,
these last tools can be moved to common to match their ACTIONs.
2017-02-22 10:32:48 +01:00
Jon Evans 167f45ca2b Refactor COMMON_ACTIONS into a base and derived class
New virtual class ACTIONS is added as a member to EDA_DRAW_FRAME so
that the TOOL_DISPATCHER can have access to the appropriate derived
version of TranslateLegacyId()
2017-02-22 10:32:48 +01:00
John Beard a8eea6155a Move bitmaps.h out of base_struct.h
bitmaps.h was included in nearly every file in the project due to it
being included by base_struct.h

Only about 130 files actually use the XPM definitions defined there, and
many of those already included bitmaps.h themselves, or via
menu_helpers.h. However, touching bitmaps.h would result in over 400
rebuilt files for pcbnew alone.

This commit moves the bitmap-related types like BITMAT_DEF out to a new
header, which is still included by base_struct.h, which is less
avoidable for now, it's it's used in the interface.

The icon list is still in bitmaps.h. This has the side effect that's
it's now easier to automatically generate this file.

Many classes in pcbnew and eeschema needed some functions moved
to the implementaitons from the headers too.
2017-02-21 09:50:15 -05:00
John Beard ca91c27852 Adjust pad sub-menu enablements
The apply settings and push settings options now take account of the
validity of the global pad settings when deciding whether to show or
not.

Global pad push now requires a source pad and doesn't push from the
global pad setting when there is no selection.

The whole submenu is hidden when there are no enabled items.

Fixes: lp:1664016
* https://bugs.launchpad.net/kicad/+bug/1664016
2017-02-20 11:08:34 +01:00
John Beard 8766b475c6 Sanitise incoming GAL config options using mapping tables
When reading config options from files, it's important to make sure the
value makes sense - the incoming data could be anything, and may have
incompatible values or be otherwise unreliable.

This introduces a simple way to define and use "mapping tables" which
can map between a "native" value, probably an enum (but not necessarily)
and some external value, for example the value written to file.

This provides a decoupling between the two values, as well as sanitising
inputs and outputs. This is important, as over time, if there isn't a
decoupled interface, changing options result in corrupt configs, or a
proliferation of obsolete enum values kept for compatibility.
2017-02-20 10:52:34 +01:00
John Beard 1f5619f740 Add protected virtual dtor for GAL_DISPLAY_OPTIONS_OBSERVER
GAL_DISPLAY_OPTIONS_OBSERVER aren't deleted by a base class pointer -
they are an "incidental" part of other classes. Add a virtual protected
destructor to make this explicit.
2017-02-20 10:52:34 +01:00
John Beard 0bf3a19967 Add user control for grid minimum spacing in GAL
This allows the user to set a thicker grid line without causing the
grid lines to become over dense, or just make the grid denser according
to preference.

The term "density" is modified to "minimum grid spacing", which is
the pixel spacing between adjacent grid lines.

The spacing settings now comes in along, with other GAL display settings,
as part of GAL_DISPLAY_OPTIONS observer functionality. To this end, the
setter in GAL interface is removed, as an external user should be
setting this parameter via the GAL_DISPLAY_OPTIONS interface.
2017-02-20 10:52:34 +01:00
John Beard 970e4f8eb4 Add grid line thickness control to Display Options Dialog
This adds a user-settable control for the grid line thickness on GAL
canvases to the display options dialog.

The thickness settings now comes in, along with other GAL display
settings, as part of GAL_DISPLAY_OPTIONS observer functionality. To this
end, the setter in GAL interface is removed, as an external user should
be setting this parameter via the GAL_DISPLAY_OPTIONS interface.

Fixes: lp:1662482
* https://bugs.launchpad.net/kicad/+bug/1662482
2017-02-20 10:52:34 +01:00
John Beard 061d659bb1 Add a class to govern an "incrementing" text control
This class, INCREMENTAL_TEXT_CTRL, is used to provide a frameworks for
classes that want to control a text control that can be incremented
according to some scheme.

Also provided is a wxWidgets implementation with spin buttons for
control, as well as mousewheel support.
2017-02-20 10:52:34 +01:00
John Beard ff3bfaf82b Make KIGFX::GRID_STYLE an enum class
This provides stronger typing to these values.
2017-02-20 10:52:34 +01:00
John Beard 7ad30b7167 Move Grid style to Graphics Options dialog
This puts the graphical/display options with the other similar options
in that dialog, rather than with the dimension options found in the Set
Grid dialog, which is in the Dimensions menu.

Also place the option itself in the GAL Display Options structure, so it
can be updated using the observer mechanism there.

The setter for the style in the GAL interface is removed, as the public
interface for setting this option is now to modify the
GAL_DISPLAY_OPTIONS structure and notify the GAL when done.
2017-02-20 10:52:34 +01:00
John Beard ddded86a06 Give all GAL canvases access to a GAL_DISPLAY_OPTIONS structure instance
Also loads the gal options when loading a canvas, as the canvas
otherwise might not register the initial settings.
2017-02-20 10:52:34 +01:00
John Beard cdfcc9a2ab Put draw_frame.h GAL_DISPLAY_OPTIONS behind firewall
The GAL_DISPLAY_OPTIONS member of EDA_DRAW_FRAME is a private member and
is used in only a couple of places in the class. The real use of this
member is by a by-ref interface, GetGalDisplayOptions.

Because te GAL options are used by a very select few users of
EDA_DRAW_FRAME, it makes little sense to force all the (many) files
including draw_frame.h to also include gal_display_options.h, when the
vast majority have no need for it.

This massively speeds up compilation of the project when
gal_display_options.h is changed.

More isolation could be acheived by separating the GAL config types (eg
OpenGL antialias modes and grid style) from the options header, as,
although the GAL class uses them, not many includers of the GAL header
need the options struct as well.
2017-02-20 10:52:33 +01:00
Jon Evans 9d68c970dc Remove dependence on LAYER_ID from EDA_DRAW_PANEL_GAL 2017-02-20 09:15:55 +01:00
Chris Pavlina 3d88cc2a36 Rename method for consistency with similar class
FOOTPRINT_PREVIEW_PANEL::AddToPanel -> InstallOnPanel
2017-02-19 07:53:02 -05:00
Chris Pavlina fb6bf0c861 Fix SetColumnWidth() assertion in TWO_COLUMN_TREE_LIST
Fixes: lp:1665982
* https://bugs.launchpad.net/kicad/+bug/1665982
2017-02-19 06:38:53 -05:00
Chris Pavlina 2632b1d1a0 Revamp component chooser and add footprint preview
This commit brings several changes:

- Add a footprint preview pane to the eeschema component selector
- Upgrade component list to wxTreeListCtrl
- Factor out wxTreeListCtrl subclass TWO_COLUMN_TREE_LIST which
  patches a column size bug
- Linkify datasheet URL in info pane
2017-02-18 21:39:55 -05:00
Jon Evans 7cd72d6ffb Move layer colors from PCB_RENDER_SETTINGS to RENDER_SETTINGS 2017-02-16 17:30:31 +01:00
Wayne Stambaugh eb06b35852 Eeschema: fix schematic I/O plugin symbol name issue.
LIB_ID was changing the symbol name due to the parser dropping everything
past the first '/' character which is interpreted by LIB_ID as the item
version.  Add flag to ignore this in LIB_ID::SetLibItemName() and add a
new ctor so the library nickname, item name, and revision can be set as
required to prevent the standard LIB_ID parsing.

Fix a few places where PART_LIBS functions FindLibraryAlias() and
FindLibPar() were translating wxString symbol names to LIB_IDs where the
LIB_ID parser was truncating the symbol name.
2017-02-11 13:44:17 -05:00
Wayne Stambaugh 73bbc35c3e Make the schematic I/O plugin the only option.
Add SCH_PLUGIN object to PART_LIB object.

Convert all PART_LIB I/O to use SCH_PLUGIN.

Remove library caching from PART_LIB and use caching provided by SCH_PLUGIN.

Add support to use PROPERTIES for buffering and document file write control
instead of adding code the SCH_PLUGIN object in the SCH_LEGACY_PLUGIN that
will not be required when the new file formats are implemented.

Add buffering to SCH_LEGACY_PLUGIN to prevent cache from writing file on
every change to library.  This is to prevent the cache library from being
written every time a new symbol is added.

Add option to not save library document file when saving library.  This is
primarily used by the cache library write code.

Move symbol library write code out of LIB_PART and into SCH_LEGACY_PLUGIN.

Add exception handling where LIB_PART caught the exception and returned
an error status.

Remove KICAD_SCH_IO_MANAGER build option as it is no longer optional.
2017-02-10 08:36:57 -05:00
Maciej Suminski 060e163511 Fixed invoking TOOL_ACTIONs in submenus
Fixes: lp:1663101
* https://bugs.launchpad.net/kicad/+bug/1663101
2017-02-10 00:08:23 +01:00
Nick Østergaard 1cb171acf0 Rename bitmaps to match the new pad tool naming 2017-02-07 23:08:09 +01:00
Chris Pavlina bca74853d1 Display more information in component selector 2017-02-07 15:01:20 -05:00
Maciej Suminski 6561c8e61a Fixed a crash occuring on closing pad properties dialog in Windows
Fixes: lp:1660276
* https://bugs.launchpad.net/kicad/+bug/1660276
2017-02-07 00:07:43 +01:00
Maciej Suminski 4b9243e0bf Allow registering TOOLs in any order. 2017-01-30 13:21:43 +01:00
Diogo Condeco 75ffcbcef5 MACOS Setfocus and CancelButtonIssue moved into dialog_shim.
Setfocus now works on macos dialogs by setting DLGSHIM_USE_SETFOCUS.
This option is only enabled __WXMAC__ is defined.

FixOSXCancelButtonIssue() is now called inside DIALOG_SHIM::SHOW.
All other calls from within the dialogs were removed.
2017-01-29 23:51:35 +01:00
jean-pierre charras 7bda89cdf6 Rework on plugins reload code: avoid duplicate code. 2017-01-29 12:25:19 +01:00
jean-pierre charras 6c5808fd18 Update dale of last change. Add a small comment about CTL_OMIT_HIDE. 2017-01-29 09:29:49 +01:00
jean-pierre charras a7c4c8c7f2 Pcbnew: Fix a crash when reloading python scripts, when Kicad uses wxPython.
also, refresh the board editor action plugins menu, when reloading python scripts from the footprint wizard selector.
2017-01-28 18:47:11 +01:00
Dick Hollenbeck 35fc1f3361 Move "hide" back to prior fp_text location 2017-01-28 09:33:25 -05:00
Maciej Suminski 80956ef1e6 Added GAL::DrawPolygon(SHAPE_POLY_SET) & GAL::DrawPolyLine(SHAPE_LINE_CHAIN) 2017-01-27 19:08:32 +01:00
jean-pierre charras 6329ca5065 Gerbview: add in file menu an option to load a zip archive containing Gerber and/or drill files. 2017-01-26 10:45:28 +01:00
Dick Hollenbeck 0c459ced97 EDA_TEXT object refactor.
Make all EDA_TEXT data private and rename accessors to avoid function
name collisions in derived classes.

Overload EDA_TEXT's SetTextAngle() and SetEffects() in TEXTE_PCB.

Add support for preserving Reference text position, size, orientation
during a netlist import into a BOARD, as well as the one off footprint
update dialog.
2017-01-25 08:03:32 -05:00
Maciej Suminski 1102eb0d0d Store menu titles in CONTEXT_MENU
Previously a title had to be provided when a submenu was added,
but this led to storing the same title in many places.
2017-01-23 14:52:11 +01:00
jean-pierre charras 2b5769c0a8 Action plugins: simplify code, and fix an issue: the menubar was not correctly rebuilt after closing and reopening pcbnew from kicad.
It was also not correctly rebuilt after language change.
2017-01-23 13:27:49 +01:00
Jean-Samuel Reynaud 5ef3e5a15d Pcbnew: Add ACTION_PLUGINS class. It allows loading python scripts in footprint editor and run them from the Tools/External Plugins menu
This plugin mechanism is enabled only if option -DKICAD_SCRIPTING_ACTION_MENU=ON (it is off by default)
It imply -DKICAD_SCRIPTING=0N
This is currently for testing purposes only for developers, not yet for users.
2017-01-23 13:27:49 +01:00
jean-pierre charras df0d102b9c Remove unused icons. cleanup a svg file (no actual change in icon). 2017-01-23 13:27:03 +01:00
John Beard 89fe9d378c Add C++14-style std::make_unique 'polyfill' for C++11
std::make_unique is a very useful part of the new C++ smart pointers
ecosystem, as it allows one to dispense entirely with "new" and also
provides exception safety in some cases when creating temporary
variables.

It also allows more concise code by avoiding repetition of the type:

    std::make_unique<TYPE>( args );

vs

    std::unique_ptr<TYPE>( new TYPE( args ) );

This commit adds a "polyfill" to provide std::make_unique when C++11 is
enabled. The implementation is that submitted to the C++ committee, and
is essentially how it is done in GCC for C++14.

The intention is to allow KiCad to use this implementation when using
C++11 and when C++14 or greater is a requirement, to remove this code
and use the compiler implementation.
2017-01-23 11:41:00 +01:00
John Beard 7863e70181 Move PostCommandMenuEvent to EDA_BASE_FRAME
There is nothing PCB-frame-specific about this function,
it is equally applicable to an frame, for example
PCB_EDIT_FRAME and CVPCB_MAINFRAME, which have EDA_BASE_FRAME
as the nearest common ancestor, except KIWAY_PLAYER,
which is not really concerned with this kind of UI event method.
2017-01-23 11:41:00 +01:00
Maciej Suminski fc7be1a497 Removed redundant CONTEXT_MENU::m_parent field. 2017-01-23 11:40:59 +01:00
Maciej Suminski 682da70a86 Fixed the issue of creating and event handling in context menus (GAL).
When creating a copy of CONTEXT_MENU, always a CONTEXT_MENU instance was
constructed, whereas an inherited type should be used. Solved with
CONTEXT_MENU::create() that has to be overridden in inheriting classes.

Event & update handlers are now virtual functions, instead of setting
the handlers with Set{Event,Update}Handler().
2017-01-23 11:40:59 +01:00
Robbert Lagerweij 550a1ea4d6 eeschema: set title of plotted pdf to sheet title
Fixes: lp:1656956
https://bugs.launchpad.net/kicad/+bug/1656956
2017-01-20 17:11:12 -05:00
Tomasz Włostowski ba9576b014 router: snap to clearance boundaries in Highlight Collisions mode
Fixes: lp:1655819
* https://bugs.launchpad.net/kicad/+bug/1655819
2017-01-19 17:47:15 +01:00
Maciej Suminski 3c61b16e7b Code formatting 2017-01-18 13:22:40 +01:00
Maciej Suminski c758f434c0 Removed unused fields in VIEW & ANTIALIASING_SMAA classes 2017-01-18 13:22:18 +01:00
Maciej Suminski 004ca3c6f9 Fixed a memory leak in VIEW_ITEM (proper way of doing 9bc2bb2)
The problem with simple deleting VIEW_ITEM_DATA upon VIEW_ITEM removal was
caused by the default copy constructors that copied pointers.
Once a copy of an item was destroyed, the VIEW_ITEM_DATA has been
destroyed, effectively invalidating m_viewPrivData for the other item.
2017-01-16 14:57:50 +01:00
jean-pierre charras d0db2de015 Cosmetic enhancement in pcbnew menubar: use specific icon in menuitems to switch canvases, and add a marker to the mode currently in use 2017-01-14 14:43:45 +01:00
Maciej Suminski 88eb648cbb Alternative way of handling OpenGL initialization & errors
Some faults could result in a crash, as they were not properly
handled. Now the rendering loop is wrapped with try..catch block
which will revert to Cairo in case of an error and display an
error message.

Fixes: lp:1655766
* https://bugs.launchpad.net/kicad/+bug/1655766
2017-01-13 16:50:36 +01:00
Maciej Suminski ca085de6aa Initialize fields in COMPOSITOR 2017-01-13 16:46:45 +01:00