Commit Graph

706 Commits

Author SHA1 Message Date
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
Chris Pavlina 551b2b2312 Component chooser: fix ugly border on macOS 2017-03-04 12:29:49 -05:00
Chris Pavlina 4618e6c7f8 Component chooser: event and focus cleanup 2017-03-04 11:14:04 -05:00
Chris Pavlina e6de99cc86 No more wxSearchCtrl in DIALOG_CHOOSE_COMPONENT
It is buggy on several platforms
- macOS: eats Esc key
- Windows: poor text alignment
2017-02-24 16:01:58 -05:00
Chris Pavlina d3cb23b7d7 Remove unneeded state member in DIALOG_CHOOSE_COMPONENT 2017-02-23 20:59:15 -05:00
Chris Pavlina 2683af26c0 Fix DIALOG_CHOOSE_COMPONENT enter and double-click events 2017-02-23 20:51:29 -05: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
Chris Pavlina 35a8d78921 Fix component selector segfault on MacOS
Fixes: lp:1666081
* https://bugs.launchpad.net/kicad/+bug/1666081
2017-02-21 18:37:37 -05: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
Chris Pavlina 57de6ec0af Remove SetFocus hack after changing to wxSearchBox 2017-02-20 14:41:21 -05:00
Chris Pavlina 0182e454c5 Adjust component chooser GUI slightly 2017-02-19 19:31:53 -05:00
Chris Pavlina 70301a6244 Component chooser: display correct unit in reference field 2017-02-19 15:11:35 -05:00
Chris Pavlina 69165aa0a0 Do not show hidden fields in the component selector
This is not necessary anymore, as they are displayed in the info box.
2017-02-19 13:43:50 -05:00
Chris Pavlina a61be7e00e Move LIB_PART::Draw drawing options into a struct
This makes configuring the options clearer, avoiding the long list of
non-self-explanatory arguments at the small cost of requiring a few more
lines.
2017-02-19 13:40:26 -05:00
Chris Pavlina 5dea5e2ada Component chooser: add missing info panel updates 2017-02-19 10:01:45 -05:00
Chris Pavlina b4f4ff9353 Clean up updateSelection() megafunction 2017-02-19 09:24:40 -05: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 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
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 7ccdca5ced Use library ID to store library symbol information in the schematic symbol.
Use LIB_ID instead of wxString for storing the library symbol information
in the schematic symbol in preparation for the upcoming symbol library table
implementation.

Change the FindLibAlias and FindLibPart functions in the PART_LIBS object
instead of wxString.  Please note that only the library ID name is used to
search the list of libraries.  The library nickname is ignored.  Once the
symbol library table is implemented and full LIB_IDs are defined, the
library search code will no longer be used and will only be kept to load
older schematics that have not been converted.

Move SCH_LEGACY_PLUGIN_CACHE definition so that the legacy plugin knows
how to properly delete the cache object.
2017-02-10 08:36:59 -05:00
Chris Pavlina bca74853d1 Display more information in component selector 2017-02-07 15:01:20 -05:00
jean-pierre charras 7dddb1d1c1 When editing a label property it always goes to right orientation by itself
Fixes: lp:1661264
https://bugs.launchpad.net/kicad/+bug/1661264
2017-02-02 16:50:49 +01:00
Diogo Condeco 8033c6fa9a Eeschema one field dialog text selection.
This patch selects the text in the dialog_one_field.
For annotated symbols the number is selected. For unannotated symbols the ? is selected.
All other cases the entire text is selected, including references in library editor.
2017-01-31 16:01:08 -05: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
Wayne Stambaugh 8e7fe9dab2 Fix spice simulator build error due to EDA_TEXT changes. 2017-01-25 09:25:05 -05: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
diogocondeco 1a05c8a5a8 eeschema/add_component setfocus moved into OnInitDialog
SetFocus executed by OnInitDialog wxInitDialogEvent handler
2017-01-23 12:31:00 -05:00
jean-pierre charras ccdfabc866 Add tool tips to autosave widget in dialogs (pcbnew and eeschema) 2016-11-22 11:26:32 +01:00
Aylons Hazzud 5dc43a1d77 Gray out "Units are not interchangeable" if 1 unit
Fixes: lp:1503921
* https://bugs.launchpad.net/kicad/+bug/1503921
2016-11-18 11:42:42 +01:00
jean-pierre charras f15a59f0ad Component Editor and Component viewer: add option to show the electrical pin type. 2016-11-04 12:13:22 +01:00
jean-pierre charras 3bf1717002 Fix a minor cosmetic issue in dialog edit libentry fields 2016-10-22 18:43:12 +02:00
jean-pierre charras 1924478558 Eeschema: editors: show the pin position (when clicking on it) in message panel.
Pin properties dialog: show pin position ( and allow editon ).
2016-10-18 18:59:26 +02:00
jean-pierre charras d1e4399a29 dialog edit libentry fields in lib: Add button to edit spice parameters, and therefore to add spice parameters in lib components. 2016-10-15 20:05:03 +02:00
Wayne Stambaugh fc07716aed Eeschema: schematic I/O plugin preparation work.
Rename PART_LIB GetEntryNames() and RemoveEntry() to GetAliasNames() and
RemoveAlias() respectively for improved readability.

