Commit Graph

61 Commits

Author SHA1 Message Date
Jeff Young 054649fa38 Formatting. 2022-10-16 18:39:37 +01:00
Jon Evans 375b530dad ADDED: Column selection and reordering in symbol chooser 2022-09-25 22:49:49 -04:00
Jon Evans f37086e840 Remove size handler that messes up column sizes
Could not reproduce an issue on wxGTK.  If this causes problems
on other OS's, let's find a more appropriate fix
2022-09-23 22:08:33 -04:00
Jeff Young 8eb68ee472 Add pin/unpin context menu to Symbol Chooser and Footprint Chooser.
Also moves some more code down into common so it can be shared.

Fixes https://gitlab.com/kicad/code/kicad/issues/12384
2022-09-21 14:45:12 +01:00
Jon Evans 1520a1d372 Use cached untranslated header for looking up width 2022-09-06 09:18:34 -04:00
Jon Evans e294fe2074 ADDED: Dynamic field columns in symbol chooser
CHANGED: Symbol chooser search now considers custom symbol fields

Visible columns can be controlled in database libraries.
In standard KiCad libraries, we show columns for all custom fields for now.

Customizable column visibility will be added in the future.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11946
2022-09-05 16:38:14 -04:00
Seth Hillbrand 34a5a32a52 Prevent GTK from zero-ing out column size
Related to https://gitlab.com/kicad/code/kicad/-/issues/12180
2022-08-15 14:24:02 -07:00
Jeff Young 18ac169ac7 Add contexts to EDA_COMBINED_MATCHER. 2022-08-14 22:56:29 +01:00
jean-pierre charras 490875e222 Fix a missing call to aEvent.Skip() in commit 753f2f3.
Any wxSizeEvent handler must call Skip() to propagate the event.
2022-07-29 16:46:35 +02:00
Jeff Young 753f2f3e4c Display descriptions in second column of library trees.
Also fixes some bugs in how the columns are sized.

Fixes https://gitlab.com/kicad/code/kicad/issues/12090
2022-07-28 14:51:47 +01:00
Jeff Young def87c969e Redo the pinned-libraries storage architecture.
1) always use preferences directly
2) allow nicknames from either preferences or project
3) store-after-modify

Fixes https://gitlab.com/kicad/code/kicad/issues/12000

Fixes https://gitlab.com/kicad/code/kicad/issues/11892
2022-07-22 09:31:10 +01:00
Jeff Young 05219e4d9a Add pinned library support to Choose Symbol and Choose Footprint. 2022-07-09 20:06:31 -06:00
Jeff Young 120c5b9ac1 Reimplement pinning now that we're no longer sorting on score. 2022-07-09 12:26:44 -06:00
Seth Hillbrand 4790257616 Don't break alphabetical sorting on search
When using the "Filter" search for footprints/symbols, the least
surprising outcome is that the window filters the existing
(alphabetically sorted) list but does not change the display order based
on scoring.

This also needs to adjust the fix for
https://gitlab.com/kicad/code/kicad/-/issues/259 as that assumed the
selected element would be the first below the group (not the case if we
are sorting alphabetically)

Fixes https://gitlab.com/kicad/code/kicad/issues/11746
2022-06-10 11:48:47 -07:00
Jeff Young 724182abe4 Fix lib tree searches to handle searching on library names.
Fixes https://gitlab.com/kicad/code/kicad/issues/9981
2021-12-14 15:18:48 +00:00
Jeff Young 671e9f2dba A better algorithm for centering library items in the tree.
It still doesn't center as wxWidgets' API is poorly suited for that.
But it does now at least keep it off the very top or bottom.
2021-10-02 10:41:26 +01:00
Jeff Young b84d1456d5 KIFACE_I -> KIFACE_BASE. 2021-09-14 23:45:14 +01:00
Jeff Young 6aaf4413b3 Fix kicad_string.h / string.cpp mismatch.
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
2021-07-29 16:03:25 +01:00
Wayne Stambaugh 37b200cb3e Pass wxString objects by reference instead of on the stack. 2021-07-27 08:41:27 -04:00
Jeff Young b1b4caee6a Escape "naughty" characters in symbol names.
It's tempting to say that we don't need to exclude filename chars
from symbols, but we might regret that decision down the road.  Better
to just escape them.

