Commit Graph

104 Commits

Author SHA1 Message Date
Seth Hillbrand a9ae86eefd Cleanup geometry functions
Added Distance(VECTOR2) function that returns a double.  Removed
superfluous EuclideanNorm, GetLineLength, integer constructor for
EDA_ANGLE (this promotes to double in the CTOR), DistanceLinePoint and
HitTestPoints

Also extended the size for arc calculations that get distances to center
points to avoid overflow
2024-05-31 12:26:37 -07:00
Jeff Young c998234dec Restore accidentally deleted text size constraint algo.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17284
2024-05-03 22:12:34 +01:00
Jeff Young 65554943e0 lint reduction 2024-05-03 22:12:34 +01:00
Alex Shvartzkop 865e3a9f3c Improvements when working closer to 32-bit integer limits.
- Changes BOX2 size to extended coordinates.
- Adds BOX2ISafe to construct a BOX2I that will fit in int32.
- Adds more checks.
- Safer computations.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17670
2024-04-23 16:34:07 +00:00
Alex Shvartzkop e71cbea7f8 Use a version string without the extra packaging info in drawing sheets.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17176


(cherry picked from commit c59fac4089)
2024-02-29 01:24:39 +00:00
Jeff Young e7abeb3c38 Cleanup. 2024-02-24 20:05:51 +00:00
Jeff Young 33d93b79a3 Handle nested text variable references in title block.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16919
2024-02-09 12:37:13 +00:00
Alex d4879e05ac Use semantic version in drawing sheets. 2024-02-03 20:24:26 +03:00
Marek Roszko 22288adb7d Reduce KICAD_VERSION in drawing sheets to something simple 2024-01-28 15:48:02 -05:00
Alex Shvartzkop 26c8c718eb Fix drawing sheet border random thickness glitch. 2023-12-05 19:31:26 +03:00
Jon Evans f3360a4442 Quote base64 data in DS and schematic 2023-11-29 16:17:41 +00:00
Jon Evans 4ff127b452 Parse generator_version and improve error output on mismatch
Also bump symbol format version for generator_version
2023-11-29 16:17:41 +00:00
Jon Evans 0face5a891 Add prettification to pl_editor; bump version 2023-11-29 16:17:41 +00:00
Marek Roszko d1ecf3790c Add generator version 2023-11-29 16:17:41 +00:00
Mike Williams f993e45325 Variables: make consistent across editors
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/16180
2023-11-29 09:55:17 -05:00
Jeff Young 3c1478367f Handle flipped state when checkging item against viewport.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15768
2023-09-30 22:54:45 +01:00
Jeff Young d6a862cafe It's "internal units", not "user interface". 2023-09-30 22:54:45 +01:00
Marek Roszko 22b733209d Fail GAL on its header leaking audit
Maybe we should rethink directly accessing GAL so much, but at least 600 files didn't need GAL leaked into them due to view_overlay.h
2023-09-18 19:52:27 -04:00
Marek Roszko 11de95778b Unwrap the FROM_UTF8 macro in favor of direct function
The extern just gets annoying to try to export the func later. We also yeet TO_UTF8 to string_utils.h for parity.
2023-09-09 00:10:57 -04:00
Seth Hillbrand f9b745f3d2 Allow multiple format image saving
- Keep original image data.  When loading JPEG, this avoid recompression
  that changes file data and decreases image quality
- Allow schematic and page layout editors to store non-PNG data as well
- Move page layout editor to store base64 instead of hex-coded data
2023-09-06 12:12:32 -07:00
Jeff Young 5e112ca78e ADDED: parameterize font metrics and allow customization of overbar height. 2023-08-06 20:57:41 +01:00
jean-pierre charras 4f3e7e6821 *.wks files: always save text font when it is not the default font.
Fixes #15154
https://gitlab.com/kicad/code/kicad/-/issues/15154
2023-07-09 10:51:33 +02:00
Alex Shvartzkop b242779f3b Put background color behind transparent bitmaps in eeschema printing.
Most virtual printers don't support alpha blending via AlphaBlend (MSW)
properly, nor masks.
2023-07-03 02:15:05 +03:00
jean-pierre charras e7fac08c2f Worksheet editor: fix crash when adding new graphical text object.
Was due to use of a null pointer.
Fixes #14966
https://gitlab.com/kicad/code/kicad/-/issues/14966
2023-06-16 17:31:38 +02:00
Jeff Young 782c73300b Move drawing sheet datastructures to EDA_IU_SCALE.
Or mostly, at least.  Plotters still define their own mils-to-iu scale.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14934
2023-06-12 22:34:25 +01:00
Jeff Young 3ab9175553 Spread the error-bar move evenly around justified text. 2023-05-27 18:53:04 +01:00
Jeff Young f35a88ce0b Cache LIB_PIN text extents for performance.
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
2023-05-27 16:32:11 +01:00
Jeff Young 4ed267394a Outline font performance improvements.
1) Don't fracture font glyphs when generating them; we're going
   to fracture during triangulation anyway.