Rename PART_LIBS FindLibraryEntry() to FindLibraryAlias() improved
readability.

Remove commented out PART_LIBS::FindLibraryEntries().

Remove PART_LIB::GetFirstEntry() and update all effect code accordingly.

Remove unused PART_LIB::SetFileName() method.

Remove unused PART_LIBS::RemoveAllLibraries() method.
2016-10-14 19:29:24 -04:00
Simon Richter b0f9864bc4 Clean up warnings from exception handlers
The exception objects caught are either not referenced at all, or only in
debug builds. This avoids the warnings for the unused variables.
2016-10-10 11:08:49 -04:00
Maciej Suminski efdfaebf62 Support subdirectories in relative paths in Spice model dialog 2016-10-07 16:07:38 +02:00
Chris Pavlina 9547dd4e52 Fix GetBoundingBox hiding overloaded virtual 2016-09-30 22:32:24 -04:00
Simon Richter ad088db6d2 Add more "override" markers. 2016-09-25 13:59:41 -04:00
Simon Richter 59c81976dc Explicitly mark overriding functions. 2016-09-24 14:53:15 -04:00
Dick Hollenbeck 964b5a1830 Split IO_ERROR out of richio.* and store Problem() and Where() separately 2016-09-20 11:56:23 -04:00
jean-pierre charras 1051732580 DIALOG_SPICE_MODEL_BASE: cosmetic enhancements (mainly better look of spice units table in Passive notebook page) 2016-09-19 18:48:07 +02:00
jean-pierre charras 0719f8d214 Fixes: lp:1624659 (fix some issues in countries which are not using a point as decimal separator)
https://bugs.launchpad.net/kicad/+bug/1624659
Small enhancement in dialog_spice_model_base.cpp: add comments about spice values notation.
2016-09-17 18:34:44 +02:00
jean-pierre charras f3d4f7322b Simulator dialogs: Fix incorrect handling of Validate(), which was called for all widgets by the default wxID_OK button handler. It is now called only for the active page of these dialogs (as wanted in code), therefore only for used widgets.
Note: strangely, this issue was noticed only on Windows, not on Linux.
2016-09-17 14:38:34 +02:00
jean-pierre charras cd94da7972 Spice simulator and netlist generation: use only netnames (outdated option "use net numbers as net names removed" removed)
netlist generation: remove option "replace IC and U ref by X" (broken option).
All component refs are now prefixed by the Spice_Primitive field value.
Therefore the netlist used by Kicad ngsipce simulator and the spice netlist generated from dialog are the same.
(note: like previously, forbidden chars like ( and ) are replaced by _ in netnames)
2016-09-16 20:36:19 +02:00
jp-charras b63f2f81b7 Fixes: lp:1619436
https://bugs.launchpad.net/kicad/+bug/1619436
Eeschema crashes when selecting a text editor from the REC dialog. (Linux Only)
It happens only if a text editor was never selected in Kicad.
2016-09-05 09:02:15 +02:00
Wayne Stambaugh f477cc958c Eeschema: PART_LIB object clean up.
* Rename redundant function PART_LIB::GetEntry() to PART_LIB::GetAlias() which
  is more descriptive and move the GetAlias() function which was nothing more
  than a call to GetEntry().
