Commit Graph

2628 Commits

Author SHA1 Message Date
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
jean-pierre charras 0be56451b1 More optimization in project rescue. 2017-03-10 10:31:50 +01: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
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
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
Chris Pavlina 541b91fd15 Fix FOOTPRINT_PREVIEW_PANEL loader thread synchronization 2017-03-05 22:22:25 -05:00
Wayne Stambaugh f181961866 Remove excessive schematic symbol library re-linking.
For some reason, the schematic symbol library link was being regenerated
every time the schematic was redrawn in SCH_SCREEN::Draw().  Remove the
re-link call from the Draw() and Plot() functions.

Add function the SCH_SCREENS to update the links in all of the schematic
sheets.

Update all schematic sheet symbol library links whenever the symbol
library list is modified or any library in the library list is modified.
That should cover all cases where the symbol library links could be
broken.

Refresh schematic window after applying library changes to update any
possible symbol changes.

Add KIWAY message to update the schematic when symbol library changes
could change the schematic.  The KIWAY mail was used because the schematic
frame is not a parent of the symbol library editor so wxEvents cannot be
used.
2017-03-04 16:02:33 -05:00
jean-pierre charras af161771b8 Fix compil issue on Windows 2017-03-04 17:35:33 +01:00
Chris Pavlina 4618e6c7f8 Component chooser: event and focus cleanup 2017-03-04 11:14:04 -05:00
Cirilo Bernardo 68bcdec87e Workaround for non-ASCII filenames in Windows 2017-03-03 14:30:47 -05:00
Tomasz Włostowski 966052272f Coding style fixes 2017-03-03 20:27:05 +01:00
Tomasz Włostowski cc3d79f932 Reworked selection passing mechanism in SELECTION_TOOL.
- The tools can now specify if the items in the selection must be editable/
deletable. This is groundwork to be able to select/delete DRC markers, which can't
otherwise be edited.
- Fixed disappearing of selected objects
2017-03-03 20:26:34 +01:00
Tomasz Włostowski 9e73c3117e Added possibility to disable undo entries creation in COMMIT/BOARD_COMMIT 2017-03-03 20:26:34 +01:00
jean-pierre charras 4eeed8d04f Icons options menu: code rework 2017-03-03 14:18:25 +01:00
Maciej Suminski 389c7b2bbc Added AUTOROUTER_CONTEXT to keep objects used by autorouter
The main reason is to keep cached board bounding box and limit repeating
parameters in functions used by the autorouter.
2017-03-03 13:28:19 +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
Kristoffer Ödmark dda51ab550 CrossProbes Schematics from eeschema to pcbnew
Adds a similar crossprobe as modules has in pcbnew. When clicking a
sheet in eeschema, the items that are exclusive in that scheet will be
selected in pcbnew if using the GAL canvas.
2017-03-03 07:25:32 -05: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
John Beard e67882f0a3 Add WithAlpha method to COLOR4D
This is useful for taking a "base" color and making derived colours with
the given alpha, but the same RGB value.
2017-03-02 13:58:20 +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
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
Maciej Suminski 8b8de76aa5 Store information about buffering & caching in properties
PROPERTIES object has been recreated every time it was needed, using
two fields in PART_LIB class. Now the buffering & caching settings are
stored directly in a PROPERTIES object.
2017-02-28 15:18:58 +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
Chris Pavlina 23d4da9e49 Optimize TWO_COLUMN_TREE_LIST column sizing
This was particularly slow for very long lists on macOS.
2017-02-24 12:51:53 -05:00
Maciej Suminski e34b73e187 Do not freeze cursor when a tool was cancelled using the context menu
dispatchContextMenu() stores the cursor position before displaying a
menu, so the tools use the original cursor position when processing
events (instead of the mouse position pointing to a menu entry). Later,
the previous position has to be restored, but if in the meantime the
tool was cancelled - previous settings were restored to a wrong tool.
2017-02-24 16:55:18 +01:00
Maciej Suminski b25ded4d90 Store VIEW_CONTROLS settings when tools are switched
Fixes: lp:1663783
* https://bugs.launchpad.net/kicad/+bug/1663783

Fixes: lp:1667580
* https://bugs.launchpad.net/kicad/+bug/1667580
2017-02-24 16:47:19 +01:00
Maciej Suminski 57050cdeb3 Introduced VIEW_CONTROLS::SETTINGS to keep settings
The new class facilitates saving and restoring VIEW_CONTROLS
settings such as cursor visibility, snapping, etc.
2017-02-24 13:33:17 +01:00
John Beard c001c6114f Add cancel interactive tool action to GAL
This is used to provide menu entries that allows cancellation of
interactive drawing and routing tools without needing the keyboard.

It is provided in the drawing tools and the router tool.

The cancel event doesn't have any new functionality (e.g. track rip-up
for the PNS router - lp:1448460), this just adds it to the menu, where
it behaves the same as an Escape keypress.
2017-02-24 10:37:07 +01:00
jean-pierre charras cf70aa925c Fix shadowed warnings with overzealous compilers 2017-02-23 13:17:23 +01:00
jean-pierre charras a9d6af8001 Fix a comment 2017-02-23 13:17:23 +01:00
jean-pierre charras 10396ff435 Tool manager: renames Yield() to KiYield(), due to a collision name between the Yield macro in wxWidgets and Tool manager Yield.
Can be dependent on platforms.
2017-02-23 08:30:29 +01:00
Maciej Suminski d7bf44eee0 Removed a few more headers from base_struct.h 2017-02-22 17:54:01 +01:00
Maciej Suminski 0dc88bb4cf Changed COLOR4D defines to static consts 2017-02-22 17:35:00 +01:00
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