When working in high contrast mode, we want to be able to select a
footprint with only elements in, e.g. silk and fab layers.
The previous design for footprint IsOnLayer had one behavior of every
other element and a different behavior for footprints. This leads to
multiple bugs as new features use the overloaded IsOnLayer expecting it
to report if the element exists on a layer or not.
For footprints, we need a different routine to determine whether or not
to select the footprint when clicking on it. IsOnLayer will report if
the footprint has any elements on a specific layer but we don't want to
use the bbox for a hittest because large footprints with through hole
pads will exist on every layer and have an enormous bbox. Instead, we
filter footprints based on the hittest of each element. This behaves in
a more logical fashion, allowing you to select a footprint by clicking
on a visible element of that footprint.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15284
Before, we did not actually prevent users from adding a field also named
Quantity to their symbols. This of course does not play nicely with the
assumptions that Quantity is a special column in the fields editor.
By making it a named variable, the user can safely add it to a symbol
and it will not be editable, and will also work in the fields table
editor as expected.
If KiCad crashes or exits without deleting the lockfile, don't show the
warning message unless we are not the one who locked it or there are
other KiCad instances running locally.
This should catch 99% of the cases where the message is shown
incorrectly. There may be some corner cases where the lock file is
created on a network drive using two different machines with the same
name and same user but these cases should be (famous last words)
sufficiently rare as to not be observed in practice
The symbol editor has few enough items that it will still be performant
if we always send a selected-item-modifed event. (As it turns out we
were doing that anyway as the check for child-modified flags didn't
also check for selected.)
mainly because we now use std::string in a lot of function using previously char*
FROM_UTF8(const char* cstring) now calls From_UTF8(const char* cstring)
The TOOL_ACTION_ARGS construction method is supposed to be fairly light
weight, so instead of creating/destroying strings all the time, pass
string_views to the actual string data instead.
wx doesn't currently support string_view -> wxString implicitly
currently, so we have to do the conversion ourself.
Also moves the settings from Board Setup to Preferences > PCB Editor.
Also collapses Track Drag Mode from radio buttons to a choice menu to
save space and allow it to be with the other editing action modes.
This is required to keep selected and brightened state across undo.
It's also probably required for things like IS_SHOWN_AS_BITMAP and
possibly ENTERED. FWIW, most BOARD_ITEMs do a straight swap, including
the temp and edit flags. But that seems like a risky change....
Also removes SyncView() call from Undo/Redo as that does a MODEL_RELOAD
which clears the selection.
CHANGED abandon the unpredictable behaviour of the Simulation Command
dialog. You now separately add simulation tabs (which have invariant
command types once created), and the dialog edits the current tab.
Also a bunch of bug fixes to make multiple simulation plots actually
work.
- in DXF coordinates were using 6 digits for coordinate mantissa: this is not
enough for coord in inches. Now use 16 digits
- Arc( VECTOR2I& aCentre, EDA_ANGLE& aStartAngle, EDA_ANGLE& aEndAngle, ...)
was using integers for coord. This creates significant errors for start point
and end points of the arc. Now the center is given in double, and its position
is calculated from angle end points (and radius) to do not generate a position error
for these end points (previously the error could be 20 ... 50 nm)
Fixes#15056https://gitlab.com/kicad/code/kicad/-/issues/15056
Note that "immediate" doesn't mean quite the same thing: while it will
enter the tool immediately, it won't necessarily finish the tool during
the call if the tool has an event loop. So for something like Rotate
"immediate" and "synchronous" have the same behaviour, but for something
like Move they do not.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15085
Using a boolean argument just leads to a lot of trailing booleans in the
function calls and is not user friendly. Instead, introduce PostAction()
to send an action that runs after the coroutine (equivalent to passing
false or the default argument), and leave RunAction as the immediate
execution function.
The WX_COMPATIBILITY mode is always assumed now (the option was removed
previously), but the define is no longer present. So remove the old code
that checked for it and just leave the wxASSERT statements.
This is purely loading in the background based and has no artificial delay.
Will be more useful once kicad.exe ends up loading more on launch immediately ;)
Right now the splash is probably visible the longest launching pcbnew standalone.
The actual splash image can be considered a placeholder
Using std::any from C++17 allows for proper type handling in the
parameter field, removing the need for casting to void* and then casting
the void* to the desired type.
This replaces a hack where the parameter was used to identify a custom
UI ID with a proper solution. This moves the cut/copy/paste actions to
the new system, but more like help/quit/close should also be moved over
in the future.
A function-chain constructor method allows for the long list of
parameters to the constructor to be shrunk to only the ones needed by
each action, and allow self-documenting code for what each part of a
TOOL_ACTION constructor does.
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/7617
Its members can be on copper layers, but the group itself isn't on any
layer.
Also fixes a bug where we were trying to clone TRIANGULATED_POLYGON::TRI
shapes as indexable sub-shapes. (The TRI only has indexes into its
parent, so cloning it will only result in segfaults down the line.)
Also fixes a bug where we weren't including copper items inside groups
when checking footprint net ties.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15021
Normally this means surrounded by forward slashes, but we also still
allow any regular expression in a netclass match to keep from breaking
existing documents.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14944
The API is needed for wxFormBuilder, and I couldn't figure out any
way around it, but we can at least reduce the risk of someone calling
it accidentally (again).
When creating a new file lock, we need to check if the containing
directory can be written, not if the file (which may not yet exist) can
be written
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14942
WindowIds aren't actually guaranteed to be unique, and we don't
perform a dynamic_cast on the result of FindWindowById() because
of linker issues....
This is an attempt to fix KICAD-39.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14928
Note that this only works where a BOARD_COMMIT or SCHEMATIC_COMMIT is used.
(BOARD_COMMIT is used almost universally in PCBNew, but SCHEMATIC_COMMIT
has very little adoption in EEschema so far.)
When editing or viewing library symbols, the files are watched for
underlying changes. If any occur, the user is either prompted to reload
(if reloading would overwrite their current edits) or the file is
silently updated to the current version on disk.
This also sets a custom assertion handler to avoid unneeded crashes when
recieving invalid SAMBA packets and turns off assertions entirely when
running in release (non-debug) mode
Don't open-code knockout text shape generation in several different
places.
Make sure triangulated knockout text gets clearance added when
specified.
Collapse duplicated footprint text item plot routine (they're no
longer any different from plotting pcb text items).
Also fixes a bug where we didn't triangulate at all when the char
count didn't warrant the likely overhead of spinning up a
thread_pool.
And fix another bug where EDA_TEXT::GetRenderCache() wasn't using
the given font.
Also reverts using the cache for drawing-sheet text. The text
items are created from scratch from the data items each time
they're drawn, so there's never an existing cache to make use of.
Instead, we now check that the item is in the view, using a very
approximate bounding box generator (because even generating a
real bounding box shows up large in profiles).
And, lastly, fixes a bug where EndPos was never considered in
DS_DATA_ITEM::IsInsidePage().
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14822
wxSingleInstanceChecker is meant for running programs, not file locking.
This implements an RAII class for file locking that stores the lock
files next to the file being locked, allowing it to be easily found and
removed. Also includes the ability to override the lock, with
information about the original owner
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14734
[ADDED]: A panel to the schematic editor that allows quick access to all
of the items connected to the currently highlighted net.
This is an initial swag at implementing a full net navigator feature. For
now it only shows the currently highlighted net nodes. The incremental
net list advanced setting must be enabled in order to use this feature due
to performance reasons. There are still some issues with saving the panel
position which will be addressed in the future.
Initial code for serializing wxAuiPaneInfo settings to and from JSON have
be implemented.
Change teardrop generation to rely more heavily on BOARD_CONNECTIVITY
for improved performance.
Add updating of teardrops on BOARD_COMMIT::Push().
Also converts m_CopperItemRTreeCache to std::shared_ptr.
We don't copy it around anyway, and having to create a new set
of std::unique_ptr's for each operation is likely to be more
expensive than std::shared_ptr's overhead.
Version 7 text alignment changed subtly for stroke fonts from version 6.
Additionally, the output has been different between screen and plotting,
leading to offset text in plotted output relative to the text shown on
screen.
This introduces a fudge factor in FONT::getLinePositions to correct the
offset in the plotting output relative to v6.
This also changes the SCH_PAINTER and PCB_PAINTER to correct the
relative offsets between GAL and PLOTTER classes. The source of these
offsets is atm unclear.
Fixes https://gitlab.com/kicad/code/kicad/issues/14755
Many minor tweaks were added that changed the output of the stroke font
from v5/v6. These offsets changed the gerber output expected. This
reverts the changes to something much closer to the v6 output. It is
not pixel-perfect but gets very close on most texts.
Fixes https://gitlab.com/kicad/code/kicad/issues/14609
A sheetpath is required to correctly resolve text variables.
Depending on currentSheet is rife with bugs.
There are many places where we do *not* want to be prepending
field names to the field values, such as netlisting,
building PDF hypertext menus, etc.
Also, Find/Replace needs to work on unresolved text, as
that's what we're going to display (and if replace nuked
your variable references you wouldn't be happy).
Also simplifies the scoring algorithm so that it only
differentiates between exact-match, match-at-start and
any-match. The rest of the position-based matching
stuff is gone, as is the knowledge of the name vs the
keywords vs the description. All that is left to the
provider of the weighted search terms array.
Provides a single-point access for modifying the schematic and symbol
elements that allows chaining updates and reverting partial changes.
Standardizes the undo hierarchy between pcb and schematic editors
As this is another layer on the existing undo/redo structure, the
initial commit does not replace all undo/redo calls currently existing.
These will be handled in a series of follow-on commits
Previously, almost all connectivity updates were full updates, meaning
that the entire connectivity graph would be rebuilt each time a change
was made to the schematic. This update modifies the update to only
correct the subgraphs that are directly affected by the change.
It uses the existing connection graph to find all affected subgraphs as
well as connections to the changes based on the visible schematic.
These elements are removed from the existing connectivity graph and
marked dirty. They then have a new connectivity graph built only around
their changes. The resulting graph is merged into the original.
Currently, this ability is behind an advanced config flag
`IncrementalConnectivity` while testing.
Fixes https://gitlab.com/kicad/code/kicad/issues/10846
Fixes https://gitlab.com/kicad/code/kicad/issues/1794
Settings should be initialized on start-up. This removes the option of
lazily loading the settings from file and instead requires all settings
needed to be loaded on KiFACE start before requesting data from the
settings object
The base class constructor expected a const string, and the other
PGPROPERTY constructors do as well, so make this const.
This was also a compile error when building against wx 3.3.
The spacemouse driver, particularly on Mac, is extremely unstable and
causes crashes even when not being used. This places the interface
behind an advanced config flag to ensure that users can affirmatively
opt-in to the potential for crashes
This reverts commit 33da9b2327 and the
following commit dc08c48f33.
C++17 changed the behavior of static class member variables that are
constexpr defined. Previously this definition/declaration split was
valid for constexpr members, but after C++17 the static constexpr member
variables are automatically inlined, so the declaration is no longer
exported in some compilers (GCC 9/10/11 seem to have problems).
An alternate way of constexpr member variables is putting the
initialization in the class definition, but we can't init a COLOR4D
object when defining the COLOR4D class.
For now, revert this change until we can figure out the proper way of
architecting these colors.
This library is meant to move non-EDA items (language extensions,
library extensions, etc.) into the lowest-level of our dependency chain.
This library should never depend on anyother non-thirdparty code in the
kicad codebase.
This fixes the initialization-order fiasco in the color initialization
sequence, which was originally fixed by making COLOR4D constexpr, but
was then reintroduced when the assert was changed to wxASSERT (wxASSERT
is not compatible with constexpr).
* Add compare method to COLOR4D object.
* Add unit test to validate COLOR4D comparison method.
* Add missing color test in text attribute comparison method.
* Add unit test for text attribute object.
* Remove unnecessary headers from text attribute header.
* Move text attribute code into separate source file.
Don't assume the dialog is mode-less and call Destroy() from within a
dialog method. This will most assuredly crash if the dialog is shown
modally or quasi-modally.
Don't leak memory for mode-less dialogs created on the stack. Make sure
when the parent frame window is closed that all mode-less dialog memory
is cleaned up. Dialogs are not child windows like controls and toolbars
so their memory does not automatically get cleaned up when the parent
window is destroyed.
Do not directly access frame parent window's pointer in dialog destructors.
Apparently the tear down order when destroying mode-less dialogs is not
guaranteed so the parent window may get deleted before the dialog causing
a crash when accessing the parent window pointer from the dialog dtor.
Do not close mode-less dialogs in the parent frame's destructor. This
doesn't guarantee that the dialog(s) will be destroyed before the parent
but it may reduce some careless mode-less dialog event handling in the
future.
Moves forced-transparency setting down into VIEW_ITEM so that it can
be used to place forced-transparent objects in a different target.
This keeps EnableDepthTest() from equalizing the alpha values between
the two symbols (or two footprints).
The wxComboBox drops nicely from the top of the screen, showing the full
element list, opposed to the choice widget that centers the selection
and places the list off the top of the screen if there are many
elements. This was broke for MacOS until wx3.2
Fixes https://gitlab.com/kicad/code/kicad/issues/1866
- Avoid repetition and errors from typos
- Allow simple changes
- Simpler data type handling, the constants are wxString
(Cherry-picked from f135881bd6 in 7.0)
Old PLOTTER::Text is not (yet) removed, but it use negative text size
to mirrored text, which is not really compatible with some plotters (especially PDF).
Using TEXT_ATTRIBUTES is much easy and much better,
so PLOTTER::PlotText() is added.
Note: "old" PLOTTER::Text() is not removed yet.
The overbar function in outline fonts recursively calls the text
function which already owns the lock. To avoid this, we have an
unlocked variant that is wrapped by the exposed text function
Fixes https://gitlab.com/kicad/code/kicad/issues/14015
This is needed so Python scripts can get built-in colors using the
SETTINGS_MANAGER.GetColorSettings() member.
Otherwise calling it with a built-in name crashes.
(cherry picked from commit aee6d9d01c)
Some classes had been originally designed to be usable separate from wx,
but over time our uses of the classes have become entertwined with wx
features (e.g. colors), and various changes have also leaked wx into the
classes unguarded. So just remove the option to hide wx in those classes
to simplify the code.
ttf fonts can declare multiple language names. Many by default opt to just declare one and not tag it any particular language.
However, there are CJK languages that typically leverage this function the most. They'll tag both a "en" and a cjk lang family name in CJK characters.
To be as user friendly as possible, we need to display said fonts in the CJK languages if KiCad to set to such a locale.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14011
This adds Reset() method to KIFACE to reload global libs stored in
global static vars.
Also refactors some lib reload code in various frames to have
common MAIL_RELOAD_LIB handler.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12500