1086 Commits

Author SHA1 Message Date
Jeff Young
0bcf6000a4 Formatting. 2024-12-08 21:46:54 +00:00
Jeff Young
81834a023e Don't duplicate tooltips and descriptions, but do use the description if there's no tooltip.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19155
2024-11-19 23:39:41 +00:00
jean-pierre charras
e9651794d6 View menus: fix show/hide panel inconsistencies in FP and Symbol editors
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19147
2024-11-18 15:37:30 +01:00
John Beard
03f11eea78 Exclude letter hotkeys from Shift fallback
There is a fallback mechanism here designed to catch cases
where a hotkey is bound to a key that needs Shift to be
input (e.g. ? requires Shift on many non-US keyboards,
but the hotkey for that should be '?', not 'Shift+/'). For any key
where the two options are equally-valid "main" key (e.g. '6' and '^'
or '?' and '/' or ':' amd ';'), this is correct, as it allows
the hotkey to be simply the character in question.

Letters don't require this treatment - using this fallback
in the letter case means that a hotkey bound to 'B' will
also fire when 'Shift+B' is pressed, even when Shift+B is
bound to something else. In fact, it could even preempt the
real Shift+B hotkey.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19093
2024-11-08 19:48:03 +08:00
John Beard
1a86982a2a Avoid enum name conflict on MacOS. 2024-11-05 08:20:37 +08:00
John Beard
dbf68a80b8 GAL: also scope layer depth push/pops
This means that an early return or an exception between
a manual Push/Pop (or an omission of the Pop) cannot
corrupt the layer stack.

It also means the GAL doesn't have to maintain its own
stack (with the in-scope GAL_SCOPED_ATTRS taking that role).

Reomve the Push/PopDepth functions, as they're only ever
used in pairs, and doing it manually needs more care.
2024-11-04 20:41:44 +08:00
John Beard
87cd0a74f2 Point editor: unify segment, circle, bezier and tablecells (partial)
For segment, circle, beziers, these are the same in all editors and only
need access to the EDA_SHAPE nature, so we can remove the duplication
entirely.

For TABLECELLs, while the cells are polymorphic in that PCB and SCH
cells are both EDA_SHAPEs (via the TEXTBOXes), the parent TABLES
are not polymorphic, and thus the implementation can't be trivially
de-duplicated. Rather than do something with templates, just keep
it simple for now and maybe look at unifying tables later on.
2024-11-04 20:41:15 +08:00
John Beard
970d9b3615 Eeschema: point editor: edit polygons as on PCB
This includes edge dragging which is useful for rule areas.
2024-11-03 17:15:18 +08:00
John Beard
c6f7fa9b6e Add a zoom/pan-to-selection actions
This is useful is some process ends up doing sometihng
offcreen and wants to show you.
2024-11-02 03:09:52 +08:00
John Beard
59759b325f Fix scroll events in things not using WX_VIEW_CONTROLS
Make sure not to handle wheel events with 0 or 1 modifiers -
those are for the view handler, not the tool framework. We
can't rely on WX_VIEW_CONTROLS to run first, it's not always
used, for example in the 3D Viewer.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19026
2024-10-31 19:51:52 +08:00
Jon Evans
031c5417a1 Fix build on macOS 2024-10-26 21:48:54 -04:00
John Beard
f09d274a3e Construction geom: thread must be constructed last
If the thread starts before the proposal tag is constructed
as nullopt, the thread can unblock and think it has a proposal.
This isn't true, so it reads junk memory and crashes.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/18835
2024-10-27 07:41:16 +08:00
John Beard
4846d07e47 Construction geometry: lighter on the stack
Pass things as unqiue_ptrs. I don't think there's that much
on the stack, but certainly addinig big enough chunks to the batches can
upset the coroutines.

Also reinstate a ClearDrawables which went AWOL.pick

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/18835
2024-10-27 07:07:25 +08:00
John Beard
9c9542deea Bind multiply-modified scroll events to the increment action
Implemented as handling un-consumed scroll events that the
WX_VIEW_CONTROLS doesn't want because it has too many mods
set. Then dispatch these as TA_MOUSE_WHEEL events.

The default action from the selection tools is to run the
'increment' ACTION, which is implemented differently in the
various tools: eeschema can increment labels, symedit
does pin names and numbers, and fpedit does pad numbers.
2024-10-26 16:00:58 +08:00
John Beard
3f602f8177 Add 'Increment' actions
These are context sensitive actions that increment "something"
about the selected item.

