119 Commits

Author SHA1 Message Date
John Beard
ede31b6252 Pin layout: unify bounding box calcs
The logic for this was duplicated, in two very different forms,
between the SCH_PIN bounding box function and the
SCH_PAINTER draw function.

And the SCH_PIN one was slightly wrong, as it didn't take into
account the PIN_TEXT_MARGIN, or the electrical types.

Provide a way for clients of the PIN_LAYOUT_CACHE to access
the name and number boxes.
2024-10-26 15:04:51 +08:00
John Beard
f29d1fafe4 Include dangling indicator in SCH_PIN bbox
Delegate computation of the size and location of the pin dangling
indicator to the PIN_LAYOUT_CACHE.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/18894
2024-10-26 15:04:51 +08:00
John Beard
fe48e51315 SCH_PIN: break out layout calculations
The bounding box calculations of SCH_PINs are pretty complicated.
There is already caching of the name and number texts, but the
SCH_PAINTER (for example) has to repeat this work and sometimes
slightly diverges. For example, dangling indicators and alt
icons are painted, but not included in the bbox.

This commit introduces a more encapsulated 'layout cache' object which will
take care of caching the current extents, but also providing layout
geometry to SCH_PAINTER (and other interested code, like hit testers
on a given field) witohut requiring recomputation or reimplementation.

The extents calculations use exclusively the public API, so it's nice
and easy to split it out.

In this commit, nothing is functionally changed - the name and number
are still cached, and everything else is computed in the exact same way.
This is the groundwork for fixing this issue:

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/18894
2024-10-26 15:04:51 +08:00
John Beard
884530e699 SCH_RENDER_SETTINGS: Remove duplicate electrical type setting
This class had m_ShowPinsElectricalType and m_ShowPinElectricalTypes.
Nearly everything used the former, only one callsite used the latter,
which would never have been changed.
2024-10-22 22:45:32 +08:00
John Beard
91dca89116 Eeschema: Add indicator icons for pins with alt modes
This makes it easier to see which pins have alt modes
available. There is an option to turn them off.

The icon positions are chosen so they they shouldn't
interfere as far as possible:

* If the text is inside, the icon goes more inside
  the body
* If the text is above/below the pin, it goes away from
  the body

This means it won't collide with a symbol wall in
most cases, but some symbols with alt pins on opposing
sides may need to be widened if the icons are show.

Includes a rather fiddly refactor of the SCH_PIN painter
function, which needs quite a lot of massaging to allow
it to figure out where an icon would go. Quite a bit
of logic is broken out into smaller encapsulations with
less visible state to each chunk.

Icon modes for base-name-selected and alt-selected are
included, but only the former works due to information
being thrown away during the SCH_PAINTER tempPin
process.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/11069
2024-10-08 23:30:50 +08:00
John Beard
76c328db84 SCH_PIN: Fix missing alt assign in copy ctor 2024-09-30 16:22:43 +01:00
Jeff Young
16340e6cf4 Support both short and long item descriptions. 2024-06-28 22:10:22 +01:00
Wayne Stambaugh
74070afbc6 Fix a bunch of GCC build warnings compiling the schematic editor.
Apparently GCC does not like competing definitions of the == operator.
The recent refactoring away of all LIB_ITEM objects created a conflict
with the SCH_ITEM == operator definition.  This change required some
rather ugly comparison changes.  There were no unit test failures but
that doesn't mean something didn't get broken.
2024-06-11 08:07:32 -04:00
Seth Hillbrand
79a354bf0e Unify SCH_PIN ambiguity in equality operator
Remove != operator that is not used for C++20 and reworked
SCH_PIN==SCH_ITEM operator that was not reciprocal
2024-05-31 13:42:36 -07:00
jean-pierre charras
87d3d38552 Eeschema, Pin helpers: fix wrong label orientation if the symbol is rotated
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18012
2024-05-16 17:15:06 +02:00
Jeff Young
8aab764c33 Handle m_alternates in operator= and copy c'tor.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17966
2024-05-07 15:07:33 +01:00
Jeff Young
352463dfeb Fix pin drawing after removal of upside-down coords. 2024-04-28 15:24:19 +01:00
Jeff Young
c59ed0bbb7 Flip symbol editor's Y axis to match other editors. 2024-04-27 13:47:56 +01:00
Jeff Young
615f84e567 SCH_PINs define their own sorting order.
Don't use SCH_ITEM's compare function.

This is required so that SCH_PINs sort in the same
order as their LIB_PIN equivalents in the library.
2024-04-26 23:10:19 +01:00
Jeff Young
02c1eef3be Simplify parsing of alt pin definitions. 2024-04-26 20:11:33 +01:00
Jeff Young
e8be782687 Mostly clean-up, but also bug fixes with bounding boxes. 2024-04-22 11:16:14 +01:00
Jeff Young
7d8215401a Fix message panel for pins, take 2. 2024-04-21 15:14:10 +01:00
Jeff Young
b4239b3ee4 Fix message panel for pins. 2024-04-21 14:51:07 +01:00
Jeff Young
320f531110 Improve inheritance processing; simplify hidden flag. 2024-04-21 12:19:22 +01:00
Jeff Young
c0f480eea8 Lint reduction. 2024-04-21 12:19:22 +01:00
Jeff Young
9f691d063c Fix default pen width for pin text. 2024-04-20 18:25:17 +01:00
Jeff Young
95136494b3 RIP LIB_PIN. 2024-04-20 12:10:31 +01:00
Seth Hillbrand
0e0ada8e4e Allow NIC pins to be stacked
Previously, we only allowed pins of the same time as well as passive
pins to be stacked.  This change allows NIC pins as well since they are
not internally connected, there is no reason that they cannot be tied to
another pin electrically
2024-04-17 10:00:00 -07:00
Marek Roszko
96cdfc7fa7 Update equality overloads for C++20
C++20 added new reverse and rewritten candidates. This can confuse the compiler because it'll test both A==B and B==A for overloads.
Because we were defining parent class equality overloads, A==B and B==A was considered ambigious due to both being compatible in casting.