Fixes https://gitlab.com/kicad/code/kicad/issues/8694
2021-06-30 13:12:57 +01:00
Wayne Stambaugh fbc135e69f Rename SCH_COMPONENT to SCH_SYMBOL. 2021-06-10 10:34:49 -04:00
Jeff Young 0c4184f1a4 Split lib tree initialization into a two-pass affair.
This is under the supposition that we can't set the column widths
on some Mac instances because the host controls haven't yet been
created.  This is primarily conjecture based on looking at things
that have the *possibility* of going wrong.  Why this only happens
in some installs is beyond me.

Fixes https://gitlab.com/kicad/code/kicad/issues/5479
2021-04-01 10:51:29 +01:00
Jeff Young 676d862bee Don't allow really narrow widths for tree control.
Fixes https://gitlab.com/kicad/code/kicad/issues/5479
2021-03-30 20:59:11 +01:00
Seth Hillbrand 4657ca5d4f Fix GTK crash when multiple libraries are expanded
Once more into the gtk_tree_view breach.

This may also be related to https://gitlab.com/kicad/code/kicad/-/issues/7344

Fixes https://gitlab.com/kicad/code/kicad/issues/7422
2021-02-04 13:20:33 -08:00
Seth Hillbrand 8af4cf88a0 Fix crash when deleting symbol in GTK
So many things can go wrong with this control in GTK.  We have to
collapse the tree when updating the search string to avoid a crash when
referencing a child object but collapsing the tree will iterate over
elements and crash when we have deleted a symbol.

The temporary fix for this nonsense is to carefully order the calls.
We only need to collapse the search tree if we are not keeping our state
(in other words if we are fully re-building the tree)