A generic 'increment' action can be produced, e.g. by other tools
or UI events, which has in increment step (positive or negative)
and an 'index' which determines what about the item should be
incremented - it's up to the increment action handler to decide
what that means.

And then add a primary and secondary inc/decrement action,
which allows to bind hotkeys to each.

Bind these to:

* Sym edit: increment pin names/number
            increment text items
* Sch edit: increment lables and text
* FP/PCB:   increment pin numbers
            increment text items
2024-10-26 15:46:16 +08:00
John Beard
b092675171 FP edit: add 'show datasheet' action that acts on the documentation link
This is already shown in the footprint browser window as a special
item, so allow the 'D' hotkey to access it as well.
2024-10-14 23:20:19 +08:00
John Beard
c799966774 Handle pasting of image data from the clipboard
Also move some clipboard functions out of TOOL_MANAGER,
as they had no dependency on that class, and are just free
functions around wxTheClipboard.
2024-10-13 20:47:45 +08:00
John Beard
b0043587c2 Add 'Copy as Text' action
This is useful when you want to copy text content out to some
external program (or put it in a text item/box).

I'm not sure it's possible to intuit exactly what a user wants,
as you will often want to copy items as the real items, and sometimes
as text. While KiCad might be able to make a smart guess, external
programs will have no chance!
2024-10-13 20:47:45 +08:00
John Beard
4bad76825c Standardise clamp function
std::clamp and alg:clamp had different argument orders.
Since std::clamp is constexpr, we might as well just use
that now we have it.
2024-10-09 21:27:58 -06:00
Mike Williams
bd652fd88f symbol editor: fix library pinning 2024-10-08 15:32:00 -04:00
John Beard
8f95211bbe Construction mgr: protect batch containers
These are added to from the activation delay thread, but
accessed from the tool thread (e.g. via computeAnchors)
so they should be protected from concurrent access.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/18835
2024-10-05 23:53:08 +01:00
John Beard
312996f0a2 Extension snaps: don't accept empty batches
These shouldn't be bad, and probably don't actually happen,
but they will act to clear extant construction lines for no
new shown items, so may as well be clear that they don't
do anything.
2024-10-05 23:08:15 +01:00
JamesJCode
64c24fc04b UI consistency improvements 2024-10-02 19:44:48 +01:00
John Beard
e23b83505e Snapping: delayed activation of snap points.
This makes it easier to control what snap points you are aiming for
without accidentally activating objects just by mousing near them
on the way to somewhere else.
2024-10-01 18:06:27 +01:00
jean-pierre charras
e2282a4af8 Minor cosmetic enhancement: add icon to Revert and Generate Legacy BOM tools 2024-09-27 13:34:20 +02:00
John Beard
30e51f7d1a Pcbnew: Show some helper lines in point editor
Some shapes, like arcs and beziers have "lines" that
can be useful to see when editing, but aren't directly
editable and may not overlap the object's own lines.

So make it possible to, indepedently:

 - Turn off the centre-point drag handle affordance
 - Show the actual line segment on screen.
2024-09-26 10:17:23 +01:00
Mike Williams
867cb58175 feature removal: remove Show Hidden Text
Does not work properly since 8.0 introduction of footprint fields.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18656
2024-09-19 15:41:44 -04:00
John Beard
ebef24b6b0 Debug: graphical snap anchor debug mode
When working near snap anchors, which come and go
rapidly, it's often useful to see what snaps have been
calculated. Add an advanced config to show these
(EnableSnapAnchorsDebug) on an overlay layer.

With more polish this could be a hotkey or something.
2024-09-11 22:35:35 +01:00
John Beard
b2be0d39bd Snapping: Add construction geometry snapping
This is a pretty major rework of the snapping system.
The GRID_HELPERs now have a separate CONSTRUCTION_MANAGER
which handles some of the state involving "construction
geometry".

This is fed with 'extended' geometry (e.g. "infinite" lines from
segments) for use in generating things like intersection points.
It also handles adding this geoemtry to a GAL view item
(CONSTRUCTION_GEOM) for display to the user.

The process is:

* A TOOL creates a GRID_HELPER
* Optionally, it pre-loads a "persistent" batch of construction
  geometry (e.g. for an item's original position)
* The grid helper finds useful snap 'anchors' as before, including
  those involving the construction items.
* Other items on the board can be 'activated' by snapping to one
  of their main points. Then, if it has construction geometry,
  it will be added to the display. At most 2 items of this kind of
  geometry are shown, plus the original item, to reduce avoid
  too much clutter.

The dashed snap lines state machine is also handled in the
CONSTRUCTION_MANAGER and displayed in the CONSTRUCTION_GEOM item.
2024-09-11 22:35:35 +01:00
Mike Williams
b2dda11fae design blocks: move table manager to common dialogs
Also add to schematic editor preferences.
2024-09-10 15:50:03 -04:00
Mike Williams
2c99bc6c6d new feature: Schematic Design Blocks
Added to advanced config, default to off.
EnableDesignBlocks=1 in kicad_advanced to test

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/2263
2024-09-05 08:35:49 -04:00
Jeff Young
3441861988 Make arrow keys respect grid overrides. 2024-08-28 19:54:23 +01:00
Jeff Young
535aca7a8d Remove redundant tooltips.
Also fixes grammar and capitalisation in a few tooltips.

Also standardises some terminology, such as
"Add" vs "Draw"/"Place" and "Assignment" vs "Association".

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17694
2024-08-18 17:18:07 -06:00
Mark Roszko
f389390c0c Disconnect events in ~ACTION_TOOLBAR 2024-08-16 11:11:20 +00:00
Tomasz Wlostowski
9963b9dd9f TOOL_INTERACTIVE: only create the context menu when we are running in GUI mode
TOOL_MENU::m_menu was unconditionally created by the TOOL_INTERACTIVE constructor, resulting in crashes if
we wanted to run the TOOLs in headless  mode, e.g. in unit tests. This commits makes
the creation of the menu object dependent on Pgm::IsGui().
2024-08-13 22:50:26 +02:00
Jon Evans
bd946313dc ADDED: Position items relative to arbitrary reference point
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4756
2024-08-11 18:59:26 -04:00
Seth Hillbrand
094d265313 Re-enable grid snap line
This was accidentally disabled by 4039b7da6b9095b14e50eed37d76d29cee5f4111
2024-08-08 14:29:27 -07:00
Jeff Young
9fcbd4e6d0 Slight reduction in asserts. 2024-07-18 18:01:05 +01:00
Seth Hillbrand
77797103f7 Add ability to embed files in various elements
Schematics, symbols, boards and footprints all get the ability to store
files inside their file structures.  File lookups now have a
kicad-embed:// URI to allow various parts of KiCad to refer to files
stored in this manner.

kicad-embed://datasheet.pdf references the file named "datasheet.pdf"
embedded in the document.  Embeds are allowed in schematics, boards,
symbols and footprints.  Currently supported embeddings are Datasheets,
3D Models and drawingsheets

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6918

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2376

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17827
2024-07-15 16:06:55 -07:00
aris-kimi
6969b9d64f Open library file preselected in the file explorer for both symbol and footprint editors. 2024-07-10 06:14:04 +00:00
Seth Hillbrand
c0bf866c58 Speed up shutdown
When shutting down, we shouldn't need to do a lot of things like
resyncing the PNS world multiple times that can really slow down the
process
2024-07-05 11:16:20 -07:00
Jeff Young
16340e6cf4 Support both short and long item descriptions. 2024-06-28 22:10:22 +01:00
Jeff Young
c549a214c9 Performance: don't alloc std::vector in critical areas.
For some history, see also aa2ad3b44c3e533cf00a5077db17fb0ee7e302eb
2024-06-21 19:07:46 +01:00
Alex Shvartzkop
ece46223c9 Fix shadowed/conflicting enum values. 2024-06-21 16:16:29 +03:00
Jeff Young
ed0869aa0c Share more library tree code. 2024-06-08 19:06:10 +01:00
jean-pierre charras
dc6b211227 better tool tips 2024-06-07 11:19:56 +02:00
dsa-t
34f0fb8f21 Revert "Don't reset the view controls state just because we are setting the already active tool state again"
This reverts commit e914c0c1a073ef9f221ee0cbb3384acefffe5159

(cherry picked from commit 6b7b6fa3e3960aeec405880a47f4c4f2330e872b)

Co-authored-by: Mark Roszko <mark.roszko@gmail.com>
2024-06-04 18:03:41 +00:00
Alex Shvartzkop
cf7ad330e9 Fix some platform ifdef checks. 2024-06-01 06:49:11 +03:00
Marek Roszko
132ecee665 Don't reset the view controls state just because we are setting the already active tool state again 2024-05-23 22:23:34 -04:00
Alex Shvartzkop
85f5b8849e Invalidate control sizes in ACTION_TOOLBAR. 2024-05-23 00:40:47 +03:00