So we needed to add explicit child class equality operator overloads
2024-04-12 23:05:58 -04:00
Jeff Young
5abc7145da Fold LIB_ITEM into SCH_ITEM. 2024-04-08 10:24:50 +01:00
Jeff Young
1028a76e4a Harmonize print/plot APIs. 2024-04-06 09:34:56 +01:00
Jeff Young
92910d5d0f Factor common parts of SCH_ & LIB_SYMBOL into SYMBOL. 2024-04-04 13:18:55 +01:00
Jeff Young
a6e8370ddd Pin names drive netnames. 2024-03-16 19:26:26 +00:00
Wayne Stambaugh
c5a02fc266 Do not update schematic connectivity for irrelevant property changes.
Prior to this change, the schematic connectivity was updated any time a
change was made to a connectable object.  Now the connectivity is only
updated when an object change actually affects the connectivity.  Other
properties like line width, fill type, custom fonts, etc. will not cause
the connectivity graph to be rebuilt.

The SCH_COMMIT flag SKIP_CONNECTIVITY has been removed.  All schematic
objects can test if they are connectable and if there have been changes
to any connection properties that require a connectivity rebuild.

Remove duplicate rebuild connectivity calls from editor control tool.
This was causing the tangling end test to get called four times on every
undo and redo action because the dangling end test is already called in
the connectivity graph calculation code.

Update connectivity when changing label names which fixes an unreported
connectivity bug.
2024-03-09 08:50:26 -05:00
Alex Shvartzkop
e5896374e3 Normalize SCH_PIN BBox to fix assert.
(cherry picked from commit 3e26e7b646b5e5d8c441cd4326badfdc8cf9f317)
2024-02-23 20:29:18 +03:00
Wayne Stambaugh
e302261067 More issue #16846 invalid pointer checks.
This has now pushed the issue down to a broken RTree issue.  Skipping the
asserts in debug builds will still crash but now it's pushed down to the
RTree.
2024-02-10 15:41:10 -05:00
Wayne Stambaugh
ae9175927b Fix broken schematic pin selection caused by commit 1ac5666164. 2024-02-10 08:26:52 -05:00
Marek Roszko
d3ca82b0b5 Fix another build error 2024-02-09 20:18:13 -05:00
Wayne Stambaugh
04ccf7e885 Explicitly create wxStrings for assignment to make MSVC builds happy. 2024-02-09 17:37:36 -05:00
Wayne Stambaugh
9e9ee96181 Explicitly create wxString for return value. 2024-02-09 17:11:49 -05:00
Wayne Stambaugh
1ac5666164 Do not de-reference null library pin object pointers in SCH_PIN object. 2024-02-09 11:07:04 -05:00
Wayne Stambaugh
466c707e91 Check for invalid library pin object pointer. 2024-01-31 12:17:11 -05:00
Jeff Young
fb8f05fb34 Correctly report body style in symbol checker.
Also fixes a bug where off-grid pin locations were truncated.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16770
2024-01-26 18:11:23 +00:00
Jeff Young
ae735d3eb4 Renaming: replace convert with body-style.
No functional changes.
2024-01-26 16:21:03 +00:00
Jeff Young
af158715e5 Honour alternates when getting SCH_PIN description.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16407
2023-12-23 13:30:15 +00:00
Seth Hillbrand
d99641be40 ADDED: Git integration support
Adds support for project-based git integration, branch support, commit,
revert and updates

Fixes https://gitlab.com/kicad/code/kicad/issues/10441
2023-10-20 12:51:47 +00:00
Jon Evans
148e111579 Refactor pin orientation to be an enum class
Add various LIB_PIN properties
2023-07-26 23:46:15 -04:00
Jon Evans
632e94ef81 Add a few more schematic properties 2023-07-01 22:24:25 -04:00
Jon Evans
3a0f8214fa ADDED: Properties panel for schematic editor
Initial infrastructure work; follow-ons will add more
properties for schematic items.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6351
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14105
2023-06-22 22:32:24 -04:00
Jeff Young
b41d446f58 Fix a bunch more issues with sheetpaths and allowExtraText.
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).
2023-05-05 17:23:52 +01:00
Mike Williams
c8fdac7abe Schematic: correctly resolve global power nets using sheet variables
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/7445
2023-03-08 11:52:43 -05:00
James J
39e56485fc Consolidated ERC fixes
- Consistent calculation of IsStacked() for pins across ERC checks
 - Correct placement of ERC marker for unresolved field variables
 - Add sheet-specific paths to two ERC check results
2023-03-07 00:37:33 +00:00
Mike Williams
5995e0e516 Power Symbols: make value editable, use as netname
QA: update tests for editable power symbol values
2023-02-22 18:01:47 +00:00
Mike Williams
ca5004b1d2 Power Symbols: rename IsPowerConnection to IsGlobalPower
It's kind of confusing because we have power type pins, and pins that
make global power nets as part of power symbols.
2023-02-22 18:01:47 +00:00
Jeff Young
bc108023b3 ADDED operating point overlay for SCH_EDIT_FRAME.
Fixes https://gitlab.com/kicad/code/kicad/issues/11253
2023-02-11 21:11:07 +00:00