2016-09-02 19:40:18 -04:00
Maciej Suminski fcedef836a Revert "Do not use double component primitives in Spice netlist exporter"
This commit creates more issues than resolves. It could happen that
there are components with different reference types (e.g. U1 and IC1)
that would be later converted to X1, causing a conflict.
2016-08-31 11:51:17 +02:00
Maciej Suminski 67573f15be Do not use double component primitives in Spice netlist exporter
Fixes: lp:1617768
* https://bugs.launchpad.net/kicad/+bug/1617768
2016-08-30 14:25:56 +02:00
jean-pierre charras 13cfe74956 Simulator dialogs: fix minimal sizes and best sizes. 2016-08-20 17:25:51 +02:00
jean-pierre charras c0b1e4cd38 Do not allow spaces in component name (value field) in component library editor, in dialogs (Edit field, Create component).
In component libraries, a space in name breaks the library, and is not allowed.
2016-08-19 18:42:39 +02:00
Maciej Suminski 7ea120c2a1 Spice model editor by default looks for libraries in the project directory when there is no library assigned 2016-08-19 17:33:26 +02:00
jean-pierre charras 5ed19b6e82 Dialogs for simulator: cosmetic enhancements, make them translatable and resizable. Remove 2 printf used in debug. 2016-08-15 09:53:15 +02:00
Maciej Suminski 6bfdfd5226 Look for libraries in the project path 2016-08-11 14:42:19 +02:00
Maciej Suminski 46ecfd8139 Resized simulator dialogs 2016-08-11 14:42:16 +02:00
Tomasz Wlostowski 80d8dd7205 sim: default to decade frequency sweep for ac analysis 2016-08-11 14:42:15 +02:00
Maciej Suminski 2b041425e5 Resized Spice model dialog 2016-08-11 14:42:14 +02:00
Maciej Suminski 6d7a7a3233 KICAD_SPICE CMake flag 2016-08-11 14:42:13 +02:00
Maciej Suminski 02e4252fcd A few fixes for DIALOG_SIM_SETTINGS 2016-08-11 14:42:10 +02:00
Maciej Suminski 741ae10a97 Improved Spice model dialog for sources Now user can specify both DC/AC & transient analysis specifications at once. 2016-08-11 14:42:09 +02:00
Maciej Suminski 53d772989a Store relative library path if possible 2016-08-11 14:42:08 +02:00
Maciej Suminski 39caddd22b Parsing sim command directives 2016-08-11 14:42:08 +02:00
Maciej Suminski 2740556505 Fix for Spice library parser 2016-08-11 14:42:06 +02:00
Maciej Suminski 6c53aba680 Validators for Spice model dialog 2016-08-11 14:41:56 +02:00
Maciej Suminski 65c7520544 Bulletproof Simulation settings dialog 2016-08-11 14:41:54 +02:00
Maciej Suminski dfeb5385f3 Disable current signals in all analyses but transient 2016-08-11 14:41:53 +02:00
Maciej Suminski 114e3638e7 Renamed tabs in Spice model dialog 2016-08-11 14:41:52 +02:00
Maciej Suminski 324d27711a Hide OP & noise analysis, scale settings for AC in settings dialog 2016-08-11 14:41:52 +02:00
Maciej Suminski 0f993ba98c Current probing 2016-08-11 14:41:52 +02:00
Maciej Suminski 27a7a9b1a5 Spice fields enum values renamed from SPICE_* to SF_* 2016-08-11 14:41:51 +02:00
Maciej Suminski 132e30081b Disabled assert for unknown Spice primitives 2016-08-11 14:41:47 +02:00
Maciej Suminski 4f9a418694 Moved SPICE_VALUE to a separate source file 2016-08-11 14:41:43 +02:00
Maciej Suminski f62a6425a3 Changed the simulator code license to GPLv3+ 2016-08-11 14:41:43 +02:00
Maciej Suminski 51f0564119 Signals are added using a separate dialog 2016-08-11 14:41:42 +02:00
Maciej Suminski 3999ff1973 Resized DIALOG_SIM_SETTINGS 2016-08-11 14:41:41 +02:00
Maciej Suminski 1a6e048afc Pressing Enter accepts changes in Simulation settings dialog 2016-08-11 14:41:40 +02:00
Maciej Suminski 246a43baf0 Spice model editor dialog 2016-08-11 14:41:40 +02:00
Maciej Suminski a83d4802f9 Load Spice directives from schematics when Sim settings dialog is launched 2016-08-11 14:41:36 +02:00
Maciej Suminski 78526ee913 Additional options for netlist exporter (fix passive values, library include paths) 2016-08-11 14:41:36 +02:00
Maciej Suminski 822f436231 Removed unused DIALOG_SIMULATE_PLOT 2016-08-11 14:41:35 +02:00
Maciej Suminski fe92630f16 Fixes for DC sweep directive generated by Simulator settings dialog 2016-08-11 14:41:34 +02:00
Maciej Suminski ee1adcd92c Fix for noise directive generated by Simulation settings dialog 2016-08-11 14:41:32 +02:00
Maciej Suminski 183fb24112 Fixed string for transient simulation directive 2016-08-11 14:41:31 +02:00
Maciej Suminski c5227b7279 Fix: use correct node numbers in noise simulation directive 2016-08-11 14:41:31 +02:00
Maciej Suminski 3c909e2c32 Allow typing zeroes in Simulation settings dialog 2016-08-11 14:41:31 +02:00
Maciej Suminski 2b1784cfc6 Simulation settings combo boxes are filled with net/power source choices 2016-08-11 14:41:30 +02:00
Maciej Suminski 95ca3914ce Fields in simulation settings dialog are treated as invalid when empty 2016-08-11 14:41:29 +02:00
Maciej Suminski a2b16ae640 Initial 'Simulation settings' dialog 2016-08-11 14:41:29 +02:00
Maciej Suminski 951d16c655 Fixed Spice netlist export options and added a few new flags 2016-08-11 14:41:20 +02:00
Maciej Suminski b6eab191d0 Added a button to add Spice fields to a schematic component 2016-08-11 14:41:10 +02:00
Maciej Suminski b4d9e7ee99 Fixed asserts in DIALOG_LIB_EDIT_TEXT_BASE. 2016-08-11 14:41:04 +02:00
Tomasz Wlostowski 7b05dc2a13 Fbp files for simulator 2016-08-11 14:41:04 +02:00
jean-pierre charras defac5272b refinemenst in dialogs and OSX Cancel button fix 2016-07-18 17:54:41 +02:00
jean-pierre charras f83a76a970 Eeschema: dialogs: incorrect sizes fixes and osx copy text fix 2016-07-18 09:04:13 +02:00
jean-pierre charras 7253ba28df Eeschema: dlg size fixes and osx fixes 2016-07-16 13:25:07 +02:00
jean-pierre charras 3cea754d90 Eeschema: dlg size fixes and osx fixes 2016-07-16 12:54:55 +02:00
Simon Richter 1b2fd6a382 Replace BOOST_FOREACH with C++11 range based for. 2016-06-29 16:07:55 -04:00
Simon Richter 527c0eff8e Eeschema: ERC dialog code improvements.
* Rename the "net", "lastNet" and "nextNet" variables to "item", "lastItem"
  and "nextItem", respectively, because these refer to netlist items, not
  nets.
* This adds a suffix "Idx" to the indexes into the list, and introduces local
  copies of the pointers to the objects we are looking at, in order to have a
  shorter way of addressing them.
* The ERC code depends on netlist items to be sorted by net code, so verify
  that in debug builds. While this condition is stricter than necessary, it
  should still hold with the current code, and provide a good canary if a
  change to the sorting code might break ERC.
2016-06-28 08:52:22 -04:00
Chris Pavlina 9eef653625 Remove legacy option to zoom to selection on middle mouse button
This feature was not reliably available: neither pl_editor nor GAL supported
it. It has been replaced over the past few commits with a new zoom-to-selection
tool available in all applications and modes.
2016-06-11 19:37:43 -04:00
Chris Pavlina c13f80bb49 Remove unneeded compile option KICAD_KEEPCASE
Libraries have been 100% case-sensitive for a while now; there is no longer a
need to keep this option around. This will change nothing except for any
stragglers still manually specifying this old option.
2016-06-10 23:15:02 -04:00