Commit Graph

2874 Commits

Author SHA1 Message Date
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
Maciej Suminski 9ead2b068b Fixed crash when placing a component in standalone eeschema
Fixes: lp:1668157
* https://bugs.launchpad.net/kicad/+bug/1668157
2017-02-27 10:29:53 +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 adba96fd2b Changed optional::value_or() to optional::get_value_or()
get_value_or() is considered deprecated, but still works in the newest
boost (1.63). On the other hand, value_or() is not available in some
versions that are still used by major distros.
2017-02-24 17:34:23 +01: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
Maciej Suminski 72cae92320 Disable context menu trigger if the assigned menu is set to null 2017-02-24 13:32:43 +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 04d1b2fca7 fix incorrect COLOR4D::COLOR4D( EDA_COLOR_T aColor ) ctor for UNDEFINED_COLOR 2017-02-23 18:17:47 +01:00
jean-pierre charras 2f24b31b28 simplify color calculation. 2017-02-23 17:55:55 +01:00
jean-pierre charras 1f345052cd Fix erroneous conversion between wxColor and COLOR4D 2017-02-23 14:30:43 +01:00
jean-pierre charras 11dcb76fc9 Add -Wshadow compil option, if exists to warn about shadowed variables.
Swig auto generated .cxx file has a lot of shadowed variables, so this option cannot be used to compil all files.
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
Chris Pavlina d1a2ed63c0 Add gal as dependency of common
This is required due to the use of COLOR4D in common
2017-02-22 19:45:52 -05:00
Jon Evans f9bc5914b3 Wrong type of arguments in wxPen constructor
Has pointed out by Jon Evans the constructor need the .ToColour() and should be called like:
wxPen pen( GetParent()->GetGridColor().ToColour(), h );

Submitted-by: Diogo Condeco <diogocondeco@gmail.com>
2017-02-22 14:12:58 -05: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