Fixes https://gitlab.com/kicad/code/kicad/issues/6910
2021-01-04 09:15:40 -08:00
Jeff Young 359c29639f Fix access into empty container.
Fixes https://gitlab.com/kicad/code/kicad/issues/6840
2020-12-24 19:43:33 +00:00
Seth Hillbrand 0533a23185 Fix/workaround GTK libtree issue with multi-unit symbols
When preparing for clearing the tree, GTK requires walking through
parents.  After calling "Freeze()" to protect against returning bad data
(see #6458 and #4471), we can no longer access Parent() from GTK and the
tree cannot be cleared.

The fix is to collapse the first element if it is open.  This prevents
the common case of the history elements being expanded in the tree

Fixes https://gitlab.com/kicad/code/kicad/issues/6102

(cherry picked from commit 7eea344f91)
2020-12-03 14:39:05 -08:00
Seth Hillbrand 3bd080b64e Unselect and freeze before starting reset
In some cases, the BeforeReset() will cause an iteration over the tree
elements.  If we have deleted an element before doing this, we risk a
corruption/crash.

Fixes https://gitlab.com/kicad/code/kicad/issues/6192
2020-10-29 15:45:56 -07:00
Marek Roszko 14c18b7e64 Move ui functions out of common and into ui_common 2020-10-25 20:01:12 -04:00
Seth Hillbrand 56e1afb12e Unselect items before rescoring
Iteration on a suggestion from Mikołaj Wielgus to resolve
elusive crashing issue when searching in lib tree in GTK.

GTK issues two commands when clearing (BeforeReset() and AfterReset())
BeforeReset() needs to have a valid model and cannot have selection
events during its lifetime.  On MacOS and MSW, this is a NOP.
AfterReset() performs the re-association for GTK, removing the need for
the extra associate step.  For MacOS and MSW, this is only the Cleared()
action.

Fixes https://gitlab.com/kicad/code/kicad/issues/5732

Fixes https://gitlab.com/kicad/code/kicad/issues/5891
2020-10-06 17:40:30 -07:00
Ian McInerney 1b4ec6ccb5 Display symbol libraries that couldn't be loaded as disabled text
Fixes https://gitlab.com/kicad/code/kicad/issues/5092
2020-09-02 00:10:25 +01:00
Ian McInerney 441243753d Readd freeze/thaw to the library tree update
This freeze/thaw is different than the update locker freeze/thaw,
and is needed to prevent crashes due to accessing invalid (already
freed) data on GTK.

Fixes https://gitlab.com/kicad/code/kicad/issues/5289
2020-08-21 02:39:20 +01:00
Seth Hillbrand 6b0176d577 eeschema: lock model while updating scores
The tree model adapter appears to have update issues when modifying the
scores while it _might_ get updated.  This moves the lock higher and
removes the extraneous Freeze/Thaw call.

Unfortunately, this only exposes an additional issue in the tool handler
but this will hopefully be easier to debug.

Fixes https://gitlab.com/kicad/code/kicad/issues/5206
2020-08-18 10:50:50 -07:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00
Ian McInerney 4cd0ec8808 Fix library tree column widths when tree is refreshed
GTK only calculates new widths once the tree is displayed,
so calling Refresh after updating the tree but before display
will return a column width of 0. Instead, use saved column
widths if an invalid width was returned.

Fixes https://gitlab.com/kicad/code/kicad/issues/4837
2020-07-07 23:12:17 +01:00
Jon Evans c0aa6965de Migrate PcbNew project settings to new framework
Various architecture upgrades to support this.
Creating a BOARD now requires a valid PROJECT, which caused
some (mostly transparent) changes to the Python API internals.

ADDED: Project local settings file
CHANGED: Board design settings are no longer stored in PCB file
CHANGED: Net classes are no longer stored in PCB file
CHANGED: Importing board settings now reads boards, not just projects

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2578
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4070
2020-07-02 22:08:54 -04:00
Jon Evans 0e2f9cb1bd Migrate CvPcb project parameters 2020-07-02 22:08:54 -04:00
Wayne Stambaugh f262e08d40 Symbol editor: fix crash when editing new symbol value field.
This also fixes an ASAN accessing deleted memory warning.  See the issue
tracker comments for more information.

Fixes https://gitlab.com/kicad/code/kicad/issues/4471

(cherry picked from commit a16e9ac76a)
2020-05-26 13:20:32 -04:00
Jeff Young 13d3f57fce Implement a different solution to refreshing lib trees.
Fixes https://gitlab.com/kicad/code/kicad/issues/4110
2020-03-31 02:09:31 +01:00
Jeff Young eb855d40bb Restore lib tree refreshing, but don't attempt to refresh tree root. 2020-03-30 17:30:26 +01:00
Jeff Young d875d5850e Update library trees when their items change.
Fixes https://gitlab.com/kicad/code/kicad/issues/4019
2020-03-08 15:18:19 +00:00
Jeff Young 3860ab9f0c Fix issue returning pointers to items inside std::vector.
(When the vector is re-allocated your pointers become bogus.)
2020-02-27 22:00:51 +00:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
Jeff Young 3ec360f15c Save pinned libraries in project.
Fixes https://gitlab.com/kicad/code/kicad/issues/2288
2020-02-14 14:22:54 +00:00
Jeff Young 2017389f2d Pinning for library trees in FPEditor and SymbolEditor.
Fixes https://gitlab.com/kicad/code/kicad/issues/2288
2020-02-14 00:10:40 +00:00
Jonatan Liljedahl 1e42d6abeb symbol-editor: Fix MacOS segfault in lib_tree_model_adapter
In LIB_TREE_MODEL_ADAPTER::UpdateSearchString(), don't call
AttachTo() on MacOS.

Fixes https://gitlab.com/kicad/code/kicad/issues/3653 and
https://gitlab.com/kicad/code/kicad/issues/3666
2019-12-19 14:01:35 +00:00
Ian McInerney 179f31d377 Add a minimum size to the part column in the lib trees
When the column has 0 width, it becomes hidden and users don't
know where it went or how to get it back.

Fixes https://gitlab.com/kicad/code/kicad/issues/3656
2019-12-10 23:26:07 +00:00
Ian McInerney bb596ebdaf Fix width of part selector columns
* Move column width manipulation into the lib tree adapter
* Fix issue with GTK where if someone types too fast, the part
  column gets 0 width.

Fixes: lp:1841584
* https://bugs.launchpad.net/kicad/+bug/1841584
2019-09-18 16:12:45 -07:00
Jeff Young 6b6e9eddee Return control of Symbol and Footprint chooser col widths to user.
The auto-calculation wasn't working out and even with it some users
wanted control.

Fixes: lp:1796774
* https://bugs.launchpad.net/kicad/+bug/1796774
2019-08-26 18:27:49 +01:00
Jeff Young 6aa0ceff36 Don't throw out search hits because they have unit children. 2019-06-19 21:27:58 +01:00