2) Don't check for self-intersection when deciding to fracture.
   It costs nearly as much as the fracture does.
3) Cache drawing sheet text.
4) Use the current font when checking for cache validity.
5) Parallelize glyph triangulation.
6) Don't invalidate bounding box caches when offset by {0,0}
7) Use the glyph cache when generating text effective shape.
8) Short-circuit NormalizeJustification() if its center/center.
9) Don't triangulate for GuessSelectionCandidates()
10) Avoid sqrt whenever possible.
11) Pre-allocate bezier and SHAPE_LINE_CHAIN buffers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14303
2023-05-27 01:35:40 +01: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
Jeff Young 0fb1ccff21 Commenting and formatting. No functional changes. 2023-03-13 18:29:55 +00:00
Marek Roszko aacc9746e3 Yeet the last of wxSize/wxPoint to stop leaking gdicmn everywhere 2023-02-18 22:57:18 -05:00
jean-pierre charras 5da5ccc4bf pagelayout_editor: fix some minor issues:
- text color not always stored in file
- Indicator for changes in main title not updated after save.
2023-02-09 14:16:26 +01:00
jean-pierre charras 0d903d43a0 pagelayout editor: Add tests for invalid parameters.
Invalid parameters are repeat count < 1, size < 0 and default size < 0.01 mm
2023-02-07 12:53:34 +01:00
Seth Hillbrand 823607796b Additional safety around wks bitmaps
Invalid files can create large problems for unloaded PNG data

Fixes https://gitlab.com/kicad/code/kicad/issues/13801
2023-02-07 12:08:39 +01:00
Marek Roszko 0ff32d20cd wxS more things 2023-01-22 09:41:42 -05:00
Marek Roszko 323bec4adc Remove hidden undocumented env var for worksheet
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8342
2023-01-22 08:56:28 -05:00
Jeff Young 2367c5cf1b Fix another early return while evaluating text variables.
Fixes https://gitlab.com/kicad/code/kicad/issues/13610
2023-01-20 19:20:15 +00:00
Jeff Young f399dc0c3a Nullptr safety. (Sentry KICAD-4F) 2023-01-18 01:16:57 +00:00
Jeff Young 26c821962f Simplify and regularize text variable substitution architecture.
EDA_ITEMs are responsible for giving their parent a crack at it if
they failed to resolve it.  This recurses all the way up to the schematic/
board, and then to the project.

Cross-reference handling is also move to the EDA_ITEMs.  It must be done
before bubbling up so that we don't end up in loops.  (The aDepth parameter
will break the loop, but without having done anything useful.)

Fixes https://gitlab.com/kicad/code/kicad/issues/13541
2023-01-17 17:05:41 +00:00
Jon Evans c530bdb5a1 Rename GetSelectMenuText to GetItemDescription
This descriptive text is used for many more things than
just the select menu these days.
2023-01-11 22:27:44 -05:00
Jeff Young cef7cd8f7c Move default font to RENDER_SETTINGS.
Fixes https://gitlab.com/kicad/code/kicad/issues/12723
2022-10-22 21:32:42 +01:00
Jeff Young 38c863c3f4 Attempt to fix nullptr error when looking up units scale in pl_editor.
(I can't be sure if this works or not because my M1 build won't launch
pl_editor for some reason.)

Fixes https://gitlab.com/kicad/code/kicad/issues/12717
2022-10-22 14:11:01 +01:00
Jeff Young 7f34586c7e Allow text variable resolution through properties in drawing sheet text.
Fixes https://gitlab.com/kicad/code/kicad/issues/12473
2022-09-20 15:28:05 +01:00
Jeff Young 64a6fc0fd4 Push UNITS_PROVIDER down into a low-level mixin.
This allows us to also construct cheap UNIT_PROVIDERs for specific
tasks when necessary.
2022-09-19 17:10:59 +01:00
Jeff Young 45d6b4a9fc Readability improvements. 2022-09-19 11:18:20 +01:00
Marek Roszko ece23d434b Split up Double2Str to a format function to make its use case clear 2022-09-17 00:10:22 -04:00
Mark Roszko b00178adb3 Nuke base_units from orbit 2022-09-16 04:38:10 +00:00
Jeff Young 9188838e50 RIP EDA_RECT. 2022-08-31 23:57:24 +01:00
Jeff Young f17a865593 Move EDA_ITEM hitTest to BOX2I. 2022-08-31 17:18:45 +01:00
Jeff Young 2dc6300501 Move EDA_ITEM bounding boxes to BOX2I. 2022-08-31 10:16:55 +01:00