Commit Graph

2894 Commits

Author SHA1 Message Date
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
Maciej Suminski d1550b0cdb Renamed VIEW_CONTROLS::SETTINGS to VC_SETTINGS.
Because nested types cannot be forwarded.
2017-03-06 15:04:27 +01:00
Maciej Suminski ac38f1112d Removed duplicated code from TOOL_MANAGER::RunAction() 2017-03-06 15:04:27 +01:00
Chris Pavlina 1cee5780a5 Fix GAL focus bug
Caused by yours truly in 4618e6c7
2017-03-05 13:58:31 -05:00
Chris Pavlina 4618e6c7f8 Component chooser: event and focus cleanup 2017-03-04 11:14:04 -05:00
Maciej Suminski e6cfb6af52 Revert "Fix setting the background color in OPENGL_GAL"
Causes flickering on some GPUs.
This reverts commit ca985791bc.
2017-03-04 08:51:35 +01:00
Maciej Suminski 94d8e1e69c Fixed a memleak in ReadHotkeyConfig() 2017-03-04 08:38:35 +01:00
Cirilo Bernardo 68bcdec87e Workaround for non-ASCII filenames in Windows 2017-03-03 14:30:47 -05:00
jean-pierre charras 4eeed8d04f Icons options menu: code rework 2017-03-03 14:18:25 +01:00
Jon Evans 88f7c55d95 Move ZoomFitScreen and ZoomPreset from PCBNEW_CONTROL to COMMON_TOOLS
BOARD::GetBoundingBox() now directly calls BOARD::ComputeBoundingBox()
and there is a new method BOARD::GetBoardEdgesBoundingBox() used for
call sites that needed to use ComputeBoundingBox( true ) in the past.

This allows COMMON_TOOLS to implement ZoomFitScreen without knowledge
of the BOARD class.
2017-03-03 13:28:19 +01:00
Maciej Suminski 906ee77dbf Fixed VIEW_ITEM memory leaks 2017-03-02 23:57:13 +01:00
jean-pierre charras e7e972804a Make show/hide icons in menus a run time option, instead of compil option. 2017-03-02 15:45:54 +01:00
Maciej Suminski 1d8730752c Restore valid force cursor setting before saving VIEW_CONTROLS settings
There are times, when TOOL_MANAGER has to force cursor position
to make tools work as expected (e.g. when popping up a menu,
so tools get the right click position instead of current position
pointing to an entry in the menu).

If another tool is invoked, VIEW_CONTROLS settings have to be stored
in the TOOL_STATE object. In such case, it is necessary to revert the
force cursor setting when saving VIEW_CONTROLS settings.

Fixes: lp:1668712
* https://bugs.launchpad.net/kicad/+bug/1668712
2017-03-02 12:07:09 +01:00
Maciej Suminski ca985791bc Fix setting the background color in OPENGL_GAL
Fixes: lp:1669098
* https://bugs.launchpad.net/kicad/+bug/1669098
2017-03-02 09:32:10 +01:00
John Beard 4547b2e26d Don't init wxBitmaps before GUI is ready
Init'ing static wxBitmaps in the global scope happens before the GUI is
ready, which segfaults, at least on GTK+. This can happen in, for
example, the Python module. In normal use, the singletop/kicad
loader has initialised the GUI first, so it doesn't manifest there.
2017-03-01 13:28:10 +01:00
jean-pierre charras 8526935183 GAL: better progression between zoom in/zoom out (in/out/in sequence keeps the same zoom value) 2017-03-01 13:00:42 +01:00
jean-pierre charras 1cffcafe2d GAL mode: Add small cross option to grid style (now: options are Dots, Grid, Small cross) 2017-03-01 10:29:19 +01:00
John Beard 1d039cb4c1 Break row indicators out to own class
The introduces INDICATOR_ICON, which is a very simple class holding a
bitmap that can toggle on or off.

The ICON_PROVIDER class then provides icons to INDICATOR_ICONS, which
means the class can be used for more than just row indicators.

A default row icon provider is also provided for use in the standard row
selector.
2017-03-01 09:44:41 +01:00
John Beard b8d0b0d7be Move layer/render swatches to own class
This introduces COLOR_SWATCH, which is a reusable
widget that shows a color swatch and can invoke the colour picker
when duble/middle clicked.

It uses it's own wxCommandEvent to signal the change.

This makes the layer widget simpler internally, and also allows other
code to show identical swatches if needed.
2017-03-01 09:44:41 +01:00
Jon Evans fd4e2b042c Refactor SELECTION, SELECTION_CONDITIONS, and context menus to common
SELECTION now holds EDA_ITEMs not BOARD_ITEMs so various places had to
change to casting the selected items to BOARD_ITEMs.

Fixed compilation warnings on clang (Tom)
2017-02-28 14:47:20 +01:00
Jon Evans 0afb249447 Add drawing priority support to VIEW
Call UseDrawPriority( true ) after creating GAL to enable.

VIEW::Add() gets a new optional argument to specify the draw order
when adding an item.  If the new argument is left default, the draw
order will increment with each call of VIEW::Add().

Fix std::bind calls after change to VIEW::Add
2017-02-28 14:47:20 +01:00