Compare commits

...

163 Commits

Author SHA1 Message Date
Wayne Stambaugh 2f36c670ff Tag release version 5.1.5. 2019-11-14 12:09:45 -05:00
jean-pierre charras d701c3a480 Gerber plot: fix a minor issue: TF attribute "Drawing" is now "OtherDrawing,Comment" This is due some changes in recent Gerber file format. 2019-11-05 20:15:00 +01:00
jean-pierre charras cd7f3375b2 Add missing code to plot Bezier curves (EDGE_MODULE shape) in footprints 2019-11-05 20:14:48 +01:00
jean-pierre charras 46cd185524 Fix incorrect HitTest in DRAWSEGMENT (bezier curve) 2019-11-05 16:21:45 +01:00
jean-pierre charras e04d82e940 Gerber plot: minor fixes in TO object attributes.
Gerbview: remove a outdated warning about RS274D format.
2019-11-05 14:25:30 +01:00
jean-pierre charras 26d0863921 minor fix in a python script (kicad_netlist_reader.py) Sort lists was incorrectly made. 2019-11-05 14:25:30 +01:00
Jeff Young 37f23fa537 When copying an item it's no longer at the original location and so can't be "locked".
Fixes: lp:1851038
* https://bugs.launchpad.net/kicad/+bug/1851038
2019-11-03 17:43:36 +00:00
Seth Hillbrand 167d408b5e qrcode: Handle Python3 integer promotion
In Python3, all division operators promote integers to floats.  We need
to downcast back to integer for the polygon vertices.

There was also an unhandled overflow in the QR generation that allowed
more than 512 bits to be loaded.  This overflows the type of QR we
generate, so this truncates the input string to 62 bytes ( leaving 12
bits for the checksum )

Fixes: lp:1850223
* https://bugs.launchpad.net/kicad/+bug/1850223

(cherry picked from commit 9bccbaf497)
2019-11-01 14:57:07 -07:00
Jeff Young d4a8ff4872 Backported edit point colour fix from master.
Fixes: lp:1846372
* https://bugs.launchpad.net/kicad/+bug/1846372
2019-10-31 23:35:23 +00:00
jean-pierre charras fb9b12a982 Footprint editor: fix a crash when trying to edit the properties of a footprint not yet in tree (i.e. imported from file)
(cherry picked from commit cee1873fff)

Fixes: lp:1850497
* https://bugs.launchpad.net/kicad/+bug/1850497
2019-10-29 13:13:54 -07:00
Wayne Stambaugh 88a03f1a1d Begin version 5.1.5-rc2 development. 2019-10-25 14:31:02 -04:00
Wayne Stambaugh ba7e400e13 Tag release version 5.1.5-rc1. 2019-10-25 14:24:51 -04:00
Seth Hillbrand 57f0f88552 pcbnew: Treat circular ovals as circles
The oval clearance adds an edge on the 0-length side of a circular oval.
This is not needed and can affect the fill algorithm.  Instead, we treat
round ovals as circles for pad polygons

Fixes: lp:1849846
* https://bugs.launchpad.net/kicad/+bug/1849846
2019-10-25 09:28:09 -07:00
jean-pierre charras 42a0cf6283 PCB_BASE_FRAME::SelectFootprintFromLibTree(): fix annoying issue: the progress reporter was displayed after loading libraries, because it was destroyed too late. 2019-10-25 18:08:02 +02:00
Seth Hillbrand b67acd5ea1 pcbnew: Fix 45° snapping polygons
The constrained draw was constraining the polygon size to fit the
existing points rather than extending the existing points to fit the
user's intent.

This adds a 90° double-joint for the completion polygon that allows the
user to complete common constrained polygons visually based on the
preview with a double-click to finish.

(cherry picked from commit bae50fab9f)

Fixes: lp:1849299
* https://bugs.launchpad.net/kicad/+bug/1849299
2019-10-24 16:05:27 -07:00
Seth Hillbrand 5e2721d2f5 Increase visibility of polygon preview
This set the polygon preview item to wider size and adjusts the draw
order to ensure it remains visible even when antialiasing

(cherry picked from commit ea1c8525ce)
2019-10-24 16:05:12 -07:00
jean-pierre charras 2cd43aee0a Gerber output: fix some (minor) issues related to attributes when plotting polygonal pads.
rect (when not horizontal or vertical), trapezoid and custom shapes are draw as polygons.

The dummy pad used to give attributes is removed, and TO attributes are used in Regions (polygons in Gerber dialect)

This is due to some modifications in Gerber format since the attributes are added in Kicad.
2019-10-24 09:32:40 +02:00
jean-pierre charras fb1570d290 DIALOG_POSITION_RELATIVE_BASE: fix wxWidget alerts 2019-10-23 20:41:00 +02:00
Seth Hillbrand 79972ad4db pcbnew: Fix DXF Import with blocks
BLOCK elements in DXF are re-usable bits that are useful when editing
the file but should not be shown when importing the model.  This skips
all references except those that exist in the default "*Model_Space".
This block is required in each DXF file and cannot be renamed.

Fixes: lp:1790821
* https://bugs.launchpad.net/kicad/+bug/1790821

(cherry picked from commit df3fabfa21)
2019-10-23 11:31:43 -07:00
Ian McInerney 61934c285c pcbnew: Fix deletion of vias in global delete window
Fixes: lp:1847580
* https://bugs.launchpad.net/kicad/+bug/1847580

(cherry picked from commit 3b1817ee32)
2019-10-23 12:25:00 -04:00
Seth Hillbrand a7d554971c eeschema: Pad spice ops to differentiate
The .op command is isolated, so differentiating from .option with a
space will only work if we ensure all commandlines have a space at their
end.

(cherry picked from commit 4004c733c8)
2019-10-23 06:33:10 -07:00
jean-pierre charras e54ea90607 PROGRESS_REPORTER: fix serious bug in its DTOR: the DTOR was calling Destroy. But Destroy() in wxWidgets calls the DTOR.
It can create recursive calls of the DTOR.
2019-10-23 11:29:44 +02:00
jean-pierre charras fda403a079 Fix potential issue 2019-10-21 08:26:22 +02:00
Sylwester Kocjan f2e75c96be eeschema: fixed recognizing SPICE sim directive
(cherry picked from commit 1c01cc001d)
2019-10-20 12:11:38 -07:00
Seth Hillbrand 322eb2b8a8 pcbnew: Commit polygon points to new constrained zone
Adds leader points if they are not already existing in the zone

Fixes: lp:1846028
* https://bugs.launchpad.net/kicad/+bug/1846028

(cherry picked from commit 2e1af66a2b)
2019-10-20 10:31:08 -07:00
Seth Hillbrand 6f71183d0e Revert "kicad2step: scale models"
This reverts commit 5064df4ba2.

There were un-addressed issues with the VRML substitution and concerns
by MCAD folks that ECAD designers should not be allowed to perform this
action.  Full addressing in v6.
2019-10-20 10:06:43 -07:00
Seth Hillbrand 5d852cf6ae pcbnew: Don't limit editing of the polygons
45 deg contraints are not saved per polygon, so don't limit per polygon.
The constraint is only enforced during creation.

Fixes: lp:1847722
* https://bugs.launchpad.net/kicad/+bug/1847722

Fixes: lp:1846029
* https://bugs.launchpad.net/kicad/+bug/1846029

(cherry picked from commit 8f1c1cf298)
2019-10-20 09:31:26 -07:00
Seth Hillbrand 2d1ea1618b pcbnew: prevent assert with first pt
Finding the pt-to-end intersection requires a segment, so check for
multiple points.

Fixes: lp:1846431
* https://bugs.launchpad.net/kicad/+bug/1846431

(cherry picked from commit 70c64d93e4)
2019-10-20 07:41:48 -07:00
Seth Hillbrand 50723d07a6 GAL: Use vector for stroke elements
deque structures have higher overhead than vectors.  Not usually
problematic, but with hundreds of thousands of characters each with only
a few strokes, the overhead becomes dominant.

(cherry picked from commit 6084614371)
2019-10-19 07:28:25 -07:00
Seth Hillbrand 1161562bc8 Remove Yahoo Groups link
Yahoo has discontinued its groups.

See https://help.yahoo.com/kb/groups/SLN31010.html
2019-10-17 15:59:06 -07:00
Seth Hillbrand 0c8b3aaced eeschema: Don't warp before processing right-click
The logic handling the two bug reports attached to this code is now
higher up in the chain.  As it stood, warping before right-click meant
that we cannot affect any point on the wire that is not an endpoint.
2019-10-17 13:49:49 -07:00
Seth Hillbrand b81b7decf6 eeschema: Add junction when breaking overlapping wires
This is the v5 version of 363281dd4.

Fixes: lp:1848450
* https://bugs.launchpad.net/kicad/+bug/1848450
2019-10-17 13:32:14 -07:00
Seth Hillbrand e5463330ef view: Check for viewData in IsVisible()
viewData can be NULL, make sure we verify it before dereferencing.

(cherry picked from commit 5b8661f2ab)
2019-10-15 09:46:47 -07:00
Seth Hillbrand 17c0b3e460 pcbnew: Check all layers for routing snaps
Flipped footprint pads may report their "primary" layer as not the front
layer in high contrast.  We need to check whether the board item for
snaps is visible on the active layers.

Fixes: lp:1847877
* https://bugs.launchpad.net/kicad/+bug/1847877

(cherry picked from commit 07c8596084)
2019-10-15 09:46:39 -07:00
jean-pierre charras 3bc3193805 Fix typo 2019-10-15 17:50:40 +02:00
jean-pierre charras d6db6dedca Gerber file export: avoid duplicate corner when creating polygons (regions in Gerber dialect)
Fixes: lp:1847714
https://bugs.launchpad.net/kicad/+bug/1847714
2019-10-11 21:01:40 +02:00
Seth Hillbrand d931bc72c7 pcbnew: Snap during routing needs active parent
The router items may not yet have a board item parent.  In this case,
the reference to the parent needs to be guarded before dereferencing.

Fixes: lp:1847717
* https://bugs.launchpad.net/kicad/+bug/1847717

(cherry picked from commit 0f8a1c22ad)
2019-10-11 09:16:58 -07:00
jean-pierre charras 6506f77689 Gencad export: fix an issue in hash_eda calculation,
that can generate the same hash for 2 different footprints.
Therefore, for some footprints, the right footprint was not associated to the component.
The hash calculation was using a XOR to combine 2 sub hash values.
This is not a reliable way to combine these hash values.
They are now added.
Looks better to identify similar and different footprints.

Fixes: lp:1847575
https://bugs.launchpad.net/kicad/+bug/1847575
2019-10-10 20:20:45 +02:00
Seth Hillbrand 0d64b38dbc pcbnew: Remove snapping to hidden items
Items and layers that are hidden in the view should not be used as snap
points.  This happens in multiple locations:
1) Grid Helper for normal tools
2) TOOL_BASE::snapToItem for router

Resolves KiPro Issue #116

Fixes: lp:1833128
* https://bugs.launchpad.net/kicad/+bug/1833128

(cherry picked from commit cecfeea947)
2019-10-10 09:47:34 -07:00
jean-pierre charras 7856061cf0 Fix a few wxWidget asserts related to not existing block operations from mouse drag command.
block rotate and block mirror are not implemented in HandleBlockPlace.
(only available from context menu)

Fixes: lp:1847554
https://bugs.launchpad.net/kicad/+bug/1847554
2019-10-10 10:07:15 +02:00
jean-pierre charras 0210e414d2 Fp editor, DIALOG_FOOTPRINT_FP_EDITOR: fix a very annoying issue: the value field was copuled to the fp name. Unlike schematic symbols, the value field and the footprint name are 2 different fields. So coupling these fields in the DIALOG_FOOTPRINT_FP_EDITOR dialog created serious issues.
Fixes: lp:1846533
https://bugs.launchpad.net/kicad/+bug/1846533
2019-10-09 18:58:23 +02:00
jean-pierre charras 41231e8ae2 Gerber file generation: fix incorrect aperFunction attribute for graphic items on edge cut layer.
Was NonConductor. Must be Profile.
From master branch.
2019-10-09 16:02:45 +02:00
jean-pierre charras ba2e34682e Gerbview: enhancement: show attributes for polygons (Regions in Gerber dialect) that have no DCode
This change is needed to follow current specifications in Gerber X2
2019-10-08 10:25:25 +02:00
jean-pierre charras b234ff9234 Eeschema: fix issues with pin shapes related to clock input pin shapes.
Fixes from master, commit eaea03217:
* Fix not drawn shapes for clock low, inverted clock and broken shape for falling edge clock
* Especially, shape for falling edge clock was a not existing shape, therefore useless.
* now falling edge clock and clock low shape are similar.
2019-10-08 10:11:56 +02:00
Ian McInerney 3442cc3d1a pcbnew: Don't reset router settings when breaking a track
Calling Init() in an action routine will reset the router
settings to the state they were in when first starting pcbnew.
The Init() function is automatically called when the tool is created.

Fixes: lp:1843810
* https://bugs.launchpad.net/kicad/+bug/1843810
2019-10-07 16:10:22 -04:00
Ian McInerney e618e34c94 pcbnew: Clean up extension handling in graphics plugins
* Fix wildcard display in the file selector dialog (on GTK
  it would show the regex to the user)
* Move the file extension comparison into a common function

(cherry picked from commit b33c3a5ad8)
2019-10-04 16:01:15 -04:00
Adam Wolf 105c3b0a4c Add additional ngspice codemodel path for launching from standalone eeschema on macOS.
(cherry picked from commit c7c49cee5a)
2019-10-04 14:33:23 -04:00
Ian McInerney 69d0446019 Update pleditor path for run from build directory
(cherry picked from commit 3a2dbf7786)
2019-10-04 07:58:17 -04:00
jean-pierre charras 078045f73b Gerbview: fix incorrect canvas type saving after closing Gerbview.
Was due to the fact the canvas type was now saved into m_canvasType when opening Gerbview.
2019-10-02 18:30:36 +02:00
jean-pierre charras 78af1daa2e Fix an issue in DIALOG_NETLIST: if the netlist filename does not exist, one cannot always modify the entered name.
(from master branch)
2019-09-30 19:43:25 +02:00
jean-pierre charras 0bd0d57a81 Cairo print, on GTK: use a better DPI definition to avoid artifacts rendering (GTK specific) Previously, a 600 DPI was used to set device scale (can create minor visible rounding issues). Using now 4800 DPI to reduce these rounding artifacts.
Fixes: lp:1845229
https://bugs.launchpad.net/kicad/+bug/1845229
2019-09-27 11:17:58 +02:00
jean-pierre charras 9dd5b6ce37 simulator: plot curves: fix incorrect draw area limits calculation when zooming.
Fixes: lp:1674132
https://bugs.launchpad.net/kicad/+bug/1674132
2019-09-26 16:30:28 +02:00
Seth Hillbrand d862cdaa72 pcbnew: properly close tags when handling bad poly
The parenthesis depth is 2 when the polygon isn't closed.  This
shouldn't happen but we have the fall-through to handle odd cases

Fixes: lp:1844872
* https://bugs.launchpad.net/kicad/+bug/1844872
2019-09-21 09:25:16 -07:00
Seth Hillbrand 4f57de9688 connectivity: Use pad anchor for connections
The pad should use its anchor point rather than the geometrical center
of the pad for connections.
2019-09-19 13:25:26 -07:00
Seth Hillbrand 92b6e05909 connectivity: Check all anchors for connection
With pads, we should check available anchor points for each connection,
increasing probability of finding connection to match fill algorithm

Fixes: lp:1844661
* https://bugs.launchpad.net/kicad/+bug/1844661

(cherry picked from commit b7128639f8)
2019-09-19 12:46:03 -07:00
Ian McInerney 2bd0bae2f7 Remove unneeded wxWidgets version checks in the code
Now that the minimum version is 3.0.0, we don't need to actually
check if the version is greater than 3.0.0 inside the code.

(cherry picked from commit a37d8f2859)
2019-09-18 14:27:30 -04:00
Wayne Stambaugh 69b5d24f28 Eeschema: do not save legacy symbol libraries in schematic file.
Fixes lp:1843473

https://bugs.launchpad.net/kicad/+bug/1843473
(cherry picked from commit 7cf42bb308)
2019-09-18 14:24:20 -04:00
Wayne Stambaugh e5dcb9d9da Eeschema: improve error message when writing cache library.
Remove duplicate missing symbol names from the extended error message.

Fixes lp:1842452

https://bugs.launchpad.net/kicad/+bug/1842452
(cherry picked from commit 18667377f7)
2019-09-13 15:58:37 -04:00
jean-pierre charras 4db8638f7e PANEL_SETUP_NETCLASSES: fix not working (immediately closed) wxChoice widgets to select a filter This happens with wxWidgets 3.0.4 on Windows and is a side effect of a call to Layout(). The fix just calls Layout() only when needed.
Fixes: lp:1843594
https://bugs.launchpad.net/kicad/+bug/1843594
2019-09-13 11:53:03 +02:00
Jeff Young cec885daf9 Partial cherry-pick of f1790c24e5.
Fixes: lp:1842199
* https://bugs.launchpad.net/kicad/+bug/1842199
2019-09-12 22:15:36 +01:00
Michal Jahelka 90fbf27114 c3d_render_ogl_legacy.cpp: initialize m_Emissive member of SMATERIAL to be sure it is set to 0, 0, 0 2019-09-10 17:46:35 +02:00
Jeff Young f1436cec9b Restore PointCloserThan() behaviour to really be "closer than".
Change calls which really want it to be "closer than or equal" to
distance + 1.

Fixes: lp:1843329
* https://bugs.launchpad.net/kicad/+bug/1843329

(cherry picked from commit 25fa2131d2)
2019-09-10 12:57:52 +01:00
Jeff Young cf968cb6b5 Performance enhancement. 2019-09-09 23:22:29 +01:00
Jeff Young 2278f40051 Fix zero failure in SEG::PointCloserThan().
Fixes: lp:1843329
* https://bugs.launchpad.net/kicad/+bug/1843329
2019-09-09 23:22:29 +01:00
Ian McInerney 18a76d3a87 Manually put the UNIT_BINDER text on the primary selection clipboard
The OnKillFocus handler of the UNIT_BINDER replaces the text in the
control with the evaluated string, which removes the selection. To
get the original text on the primary selection clipboard, we must
add it ourselves.

Fixes: lp:1794623
* https://bugs.launchpad.net/kicad/+bug/1794623
2019-09-09 09:02:23 -07:00
Jeff Young 6a65461ec7 Replace buggy code in TestSegmentHit() with call to SEG::PointCloserThan()
Fixes: lp:1843101
* https://bugs.launchpad.net/kicad/+bug/1843101

(cherry picked from commit 6f0d8c3eac)
2019-09-08 12:40:33 +01:00
Jeff Young a5a0a7c4f3 Fix bug with high-frequency plots.
Fixes: lp:1839712
* https://bugs.launchpad.net/kicad/+bug/1839712

(cherry picked from commit 2ac270ce8e)
2019-09-08 01:12:33 +01:00
Jeff Young f1e6f8042c Check for dup layer names in the GUI, not in the internals.
Doing so in the internals keeps users from being able to swap layer
names as the dialog does each layer name change individually.

Fixes: lp:1842665
* https://bugs.launchpad.net/kicad/+bug/1842665

(cherry picked from commit f491b7fff7)
2019-09-07 23:57:49 +01:00
Jeff Young 848873d87e Add some protection against newlines sneaking into the file.
Fixes: lp:1842943
* https://bugs.launchpad.net/kicad/+bug/1842943
2019-09-07 02:32:56 +01:00
Jeff Young 75bb864237 Workaround wxWidgets inability to find the default PDF viewer.
Fixes: lp:1843061
* https://bugs.launchpad.net/kicad/+bug/1843061

(cherry picked from commit d55f4d05b4)
2019-09-07 00:07:06 +01:00
Ian McInerney d5275b16aa eeschema: Find the closest line end to the mouse when grabbing
Fixes: lp:1842175
* https://bugs.launchpad.net/kicad/+bug/1842175
2019-09-06 14:16:56 -07:00
Seth Hillbrand 15d1b6cef0 eeschema: Handle broken spin style value
The spin style is stored as a numeric and can be corrupted.  We handle
this by triggering assertions for debugging the bad value while
resetting to default if we have non-valid spin values that are outside
the array.

Fixes: lp:1843091
* https://bugs.launchpad.net/kicad/+bug/1843091

(cherry picked from commit c3226653cc)
2019-09-06 13:18:34 -07:00
Wayne Stambaugh 6d4dd3e17a Pcbnew: fix size of graphics import warning dialog.
Use the HTML_MESSAGE_BOX window to present the warning messages rather
than wxMessageBox which would overflow the display when there were a lot
of graphic items that could not be parsed.

Fixes lp:1839565

https://bugs.launchpad.net/kicad/+bug/1839565

(cherry picked from commit 24454f5105)
2019-09-06 14:59:40 -04:00
Ian McInerney 649c22a34e wxWidgets compatibility fixes
* Remove unneeded check
* Fix WX_GRID since upstream renamed a variable in 3.1.3

(cherry picked from commit 8d86d94a4d)
2019-09-06 08:48:03 -04:00
Jeff Young 8d04d39036 Cherry-pick of https://git.launchpad.net/kicad/patch/?id=c03535343c67c17ddf0ac18621743d9cf762eb05
Fixes: lp:1842652
* https://bugs.launchpad.net/kicad/+bug/1842652
2019-09-04 20:08:39 +01:00
Jeff Young 0e90c719b0 Update description in footprint tree when it's edited.
Fixes: lp:1842660
* https://bugs.launchpad.net/kicad/+bug/1842660

(cherry picked from commit 6688e80131)
2019-09-04 17:24:17 +01:00
jean-pierre charras a79526cad8 Footprint viewers: force cairo canvas instead of legacy canvas when the legacy canvas is selected in the board editor.
Legacy canvas does not work in footprint preview panel and does not work fine in footprint viewer frame.

Fixes: lp:1842483
https://bugs.launchpad.net/kicad/+bug/1842483
2019-09-04 16:00:54 +02:00
jean-pierre charras d05d8b6100 Pcbnew: Fix incorrect canvas type saved in config, when the type is legacy canvas. 2019-09-04 11:22:55 +02:00
Jeff Young 9856867954 Correct tooltip for Footprint Filter icon on Cvpcb toolbar.
Fixes: lp:1842477
* https://bugs.launchpad.net/kicad/+bug/1842477
2019-09-03 19:46:39 +01:00
Ian McInerney 19064b680e Make the extension check for graphics import case insensitive
The regex for the file extension that matches against all case
possibilities is only built on Linux.

Fixes: lp:1842180
* https://bugs.launchpad.net/kicad/+bug/1842180
2019-09-02 10:03:39 +02:00
jean-pierre charras 95265c765b Pcbnew, DIALOG_TEXT_PROPERTIES: make lines thickness editable when editing a dimension.
From Master branch (commit 762dabd7)

Fixes: lp:1841797
https://bugs.launchpad.net/kicad/+bug/1841797
2019-09-02 10:03:39 +02:00
Jeff Young 1ed8912f57 Workaround an issue where a throw terminates (even when there's a catch for it).
You can trigger it before this fix by running Cvpcb when a .kicad_mod file is
incorrectly set as "Legacy" in your footprint table.

(cherry picked from commit e269b5d1b9)
2019-09-01 12:37:58 +01:00
Jeff Young 82a0eb4413 Use Move() instead of SetPosition() so that the second pt gets updated too.
Fixes: lp:1841989
* https://bugs.launchpad.net/kicad/+bug/1841989

(cherry picked from commit 315a99e0fe)
2019-08-30 23:32:54 +01:00
Jeff Young be7215402b Partial cherry-pick of 79d062aefc. 2019-08-30 13:47:39 +01:00
Seth Hillbrand 4500b064d8 Handle active layer overloading
Setting the active layer should be tied to the events that are triggered
by the layer change and overloaded for each frame.  This ties the hotkey
back to these events.

Note: In the 5.1 cherry-pick this also adds the missing hotkey to
footprint editor

Fixes: lp:1838244
* https://bugs.launchpad.net/kicad/+bug/1838244

(cherry picked from commit 494d0de9b8)
2019-08-28 05:57:48 -07:00
jean-pierre charras 93d191d7c9 fix compil error 2019-08-28 10:05:25 +02:00
jean-pierre charras 1607ceaf3e Eeschema, symbol tree selector: make the selected lib and symbol readable.
Previously, the background was highlighted, but not the text.
On Windows, the text was unreadable, until it was selected.

From Master, commit 34e00bdb.
2019-08-28 09:34:46 +02:00
Jeff Young 5b24ea9dd9 Clearance should be in mils, not inches.
Fixes: lp:1841360
* https://bugs.launchpad.net/kicad/+bug/1841360

(cherry picked from commit 7c85dc6cd7)
2019-08-27 21:15:54 +01:00
Jeff Young c879dcaf7d Sort pins by number when grouping by name.
Fixes: lp:1828648
* https://bugs.launchpad.net/kicad/+bug/1828648

(cherry picked from commit 97212acecb)
2019-08-27 21:15:17 +01:00
Jeff Young 86691dabbf Partial cherry-pick of 03da721030.
Fixes: lp:1841361
* https://bugs.launchpad.net/kicad/+bug/1841361
2019-08-27 18:16:25 +01:00
Seth Hillbrand fe71a66bb9 pcbnew: Force resize event when changing pad type
The local settings panel needs to have its children sized when shown.
Triggering a resize event on changing the pad shape accomplishes this.
This is not triggered in master due to refactor of the custom pad
connection options.

Fixes: lp:1837789
* https://bugs.launchpad.net/kicad/+bug/1837789
2019-08-27 05:55:04 -07:00
Seth Hillbrand 80e0d848f2 eeschema: Modify all units at the same time
When editing symbol library reference, this ensures that all units are
modified by the same action and the component is not represented by its
subunits.

Fixes: lp:1834509
* https://bugs.launchpad.net/kicad/+bug/1834509
2019-08-26 20:42:29 -07:00
Seth Hillbrand 8b3a2984bf pcbnew: Two layer boards need both masks
Adds the missing default layer to the default board setups for two
layers with parts on single side (either top or bottom)

Fixes: lp:1841294
* https://bugs.launchpad.net/kicad/+bug/1841294
2019-08-26 17:14:13 -07:00
Seth Hillbrand fccce265aa pcbnew: Retain 45° constraint
This also finishes the polygon with 45° lines when chosen as a create
option.

Fixes: lp:1833673
* https://bugs.launchpad.net/kicad/+bug/1833673
2019-08-26 14:33:30 -07:00
Seth Hillbrand a43a228f78 eagle: Set module-relative position of ref/val
We need to set the footprint local coordinates of the footprint
reference and value fields at instantiation separately from the
TEXT_DIVERS elements.

Fixes: lp:1829727
* https://bugs.launchpad.net/kicad/+bug/1829727
2019-08-26 09:56:42 -07:00
Jeff Young dd8610fd5c Don't apply GTK fix to OSX as it causes a hang.
Fixes: lp:1841379
* https://bugs.launchpad.net/kicad/+bug/1841379

(cherry picked from commit de8f97be6b)
2019-08-26 00:50:54 +01:00
Seth Hillbrand b991beb712 pcbnew: Fix error in connecitivty calculation
Point in polygon should test against half the stroke width as the stroke
is performed _on_ the polygon edge.

(cherry picked from commit 820c2d2722)
2019-08-23 10:52:11 -07:00
Seth Hillbrand 25f6483488 gerbview: Ensure selection lives on top
Just picking the next layer will be overwritten when we have multiple
objects on the same layer in gerbview.  Move the selection to the top to
ensure it is out top-most layer when drawing.

Fixes: lp:1833868
* https://bugs.launchpad.net/kicad/+bug/1833868

(cherry picked from commit 77488e379c)
2019-08-22 10:52:56 -07:00
Seth Hillbrand efc0325e14 Handle wx scrollbar thumbs in system-independent way
The thumb size changes between system versions and (on GTK) render
managers, so hard-coded wasn't working.  This gets the actual value from
the system and uses to adjust the range.  Changes in the range can also
trigger the refresh.

Fixes: lp:1822617
* https://bugs.launchpad.net/kicad/+bug/1822617

Fixes: lp:1816749
* https://bugs.launchpad.net/kicad/+bug/1816749

(cherry picked from commit 85df994eda)
2019-08-22 10:16:25 -07:00
Seth Hillbrand d19ec021fe PNS: Check that we are optimizing a pad
Vias are also sent to breakout optimizer, so we need to check for the
solid cast before dereference.

Fixes: lp:1841057
* https://bugs.launchpad.net/kicad/+bug/1841057

(cherry picked from commit 03d5bf0df5)
2019-08-22 09:03:12 -07:00
Seth Hillbrand b34a307936 pcbnew: Scale line width for import
The line width in the import dialog is meant to reflect the resulting
width and not the given width of the file.

Fixes: lp:1831496
* https://bugs.launchpad.net/kicad/+bug/1831496

(cherry picked from commit 22fdc7f51f)
2019-08-21 10:35:40 -07:00
Seth Hillbrand fb565caf7b pcbnew: Optimize pad connection revision
This modifies that logic for optimizing pad connections.

1) Custom pads now prefer the connections to their longer side.  This is
particularly important to match the behavior in a rectangular pad
2) Costs for straight lines are non-zero.  This favors fewer connections
3) Custom pad breakouts are at the polygon boundary rather than offset
by 0.1mm.  This also matches the circular and rectangular paradigm.
4) Line Heads contained in the pad itself are not optimized.  This
prevents escaping the pad unnecessarily

Fixes: lp:1824182
* https://bugs.launchpad.net/kicad/+bug/1824182

(cherry picked from commit 06cb21cc47)
2019-08-20 19:37:59 -07:00
Seth Hillbrand 6796e8fff6 EEschema: Plot stroked edges over BG
Items that have BG fill need to be plotted in the background but we
still need their stroked edges to be in the FG.  This is a workaround
that overplots the edges ensuring visual similarity.  Re-working the
plot engine to support layers is a larger project.

Fixes: lp:1833428
* https://bugs.launchpad.net/kicad/+bug/1833428
2019-08-20 12:03:19 -07:00
Seth Hillbrand 213547f545 SVG: Correct plot fills for arcs/polylines
When plotting in Eeschema, various elements may be filled with either
the foreground or background colors.  The fill mode is rather unique,
requiring un-stroked pie wedges for arcs and both closed and open filled
polylines.

Fixes: lp:1840769
* https://bugs.launchpad.net/kicad/+bug/1840769
2019-08-20 12:01:00 -07:00
Jeff Young 73851e962b Implement undo/redo for lock/unlock/toggle lock.
Fixes: lp:1840770
* https://bugs.launchpad.net/kicad/+bug/1840770

(cherry picked from commit b219fbc3d2)
2019-08-20 16:42:20 +01:00
Jeff Young de22204514 Allow mouse drag to initiate a router drag if over a track or via.
Fixes: lp:1840694
* https://bugs.launchpad.net/kicad/+bug/1840694

(cherry picked from commit 1bfefc61ea)
2019-08-19 23:32:56 +01:00
Seth Hillbrand ebba15fe67 Alphabetize Library Table returns
KiCad is case sensitive but we need to be consistent in displaying sort
order as case insensitive (same as file systems)

Fixes: lp:1836911
* https://bugs.launchpad.net/kicad/+bug/1836911
2019-08-19 15:23:29 -07:00
Jeff Young c1cd3339fa Fix assertion in new Duplicate Hotkey warning message. 2019-08-19 14:24:26 +01:00
Jeff Young 713a296a59 Update all aliases of current node after Symbol Properties dialog.
Fixes: lp:1840466
* https://bugs.launchpad.net/kicad/+bug/1840466
2019-08-19 10:55:17 +01:00
jean-pierre charras 06bde527d5 Pcbnew, layer manager: fix flicker when loading a file, and incorrect size on start when no file is loaded
From master, commit b25ffc0
2019-08-19 10:58:45 +02:00
Erik Bosman dcd31f5701 Fix a null-pointer dereference in 5.1 branch
TRACK::GetEndNetCode() can get called using a NULL-pointer as 'this'.
The compiler assumes this won't happen and optimizes away a NULL pointer
check at the start of the function (so we might as well remove this check.)

Fixes: lp:1840562
https://bugs.launchpad.net/kicad/+bug/1840562
2019-08-18 14:59:58 +02:00
Seth Hillbrand 65f2af5849 3d: Disable floor rendering by default
The floor render in raytracing creates interesting shadow effects but
significantly increasing the processing time for renders and has the
side effect of making the bottom of the board very dark if you simply
flip it over.  Making this option off by default, we allow power users
to turn it on if needed for their renders while speeding up the default
raytrace and preventing new user confusion.

(cherry picked from commit 4fcfd266e0)
2019-08-16 11:42:21 -07:00
Seth Hillbrand 2dd7a8637c pcbnew: Handle edge cuts in footprints for bbox
The Board bounding box calculation has two modes: edges only and
everything.  While the everything mode works as expected, the edges only
calculation (and everything that depends on it) was seeing only the edge
cuts on the board drawings layer and not the footprint edge cuts.

Fixes: lp:1839768
* https://bugs.launchpad.net/kicad/+bug/1839768

(cherry picked from commit 99859727e8)
2019-08-16 11:14:14 -07:00
Seth Hillbrand 211d056728 3d-viewer: Remove dead code
The 2d-bbox of the 3d viewer was calculated and set but never used

(cherry picked from commit 59ed9f086f)
2019-08-16 11:01:01 -07:00
Seth Hillbrand dc0aed5b16 Allow EDA_RECT to properly be uninitialized
The base initialization of EDA_RECT sets a 0/0/0/0 rectangle that
prevents merging properly with valid EDA_RECT.  This sets the default to
be uninitialized until the internal data are set.

(cherry picked from commit 46feb76aba)
2019-08-16 11:01:01 -07:00
Simon Schubert 5064df4ba2 kicad2step: scale models
Fixes: lp:1784257
* https://bugs.launchpad.net/kicad/+bug/1784257

(cherry picked from commit a0ed40876d)
2019-08-15 14:32:32 -07:00
Simon Schubert 469c31da97 3d: min dot needs to be square
Given that we compare the dot product (square of length) to s_min_dot,
it means that s_min_dot also needs to be square, or we wind up
converting line segments into circles that are visually distinct from
circles, leading to gaps in polylines.

(cherry picked from commit 0823692dda)
2019-08-15 14:32:32 -07:00
Simon Schubert 5fb41e6ecc 3d canvas: use radius, not width for circles
(cherry picked from commit e01348cccc)
2019-08-15 14:32:32 -07:00
Simon Schubert a68a442bbb SVG plot: output invisible text in addition to plotting
Fixes: lp:1544918
* https://bugs.launchpad.net/kicad/+bug/1544918

(cherry picked from commit 176fe80425)
2019-08-15 14:32:32 -07:00
Seth Hillbrand 84db5644d6 pcbnew: Adjust drag snapping to avoid start
When dragging, you will seldom want to snap to the original item.  This
commit prevents the "size of track" snap to the original item and
replaces it with an auxilary grid origin for the snap.  This means
effectively that the snap will happen to grid for the original item
unless the cursor is closer to the original item line than it is to the
grid crossing.

Fixes: lp:1820248
* https://bugs.launchpad.net/kicad/+bug/1820248

(cherry picked from commit 0de25e557b)
2019-08-15 12:43:19 -07:00
Seth Hillbrand fc1fb7a590 PNS: Don't allow routing on hidden layers
If the layer is not shown, we should not be allowing it's items to be
selected and chosen as the start/end items in the router.
2019-08-15 12:38:16 -07:00
Wayne Stambaugh dc91d4eca8 Symbol editor: fix mnemonic issues in pin properties dialog.
Control ordering is critical to make dialog mnemonics work correct.  The
static text with the mnemonic must immediately proceed the control and
no additional controls can be added between static text/control pair.
Fixing this required adding the units static text controls after all of
the mnemonic static text controls and their associated edit controls.
Mnemonics do not work for read only controls so all of the combobox
controls were moved after the text controls.

Fixes lp:1818930

https://bugs.launchpad.net/kicad/+bug/1818930
(cherry picked from commit 92fe201c5b)
2019-08-15 15:10:43 -04:00
Shawn Anastasio f6a42a36d6 Fix libcontext on PPC64 ELFv2
libcontext currently restores and saves the FPSCR register
on ppc64. This behavior is fine (though unnecessary) on the
ELFv1 ABI which designates the register as volatile, but has
been observed to cause crashes on ELFv2 systems.

The ELFv2 ABI designates the FPSCR register as Limited-access
and specifies specific conditions that must be met to clobber
it. It does not seem that a context swap function meets these
conditions (and indeed, the save/restore register example in the
ABI document does not modify FPSCR).

This patch fixes ELFv2 ABI compliance by removing the FPSCR
save/restore code in libcontext entirely. This fixes observed
crashes on the platform and should have no consequence for
ELFv1 support.

Fixes: lp:1840088
* https://bugs.launchpad.net/kicad/+bug/1840088

(cherry picked from commit 3e22b75948)
2019-08-14 11:18:25 -07:00
Wayne Stambaugh 2a769dc0b0 Eeschema: fix bug in sheet name comparisons on Windows.
The use of wxPATH_UNIX when calling GetFullPath() on windows drops the
volume identifier (c:\) from the file name which will cause comparison
failures.

(cherry picked from commit 0328f3e33b)
2019-08-13 16:36:01 -04:00
Jeff Young 3475bfb2aa New move tool doesn't require GetAndPlace to jump through hoops.
And at least one of those hoops leaves the cursor forced.

Fixes: lp:1839877
* https://bugs.launchpad.net/kicad/+bug/1839877

(cherry picked from commit dd938b02df)
2019-08-13 10:02:57 +01:00
jean-pierre charras f9f8fade89 Pcbnew plot: fix missing footprint texts on solder mask layers.
Fix from master branch commit 1c295d46a9
2019-08-13 09:55:11 +02:00
Jeff Young e404fb772b Invoke move by ACTION; the EDIT_TOOL does lots of other stuff too.
Fixes: lp:1839877
* https://bugs.launchpad.net/kicad/+bug/1839877

(cherry picked from commit f3f0a6899f)
2019-08-12 23:00:55 +01:00
Wayne Stambaugh 2a9412042c Eeschema: remove dead code from LIB_PART object.
(cherry picked from commit 9020a3a26c)
2019-08-12 12:55:21 -04:00
Wayne Stambaugh e8ab661504 PCB calculator: fix regulator dialog layout.
Set default dialog size to -1,-1 to allow the dialog to size itself
properly to prevent the buttons in the standard dialog button sizer
from being truncated.

Fixes lp:1839695

https://bugs.launchpad.net/kicad/+bug/1839695
(cherry picked from commit e3e546f7d2)
2019-08-12 10:02:15 -04:00
Jeff Young 3f91db25d4 Minimal cherry-pick of c836cc9cf8.
Fixes: lp:1839534
* https://bugs.launchpad.net/kicad/+bug/1839534
2019-08-10 22:27:05 +01:00
Wayne Stambaugh 300381ba4d KiCad: fix new project from template bug.
Do no rename symbol library files to the new project name.  Only rename
the cache library.  This prevents breaking symbol library links in the
schematic due to the project symbol library table pointing to the wrong
library file name.

Fixes lp:1837667

https://bugs.launchpad.net/kicad/+bug/1837667
(cherry picked from commit c7fc54b348)
2019-08-07 15:39:19 -04:00
Seth Hillbrand 4363e6a213 eeschema: Fix list invalidation
When removing a junction, we need to keep the next pointer for deleted
item, marking them with a flag until committed.

Fixes: lp:1837398
* https://bugs.launchpad.net/kicad/+bug/1837398
2019-08-05 09:03:38 -07:00
Wayne Stambaugh 450dac4b1e Revert "Revert "Eeschema: remove rogue symbol libraries from project file.""
This reverts commit 0893e0043f.
2019-08-04 13:05:47 -04:00
Wayne Stambaugh 278127fe29 Revert "Revert "Eeschema: fix edit sheet bug.""
This reverts commit 2d48c81d58.
2019-08-04 13:05:35 -04:00
Wayne Stambaugh 23d71de75f Revert "Revert "Eeschema: fix many append schematic bugs.""
This reverts commit 238fb00727.
2019-08-04 13:05:09 -04:00
Wayne Stambaugh d86789898d Begin version 5.1.5 development. 2019-08-04 12:38:05 -04:00
Wayne Stambaugh c3dc1f65d4 Tag release version 5.1.4. 2019-08-04 12:36:25 -04:00
Wayne Stambaugh 238fb00727 Revert "Eeschema: fix many append schematic bugs."
This reverts commit 3518153d5b.
2019-08-04 12:34:25 -04:00
Wayne Stambaugh 2d48c81d58 Revert "Eeschema: fix edit sheet bug."
This reverts commit 6051dfae30.
2019-08-04 12:33:55 -04:00
Wayne Stambaugh 0893e0043f Revert "Eeschema: remove rogue symbol libraries from project file."
This reverts commit 5d60fe6812.
2019-08-04 12:33:19 -04:00
Jeff Young 72c0267fe6 Ativate delete tool so it can display the selection clarification menu when needed.
Fixes: lp:1835371
* https://bugs.launchpad.net/kicad/+bug/1835371

(cherry picked from commit c60118b6a4)
2019-08-03 22:49:27 -06:00
Seth Hillbrand c9956def36 pcbnew: Fix copy-paste error from 161dc9ce7
create_vrml_shell() needed the idxSide check but create_vrml_plane only
had an extra variable that wasn't used and so shouldn't be checked.
2019-08-02 13:14:02 -07:00
Wayne Stambaugh 5d60fe6812 Eeschema: remove rogue symbol libraries from project file.
Check for symbol libraries that somehow ended up in the project file
after remapping occurred and remove all of them to prevent potentially
broken symbol library links.

Add nagware dialog to warn the user and a checkbox to never show the
dialog again.

Fixes lp:1838185

https://bugs.launchpad.net/kicad/+bug/1838185
(cherry picked from commit 8789ab9265)
2019-08-01 15:24:55 -04:00
Wayne Stambaugh 6051dfae30 Eeschema: fix edit sheet bug.
Remove an existing sheet from the current page that requires a schematic
load from file to prevent a corrupt screen list from causing a segfault.

Merge the edit sheet file loading with the append schematic code since
they are functionally the same.  This allows the sheet edit code to
take advantage of all of the added broken symbol library links added in
the recent append schematic fixes.

Fixes lp:1835841

https://bugs.launchpad.net/kicad/+bug/1835841
(cherry picked from commit b595dc0d3b)
2019-08-01 15:24:55 -04:00
Wayne Stambaugh 3518153d5b Eeschema: fix many append schematic bugs.
Do not add cache library from another project to old library list.  This
is wrong and can cause all kinds of symbol library linking issues.  It's
better to force the user to fix broken symbol library links than the false
security of using multiple cache libraries.

Use correct paths when appending schematic outside of the current project
path when hierarchical sheets are appended.  If the path can be relative,
give the user the option to use either relative or absolute paths.

Do not change symbol library names in schematics appended from a source
outside the current project.  This will almost ensure the symbol library
links will be broken in the source project.

When the appended schematic is from another project, attempt to check all
of the possible combinations of symbol library table importing that could
cause broken symbol library links and give the user the option of canceling
the append operation or live with the possibility that there may be broken
symbol library links.

When the append schematic is in the current project path but not part of
the schematic, check to see if there are any library nicknames that do
no exist in the project symbol library table and give the user a chance
to cancel the append process.

(cherry picked from commit 9fae30162d)
2019-08-01 15:24:55 -04:00
Seth Hillbrand cf949609b2 eeschema: Properly map edge cases of legacy onto GAL
While we do not generate these arcs internally, some external tools
generate arcs that are technically valid but display correctly only
because of an oddity in the degeneracy mapping.

Fixes: lp:1838557
* https://bugs.launchpad.net/kicad/+bug/1838557
2019-08-01 11:45:10 -07:00
Jeff Young d482a8805c Perform better cleanup after cancelling text placement.
Fixes: lp:1838452
* https://bugs.launchpad.net/kicad/+bug/1838452
2019-07-31 23:17:08 -06:00
Seth Hillbrand 161dc9ce7e pcbnew: Fix VRML export checking
In rare cases, the VRML triangulator may claim to work but return empty
vectors.  These cases need to be caught before we dereference the vector
elements.

Fixes: lp:1838448
* https://bugs.launchpad.net/kicad/+bug/1838448
2019-07-31 20:03:49 -07:00
jean-pierre charras 090073cc3b Pcbnew, exchange footprints: fix a bug that prevent the new footprint to be at the right place.
Fixes: lp:1838446
https://bugs.launchpad.net/kicad/+bug/1838446
2019-07-31 12:07:49 +02:00
Ian McInerney 6ae718e4d6 pcbnew: Fix DXF units in drill map plotting
Fixes: lp:1836924
* https://bugs.launchpad.net/kicad/+bug/1836924

(cherry picked from commit 6c401ecce7)
2019-07-30 17:20:38 -04:00
Thomas Pointhuber 783b1cb611 Fix handling of filled circle in eagle importer (was only partly fixed)
Partly fixed in 4fc692f04b, but missed
that there is a loadPlain where I need to handle this case as well.

(cherry picked from commit 5f438b7a85)
2019-07-30 15:33:39 -04:00
Jeff Young 4b01f80e8d Fix typo in cherry-pick.
Fixes: lp:1838006
* https://bugs.launchpad.net/kicad/+bug/1838006
2019-07-30 11:49:06 -06:00
Jeff Young c8278f377b Alternative to cherry-picking b70df18939.
Fixes: lp:1838158
* https://bugs.launchpad.net/kicad/+bug/1838158
2019-07-29 20:19:46 -06:00
jean-pierre charras d34b664933 Simulation: do not add .save V(0) and/or .save V(GND) to ngspice.
These 2 nets are internally added by ngspice (info from Holger Vogt)

(cherry picked from commit d92396341e)
2019-07-28 04:52:57 -07:00
jean-pierre charras c8f40e1d26 PANEL_SETUP_NETCLASSES_BASE: fix minor wxAlert. 2019-07-28 13:26:58 +02:00
jean-pierre charras 185a8d7582 Try to fix UI issues in select layer pair dialog and slect layer dialog.
Fixes: lp:1838173
https://bugs.launchpad.net/kicad/+bug/1838173
2019-07-28 12:55:47 +02:00
jean-pierre charras 8373e91a1b Python scripting: fix missing definition of uint32_t (and some other similar defs).
Fixes: lp:1837867
https://bugs.launchpad.net/kicad/+bug/1837867
2019-07-27 08:22:10 +02:00
Jeff Young 6aeedfb70c Partial cherry-pick of 3904d7ccfc.
Fixes: lp:1838006
* https://bugs.launchpad.net/kicad/+bug/1838006
2019-07-26 20:46:12 -06:00
Stefan Hamminga e7f3851212 Rebased LTO fix for coroutines
Fixes: lp:1793329
* https://bugs.launchpad.net/kicad/+bug/1793329

(cherry picked from commit e58d9606dd)
2019-07-25 12:17:11 -07:00
jean-pierre charras 7df05ade4c Pcbnew: Fix bug in MODULE::FindPadByName( const wxString& aPadName ). This method was using a case insensitive comparison to find the pad matching aPadName. But in netlist we are using case sensitive comparisons to attribute a net to a pad. So if in the netlist there is a pad name that does not match any footprint pad name using case sensitive comparison but if it matches some pads using case insensitive comparison, the net is not set, but the test to detect non existing pads fails. 2019-07-25 17:57:38 +02:00
Seth Hillbrand 24b032ce5b Project Templates: Allow multiple line titles
This fixes two display issues in the project template selector.  The
first captured HTML tags in the template title display and the second
prevented more than one line for showing (at least on GTK) in the
preview.  This prevented disambiguation between the various templates.
2019-07-23 15:05:25 -07:00
Seth Hillbrand b6fe4ff637 eeschema: Clean up backup name
This fixes the last suffix that was missed by 168fa09f5.  The schematic
backup files should have the suffix .sch-bak to distinguish from
.kicad_pcb-bak or other backups.
2019-07-23 10:47:15 -07:00
Wayne Stambaugh 8f1aa28b37 Begin version 5.1.4 development. 2019-07-23 08:16:06 -04:00
216 changed files with 6168 additions and 11086 deletions
-3
View File
@@ -66,7 +66,6 @@ CINFO3D_VISU::CINFO3D_VISU() :
m_boardCenter = SFVEC3F( 0.0f );
m_boardBoudingBox.Reset();
m_board2dBBox3DU.Reset();
m_layers_container2D.clear();
m_layers_holes2D.clear();
@@ -462,8 +461,6 @@ void CINFO3D_VISU::createBoardPolygon()
errmsg.append( _( "Cannot determine the board outline." ) );
wxLogMessage( errmsg );
}
Polygon_Calc_BBox_3DU( m_board_poly, m_board2dBBox3DU, m_biuTo3Dunits );
}
-3
View File
@@ -550,9 +550,6 @@ class CINFO3D_VISU
/// 3d bouding box of the pcb board in 3d units
CBBOX m_boardBoudingBox;
/// 2d bouding box of the pcb board in 3d units
CBBOX2D m_board2dBBox3DU;
/// It contains polygon contours for each layer
MAP_POLY m_layers_poly;
@@ -62,13 +62,11 @@
static int s_textWidth;
static CGENERICCONTAINER2D *s_dstcontainer = NULL;
static float s_biuTo3Dunits;
static const CBBOX2D *s_boardBBox3DU = NULL;
static const BOARD_ITEM *s_boardItem = NULL;
// This is a call back function, used by DrawGraphicText to draw the 3D text shape:
void addTextSegmToContainer( int x0, int y0, int xf, int yf, void* aData )
{
wxASSERT( s_boardBBox3DU != NULL );
wxASSERT( s_dstcontainer != NULL );
const SFVEC2F start3DU( x0 * s_biuTo3Dunits, -y0 * s_biuTo3Dunits );
@@ -76,7 +74,7 @@ void addTextSegmToContainer( int x0, int y0, int xf, int yf, void* aData )
if( Is_segment_a_circle( start3DU, end3DU ) )
s_dstcontainer->Add( new CFILLEDCIRCLE2D( start3DU,
s_textWidth * s_biuTo3Dunits,
( s_textWidth / 2 ) * s_biuTo3Dunits,
*s_boardItem) );
else
s_dstcontainer->Add( new CROUNDSEGMENT2D( start3DU,
@@ -103,7 +101,6 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aTextPCB,
s_dstcontainer = aDstContainer;
s_textWidth = aTextPCB->GetThickness() + ( 2 * aClearanceValue );
s_biuTo3Dunits = m_biuTo3Dunits;
s_boardBBox3DU = &m_board2dBBox3DU;
// not actually used, but needed by DrawGraphicText
const COLOR4D dummy_color = COLOR4D::BLACK;
@@ -228,7 +225,6 @@ void CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMod
s_boardItem = (const BOARD_ITEM *)&aModule->Value();
s_dstcontainer = aDstContainer;
s_biuTo3Dunits = m_biuTo3Dunits;
s_boardBBox3DU = &m_board2dBBox3DU;
for( unsigned ii = 0; ii < texts.size(); ++ii )
{
@@ -198,6 +198,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
0.00f, 0.30f );
m_materials.m_Copper.m_Shininess = shininessfactor * 128.0f;
m_materials.m_Copper.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
// Paste material mixed with paste color
@@ -213,6 +214,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
m_settings.m_SolderPasteColor.b );
m_materials.m_Paste.m_Shininess = 0.1f * 128.0f;
m_materials.m_Paste.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
// Silk screen material mixed with silk screen color
@@ -228,6 +230,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
m_settings.m_SilkScreenColor.b + 0.10f );
m_materials.m_SilkS.m_Shininess = 0.078125f * 128.0f;
m_materials.m_SilkS.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
// Solder mask material mixed with solder mask color
@@ -244,6 +247,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
m_materials.m_SolderMask.m_Shininess = 0.8f * 128.0f;
m_materials.m_SolderMask.m_Transparency = 0.17f;
m_materials.m_SolderMask.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
// Epoxy material
@@ -258,6 +262,7 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
20.0f / 255.0f );
m_materials.m_EpoxyBoard.m_Shininess = 0.1f * 128.0f;
m_materials.m_EpoxyBoard.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
}
else // Technical Mode
{
@@ -269,34 +274,40 @@ void C3D_RENDER_OGL_LEGACY::setupMaterials()
m_materials.m_Copper.m_Ambient = matAmbientColor;
m_materials.m_Copper.m_Specular = matSpecularColor;
m_materials.m_Copper.m_Shininess = matShininess;
m_materials.m_Copper.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
// Paste material
m_materials.m_Paste.m_Ambient = matAmbientColor;
m_materials.m_Paste.m_Specular = matSpecularColor;
m_materials.m_Paste.m_Shininess = matShininess;
m_materials.m_Paste.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
// Silk screen material
m_materials.m_SilkS.m_Ambient = matAmbientColor;
m_materials.m_SilkS.m_Specular = matSpecularColor;
m_materials.m_SilkS.m_Shininess = matShininess;
m_materials.m_SilkS.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
// Solder mask material
m_materials.m_SolderMask.m_Ambient = matAmbientColor;
m_materials.m_SolderMask.m_Specular = matSpecularColor;
m_materials.m_SolderMask.m_Shininess = matShininess;
m_materials.m_SolderMask.m_Transparency = 0.17f;
m_materials.m_SolderMask.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
// Epoxy material
m_materials.m_EpoxyBoard.m_Ambient = matAmbientColor;
m_materials.m_EpoxyBoard.m_Diffuse = m_settings.m_BoardBodyColor;
m_materials.m_EpoxyBoard.m_Specular = matSpecularColor;
m_materials.m_EpoxyBoard.m_Shininess = matShininess;
m_materials.m_EpoxyBoard.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
// Gray material (used for example in technical vias and pad holes)
m_materials.m_GrayMaterial.m_Ambient = SFVEC3F( 0.8f, 0.8f, 0.8f );
m_materials.m_GrayMaterial.m_Diffuse = SFVEC3F( 0.3f, 0.3f, 0.3f );
m_materials.m_GrayMaterial.m_Specular = SFVEC3F( 0.4f, 0.4f, 0.4f );
m_materials.m_GrayMaterial.m_Shininess = 0.01f * 128.0f;
m_materials.m_GrayMaterial.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
}
}
@@ -347,6 +358,7 @@ void C3D_RENDER_OGL_LEGACY::set_layer_material( PCB_LAYER_ID aLayerID )
m_materials.m_Plastic.m_Diffuse.b * 0.7f );
m_materials.m_Plastic.m_Shininess = 0.078125f * 128.0f;
m_materials.m_Plastic.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
OGL_SetMaterial( m_materials.m_Plastic );
break;
@@ -711,35 +711,6 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
}
void Polygon_Calc_BBox_3DU( const SHAPE_POLY_SET &aPolysList,
CBBOX2D &aOutBBox ,
float aBiuTo3DunitsScale )
{
aOutBBox.Reset();
for( int idx = 0; idx < aPolysList.OutlineCount(); ++idx )
{
// Each polygon in aPolysList is a polygon with holes
const SHAPE_POLY_SET::POLYGON& curr_polywithholes = aPolysList.CPolygon( idx );
for( unsigned ipoly = 0; ipoly < curr_polywithholes.size(); ++ipoly )
{
const SHAPE_LINE_CHAIN& path = curr_polywithholes[ipoly]; // a simple polygon
for( int jj = 0; jj < path.PointCount(); jj++ )
{
const VECTOR2I& a = path.CPoint( jj );
aOutBBox.Union( SFVEC2F( (float) a.x * aBiuTo3DunitsScale,
(float)-a.y * aBiuTo3DunitsScale ) );
}
}
}
aOutBBox.ScaleNextUp();
}
#ifdef DEBUG
static void polygon_Convert( const ClipperLib::Path &aPath,
SEGMENTS &aOutSegment,
@@ -150,10 +150,6 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
float aDivFactor,
const BOARD_ITEM &aBoardItem );
void Polygon_Calc_BBox_3DU( const SHAPE_POLY_SET &aPolysList,
CBBOX2D &aOutBBox,
float aBiuTo3DunitsScale );
void Polygon2d_TestModule();
#endif // _CPOLYGON2D_H_
@@ -85,7 +85,7 @@ public:
bool IsPointInside( const SFVEC2F &aPoint ) const override;
};
static const float s_min_dot = (FLT_EPSILON * 4.0f) ;
static const float s_min_dot = (FLT_EPSILON * 4.0f * FLT_EPSILON * 4.0f) ;
/**
* @brief Segment_is_a_circle - check if segment start and end is very close to each other
+1 -1
View File
@@ -761,7 +761,7 @@ void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
aCfg->Read( keyRenderRAY_Shadows, &tmp, true );
m_settings.SetFlag( FL_RENDER_RAYTRACING_SHADOWS, tmp );
aCfg->Read( keyRenderRAY_Backfloor, &tmp, true );
aCfg->Read( keyRenderRAY_Backfloor, &tmp, false );
m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR, tmp );
aCfg->Read( keyRenderRAY_Refractions, &tmp, true );
+1 -1
View File
@@ -35,4 +35,4 @@
# be set after each version tag is added to the git repo. This will
# give developers a reasonable idea where which branch was used to build
# KiCad.
set( KICAD_VERSION "5.1.3" )
set( KICAD_VERSION "5.1.5" )
+14 -8
View File
@@ -8,14 +8,20 @@
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
0x61, 0x00, 0x00, 0x00, 0x60, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x63, 0x90, 0x92, 0x92, 0xfa,
0x0f, 0xc2, 0x0c, 0xe4, 0x02, 0xaa, 0x19, 0x20, 0x2e, 0x2e, 0x2e, 0x46, 0x91, 0x01, 0xd2, 0xd2,
0xd2, 0x97, 0xc9, 0x32, 0x04, 0x66, 0x00, 0x14, 0x5f, 0x97, 0x97, 0x97, 0x97, 0x24, 0xd7, 0x80,
0x4b, 0x64, 0x19, 0x02, 0x33, 0x40, 0x42, 0x42, 0x42, 0x94, 0x2c, 0x43, 0x90, 0x63, 0x01, 0x14,
0x06, 0xa0, 0xb0, 0x40, 0xf3, 0x16, 0x5e, 0x4c, 0x3d, 0x03, 0xd0, 0xbd, 0x20, 0x2a, 0x2a, 0x2a,
0x41, 0x76, 0x20, 0x12, 0xad, 0x19, 0x5b, 0x34, 0x92, 0xa4, 0x99, 0xaa, 0x09, 0x89, 0xe2, 0xa4,
0x3c, 0x60, 0xb9, 0x11, 0x00, 0xd8, 0xbd, 0x63, 0x3e, 0x86, 0xe5, 0x97, 0x0f, 0x00, 0x00, 0x00,
0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
0x61, 0x00, 0x00, 0x00, 0xb9, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x63, 0x60, 0x40, 0x03, 0x52,
0x52, 0x52, 0xff, 0x41, 0x98, 0x01, 0x0b, 0x10, 0x11, 0x11, 0xe1, 0x95, 0x94, 0x94, 0xdc, 0xca,
0x80, 0x0f, 0xe0, 0x32, 0x40, 0x5a, 0x5a, 0x5a, 0x06, 0x28, 0x7e, 0x1e, 0x97, 0xe1, 0x70, 0x1b,
0xb0, 0x19, 0x20, 0x23, 0x23, 0x63, 0x06, 0x14, 0x7b, 0x81, 0xcf, 0x75, 0x20, 0xc0, 0x08, 0xb4,
0x65, 0x2d, 0xba, 0x22, 0xa0, 0x93, 0x83, 0x80, 0xfc, 0xaf, 0x30, 0x71, 0x9c, 0x06, 0x00, 0x35,
0xd7, 0xa0, 0x2b, 0x02, 0xd2, 0x65, 0x40, 0xfc, 0x17, 0x2a, 0x36, 0x0b, 0xa7, 0x01, 0x40, 0x41,
0x37, 0x20, 0xfe, 0x83, 0xa4, 0x18, 0x84, 0xa7, 0x42, 0xe9, 0x7f, 0x40, 0xdc, 0x80, 0x33, 0x7c,
0x80, 0xfe, 0x53, 0x05, 0x0a, 0xbe, 0x07, 0x49, 0x00, 0x9d, 0x5b, 0x85, 0xec, 0x0a, 0x20, 0xfe,
0x0e, 0xc4, 0x11, 0x78, 0x03, 0x18, 0x28, 0x70, 0x05, 0x24, 0x08, 0xf2, 0x3f, 0x28, 0x1c, 0xd0,
0x0c, 0x20, 0x88, 0x29, 0x37, 0x40, 0x5c, 0x5c, 0x5c, 0x11, 0xc8, 0x78, 0x03, 0x35, 0xa4, 0x9a,
0x50, 0x54, 0xe1, 0x4a, 0x3c, 0xae, 0xe8, 0x81, 0xc8, 0x40, 0x2a, 0x40, 0xb6, 0x9d, 0x2c, 0x03,
0x70, 0x25, 0x24, 0x92, 0x00, 0xae, 0xa4, 0x4c, 0x6a, 0x78, 0xd0, 0xd7, 0x00, 0x00, 0xe0, 0x1c,
0x80, 0xeb, 0x37, 0x41, 0x6c, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42,
0x60, 0x82,
};
const BITMAP_OPAQUE pinshape_clock_fall_xpm[1] = {{ png, sizeof( png ), "pinshape_clock_fall_xpm" }};
@@ -11,7 +11,7 @@
width="16"
version="1.1"
id="svg2"
inkscape:version="0.48.4 r9939"
inkscape:version="0.92.0 r15299"
sodipodi:docname="pinshape_clock_active_low.svg">
<metadata
id="metadata22">
@@ -21,8 +21,23 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:title></dc:title>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
@@ -36,15 +51,15 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="744"
inkscape:window-width="1920"
inkscape:window-height="1033"
id="namedview18"
showgrid="true"
inkscape:zoom="24.969708"
inkscape:cx="4.4578733"
inkscape:cy="9.2981956"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2">
<inkscape:grid

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

+31 -10
View File
@@ -11,8 +11,8 @@
width="16"
version="1.1"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="pinshape_clock_fall.svg">
inkscape:version="0.92.0 r15299"
sodipodi:docname="pinshape_clock_active_low.svg">
<metadata
id="metadata22">
<rdf:RDF>
@@ -21,8 +21,23 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:title></dc:title>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
@@ -36,15 +51,15 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="744"
inkscape:window-width="1920"
inkscape:window-height="1033"
id="namedview18"
showgrid="true"
inkscape:zoom="24.969708"
inkscape:cx="4.4578733"
inkscape:cy="9.2981956"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2">
<inkscape:grid
@@ -56,19 +71,25 @@
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<path
d="M 1,0 1,16"
d="M 5,0 5,16"
id="path12"
inkscape:connector-curvature="0"
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"
sodipodi:nodetypes="cc" />
<path
d="M 6,8 16,8"
d="M 5,8 16,8"
id="path14"
inkscape:connector-curvature="0"
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"
sodipodi:nodetypes="cc" />
<path
d="M 1,13 6,8 1,3"
sodipodi:nodetypes="ccc"
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"
inkscape:connector-curvature="0"
id="path4010"
d="m 5,8 7,-6 0,6" />
<path
d="M 5,13 1,8 5,3"
id="path4094"
inkscape:connector-curvature="0"
style="fill:none;stroke:#1a1a1a;stroke-width:2;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none"

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

+21 -6
View File
@@ -11,8 +11,8 @@
width="16"
version="1.1"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="pinshape_clock_normal.svg">
inkscape:version="0.92.0 r15299"
sodipodi:docname="pinshape_clock_invert.svg">
<metadata
id="metadata22">
<rdf:RDF>
@@ -22,7 +22,22 @@
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
@@ -36,15 +51,15 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="744"
inkscape:window-width="1920"
inkscape:window-height="1033"
id="namedview18"
showgrid="true"
inkscape:zoom="24.969708"
inkscape:cx="18.434809"
inkscape:cy="9.4183412"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2">
<inkscape:grid

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

+8
View File
@@ -380,6 +380,14 @@ if( BUILD_GITHUB_PLUGIN )
)
endif()
# Link-time optimization (LTO) on GCC conflicts with embedded assembly (__asm),
# following GCC's recommendation to disable LTO per translation unit.
if( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set_source_files_properties( system/libcontext.cpp PROPERTIES
COMPILE_FLAGS "-fno-lto"
)
endif()
set( COMMON_SRCS
${COMMON_SRCS}
system/libcontext.cpp
+30
View File
@@ -405,6 +405,9 @@ bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) cons
bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
{
if( !m_init )
return false;
// this logic taken from wxWidgets' geometry.cpp file:
bool rc;
EDA_RECT me(*this);
@@ -433,6 +436,9 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
{
if( !m_init )
return false;
/* Most rectangles will be axis aligned.
* It is quicker to check for this case and pass the rect
* to the simpler intersection test
@@ -565,6 +571,9 @@ const wxPoint EDA_RECT::FarthestPointTo( const wxPoint& aPoint ) const
bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) const
{
if( !m_init )
return false;
wxPoint closest = ClosestPointTo( aCenter );
double dx = aCenter.x - closest.x;
@@ -578,6 +587,9 @@ bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) con
bool EDA_RECT::IntersectsCircleEdge( const wxPoint& aCenter, const int aRadius, const int aWidth ) const
{
if( !m_init )
return false;
EDA_RECT me( *this );
me.Normalize(); // ensure size is >= 0
@@ -675,6 +687,17 @@ EDA_RECT& EDA_RECT::Inflate( wxCoord dx, wxCoord dy )
void EDA_RECT::Merge( const EDA_RECT& aRect )
{
if( !m_init )
{
if( aRect.IsValid() )
{
m_Pos = aRect.GetPosition();
m_Size = aRect.GetSize();
m_init = true;
}
return;
}
Normalize(); // ensure width and height >= 0
EDA_RECT rect = aRect;
rect.Normalize(); // ensure width and height >= 0
@@ -692,6 +715,13 @@ void EDA_RECT::Merge( const EDA_RECT& aRect )
void EDA_RECT::Merge( const wxPoint& aPoint )
{
if( !m_init )
{
m_Pos = aPoint;
m_Size = wxSize( 0, 0 );
return;
}
Normalize(); // ensure width and height >= 0
wxPoint end = GetEnd();
-5
View File
@@ -167,11 +167,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
<< HtmlHyperlink( "https://forum.kicad.info" )
<< "</li>";
description << "<li>"
<<_( "KiCad user's group - " )
<< HtmlHyperlink( "https://groups.yahoo.com/neo/groups/kicad-users/info" )
<< "</li>";
description << "</ul></p>";
aInfo.SetDescription( description );
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Aug 15 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -12,33 +12,36 @@
DIALOG_DISPLAY_HTML_TEXT_BASE::DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_htmlWindow = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
m_htmlWindow->SetMinSize( wxSize( 400,250 ) );
bMainSizer->Add( m_htmlWindow, 1, wxALL|wxEXPAND, 5 );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonClose->SetDefault();
bMainSizer->Add( m_buttonClose, 0, wxALIGN_RIGHT|wxALL, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxBOTTOM|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_htmlWindow->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnHTMLLinkClicked ), NULL, this );
m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnCloseButtonClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnOKButtonClick ), NULL, this );
}
DIALOG_DISPLAY_HTML_TEXT_BASE::~DIALOG_DISPLAY_HTML_TEXT_BASE()
{
// Disconnect Events
m_htmlWindow->Disconnect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnHTMLLinkClicked ), NULL, this );
m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnCloseButtonClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnOKButtonClick ), NULL, this );
}
+18 -145
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@@ -14,6 +14,8 @@
<property name="file">dialog_display_info_HTML_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_display_info_HTML</property>
<property name="namespace"></property>
@@ -24,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@@ -52,52 +55,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size">-1,-1</property>
<property name="name">bMainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxHtmlWindow" expanded="1">
<object class="wxHtmlWindow" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -149,120 +116,26 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHtmlCellClicked"></event>
<event name="OnHtmlCellHover"></event>
<event name="OnHtmlLinkClicked">OnHTMLLinkClicked</event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxALL</property>
<property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">OK</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">0</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonClose</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="name">m_sdbSizer1</property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCloseButtonClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<event name="OnOKButtonClick">OnOKButtonClick</event>
</object>
</object>
</object>
+13 -14
View File
@@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Aug 15 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_DISPLAY_INFO_HTML_BASE_H__
#define __DIALOG_DISPLAY_INFO_HTML_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@@ -18,8 +17,8 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@@ -31,21 +30,21 @@
class DIALOG_DISPLAY_HTML_TEXT_BASE : public DIALOG_SHIM
{
private:
protected:
wxButton* m_buttonClose;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
// Virtual event handlers, overide them in your derived class
virtual void OnHTMLLinkClicked( wxHtmlLinkEvent& event ) { event.Skip(); }
virtual void OnCloseButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
wxHtmlWindow* m_htmlWindow;
DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DISPLAY_HTML_TEXT_BASE();
};
#endif //__DIALOG_DISPLAY_INFO_HTML_BASE_H__
+2 -2
View File
@@ -148,8 +148,6 @@ void EDA_DRAW_PANEL_GAL::SetFocus()
void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
{
m_viewControls->UpdateScrollbars();
// Update current zoom settings if the canvas is managed by a EDA frame
// (i.e. not by a preview panel in a dialog)
if( GetParentEDAFrame() && GetParentEDAFrame()->GetScreen() )
@@ -160,6 +158,8 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
GetParentEDAFrame()->SetScrollCenterPosition( wxPoint( center.x, center.y ) );
}
m_viewControls->UpdateScrollbars();
if( !m_gal->IsVisible() )
return;
+3 -2
View File
@@ -259,11 +259,12 @@ long long FP_LIB_TABLE::GenerateTimestamp( const wxString* aNickname )
}
void FP_LIB_TABLE::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aNickname )
void FP_LIB_TABLE::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aNickname,
bool aBestEfforts )
{
const FP_LIB_TABLE_ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin );
row->plugin->FootprintEnumerate( aFootprintNames, row->GetFullURI( true ),
row->plugin->FootprintEnumerate( aFootprintNames, row->GetFullURI( true ), aBestEfforts,
row->GetProperties() );
}
+5 -3
View File
@@ -63,11 +63,13 @@ CAIRO_PRINT_CTX::CAIRO_PRINT_CTX( wxDC* aDC )
#ifdef __WXGTK__
m_ctx = static_cast<cairo_t*>( gctx->GetNativeContext() );
m_surface = cairo_get_target( m_ctx );
// On linux, cairo printers are 72 DPI by default. This is an ususable resolution for us.
// A reasonable resolution is 600 DPI
// On linux, cairo printers have 72 DPI by default.
// This is an unusable resolution for us.
// A better resolution could be 4800 DPI (at 600 DPI, we still have minor
// but visible artifacts, for instance with arcs, but not at 4800 DPI)
// so modify the default:
#define DEFAULT_DPI 72.0
#define KICAD_PRINTER_DPI 600.0
#define KICAD_PRINTER_DPI 4800.0
// our device scale is DEFAULT_DPI / KICAD_PRINTER_DPI
cairo_surface_set_device_scale( m_surface, DEFAULT_DPI/KICAD_PRINTER_DPI, DEFAULT_DPI/KICAD_PRINTER_DPI );
m_dpi = KICAD_PRINTER_DPI;
+9 -12
View File
@@ -60,7 +60,7 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
double glyphEndX = 0.0;
VECTOR2D glyphBoundingX;
std::deque<VECTOR2D>* pointList = nullptr;
std::vector<VECTOR2D>* pointList = nullptr;
int i = 0;
@@ -105,7 +105,7 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
if( !pointList )
{
glyph.emplace_back( std::deque<VECTOR2D>() );
glyph.emplace_back( std::vector<VECTOR2D>() );
pointList = &glyph.back();
}
@@ -140,17 +140,16 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY
{
BOX2D boundingBox;
std::deque<VECTOR2D> boundingPoints;
std::vector<VECTOR2D> boundingPoints;
boundingPoints.emplace_back( VECTOR2D( aGLYPHBoundingX.x, 0 ) );
boundingPoints.emplace_back( VECTOR2D( aGLYPHBoundingX.y, 0 ) );
for( GLYPH::const_iterator pointListIt = aGLYPH.begin(); pointListIt != aGLYPH.end(); ++pointListIt )
for( const auto& pointList : aGLYPH )
{
for( std::deque<VECTOR2D>::const_iterator pointIt = pointListIt->begin();
pointIt != pointListIt->end(); ++pointIt )
for( const auto& pt : pointList )
{
boundingPoints.emplace_back( VECTOR2D( aGLYPHBoundingX.x, pointIt->y ) );
boundingPoints.emplace_back( aGLYPHBoundingX.x, pt.y );
}
}
@@ -341,15 +340,13 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
last_had_overbar = false;
}
for( GLYPH::iterator pointListIt = glyph.begin(); pointListIt != glyph.end();
++pointListIt )
for( const auto& pointList : glyph )
{
std::deque<VECTOR2D> pointListScaled;
for( std::deque<VECTOR2D>::iterator pointIt = pointListIt->begin();
pointIt != pointListIt->end(); ++pointIt )
for( const auto& pt : pointList )
{
VECTOR2D pointPos( pointIt->x * glyphSize.x + xOffset, pointIt->y * glyphSize.y );
VECTOR2D pointPos( pt.x * glyphSize.x + xOffset, pt.y * glyphSize.y );
if( m_gal->IsFontItalic() )
{
+2 -2
View File
@@ -170,8 +170,8 @@ std::string GBR_APERTURE_METADATA::FormatAttribute( GBR_APERTURE_ATTRIB aAttribu
attribute_string = "TA.AperFunction,Conductor";
break;
case GBR_APERTURE_ATTRIB_CUTOUT: // print info associated to a outline
attribute_string = "TA.AperFunction,CutOut";
case GBR_APERTURE_ATTRIB_EDGECUT: // print info associated to a board outline (edge.cut layer)
attribute_string = "TA.AperFunction,Profile";
break;
case GBR_APERTURE_ATTRIB_VIAPAD: // print info associated to a flashed via
+3 -26
View File
@@ -32,6 +32,7 @@
#include <trigo.h>
#include <common.h>
#include <math_for_graphics.h>
#include <geometry/seg.h>
// Returns true if the point P is on the segment S.
// faster than TestSegmentHit() because P should be exactly on S
@@ -151,32 +152,8 @@ bool TestSegmentHit( const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int
if( aStart.y == aEnd.y && aRefPoint.x > xmin && aRefPoint.x < xmax )
return std::abs( delta.y ) <= aDist;
// Special case for a segment with start == end (equal to a circle)
if ( aStart == aEnd )
{
long double length_square = (long double) delta.x * delta.x + (long double) delta.y * delta.y;
long double dist_square = (long double) aDist * aDist;
return ( length_square <= dist_square );
}
wxPoint len = aEnd - aStart;
// Precision note here:
// These are 32-bit integers, so squaring requires 64 bits to represent
// exactly. 64-bit Doubles have only 52 bits in the mantissa, so we start to lose
// precision at 2^53, which corresponds to ~ ±1nm @ 9.5cm, 2nm at 90cm, etc...
// Long doubles avoid this ambiguity as well as the more expensive denormal double calc
// Long doubles usually (sometimes more if SIMD) have at least 64 bits in the mantissa
long double length_square = (long double) len.x * len.x + (long double) len.y * len.y;
long double cross = std::abs( (long double) len.x * delta.y - (long double) len.y * delta.x );
long double dist_square = (long double) aDist * aDist;
// The perpendicular distance to a line is the vector magnitude of the line from
// a test point to the test line. That is the 2d determinant. Because we handled
// the zero length case above, so we are guaranteed a unique solution.
return ( ( length_square >= cross && dist_square >= cross ) ||
( length_square * dist_square >= cross * cross ) );
SEG segment( aStart, aEnd );
return segment.PointCloserThan( aRefPoint, aDist + 1 );
}
+5 -5
View File
@@ -347,27 +347,27 @@ bool OpenPDF( const wxString& file )
wxString command;
wxString filename = file;
// Quote in case there are spaces in the file name.
AddDelimiterString( filename );
Pgm().ReadPdfBrowserInfos();
if( !Pgm().UseSystemPdfBrowser() ) // Run the preferred PDF Browser
{
command = Pgm().GetPdfBrowserName() + wxT( " " ) + filename;
command = Pgm().GetPdfBrowserName() + wxT( " '" ) + filename + wxT( "'" );
}
else
{
if( wxLaunchDefaultApplication( filename ) )
return true;
#ifdef __WXMAC__
command = wxT( "/usr/bin/open -a '" ) + filename + wxT( "'" );
#endif
// If launching the system default PDF viewer fails, fall through with empty command
// string so the error message is displayed.
}
if( !command.IsEmpty() )
{
if( ProcessExecute( command ) )
if( ProcessExecute( command ) != -1 )
{
return true;
}
+50 -50
View File
@@ -39,7 +39,7 @@ static inline size_t hash_board_item( const BOARD_ITEM* aItem, int aFlags )
size_t ret = 0;
if( aFlags & LAYER )
ret ^= hash<unsigned long long>{}( aItem->GetLayerSet().to_ullong() );
ret = hash<unsigned long long>{}( aItem->GetLayerSet().to_ullong() );
return ret;
}
@@ -55,57 +55,57 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
{
const MODULE* module = static_cast<const MODULE*>( aItem );
ret ^= hash_board_item( module, aFlags );
ret += hash_board_item( module, aFlags );
if( aFlags & POSITION )
{
ret ^= hash<int>{}( module->GetPosition().x );
ret ^= hash<int>{}( module->GetPosition().y );
ret += hash<int>{}( module->GetPosition().x );
ret += hash<int>{}( module->GetPosition().y );
}
if( aFlags & ROTATION )
ret ^= hash<double>{}( module->GetOrientation() );
ret += hash<double>{}( module->GetOrientation() );
for( const BOARD_ITEM* i = module->GraphicalItemsList(); i; i = i->Next() )
ret ^= hash_eda( i, aFlags );
ret += hash_eda( i, aFlags );
for( const D_PAD* i = module->PadsList(); i; i = i->Next() )
ret ^= hash_eda( i, aFlags );
ret += hash_eda( i, aFlags );
}
break;
case PCB_PAD_T:
{
const D_PAD* pad = static_cast<const D_PAD*>( aItem );
ret ^= hash_board_item( pad, aFlags );
ret ^= hash<int>{}( pad->GetShape() << 16 );
ret ^= hash<int>{}( pad->GetDrillShape() << 18 );
ret ^= hash<int>{}( pad->GetSize().x << 8 );
ret ^= hash<int>{}( pad->GetSize().y << 9 );
ret ^= hash<int>{}( pad->GetOffset().x << 6 );
ret ^= hash<int>{}( pad->GetOffset().y << 7 );
ret ^= hash<int>{}( pad->GetDelta().x << 4 );
ret ^= hash<int>{}( pad->GetDelta().y << 5 );
ret += hash_board_item( pad, aFlags );
ret += hash<int>{}( pad->GetShape() << 16 );
ret += hash<int>{}( pad->GetDrillShape() << 18 );
ret += hash<int>{}( pad->GetSize().x << 8 );
ret += hash<int>{}( pad->GetSize().y << 9 );
ret += hash<int>{}( pad->GetOffset().x << 6 );
ret += hash<int>{}( pad->GetOffset().y << 7 );
ret += hash<int>{}( pad->GetDelta().x << 4 );
ret += hash<int>{}( pad->GetDelta().y << 5 );
if( aFlags & POSITION )
{
if( aFlags & REL_COORD )
{
ret ^= hash<int>{}( pad->GetPos0().x );
ret ^= hash<int>{}( pad->GetPos0().y );
ret += hash<int>{}( pad->GetPos0().x );
ret += hash<int>{}( pad->GetPos0().y );
}
else
{
ret ^= hash<int>{}( pad->GetPosition().x );
ret ^= hash<int>{}( pad->GetPosition().y );
ret += hash<int>{}( pad->GetPosition().x );
ret += hash<int>{}( pad->GetPosition().y );
}
}
if( aFlags & ROTATION )
ret ^= hash<double>{}( pad->GetOrientation() );
ret += hash<double>{}( pad->GetOrientation() );
if( aFlags & NET )
ret ^= hash<int>{}( pad->GetNetCode() << 6 );
ret += hash<int>{}( pad->GetNetCode() << 6 );
}
break;
@@ -119,64 +119,64 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
if( !( aFlags & VALUE ) && text->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
break;
ret ^= hash_board_item( text, aFlags );
ret ^= hash<string>{}( text->GetText().ToStdString() );
ret ^= hash<bool>{}( text->IsItalic() );
ret ^= hash<bool>{}( text->IsBold() );
ret ^= hash<bool>{}( text->IsMirrored() );
ret ^= hash<int>{}( text->GetTextWidth() );
ret ^= hash<int>{}( text->GetTextHeight() );
ret ^= hash<int>{}( text->GetHorizJustify() );
ret ^= hash<int>{}( text->GetVertJustify() );
ret += hash_board_item( text, aFlags );
ret += hash<string>{}( text->GetText().ToStdString() );
ret += hash<bool>{}( text->IsItalic() );
ret += hash<bool>{}( text->IsBold() );
ret += hash<bool>{}( text->IsMirrored() );
ret += hash<int>{}( text->GetTextWidth() );
ret += hash<int>{}( text->GetTextHeight() );
ret += hash<int>{}( text->GetHorizJustify() );
ret += hash<int>{}( text->GetVertJustify() );
if( aFlags & POSITION )
{
if( aFlags & REL_COORD )
{
ret ^= hash<int>{}( text->GetPos0().x );
ret ^= hash<int>{}( text->GetPos0().y );
ret += hash<int>{}( text->GetPos0().x );
ret += hash<int>{}( text->GetPos0().y );
}
else
{
ret ^= hash<int>{}( text->GetPosition().x );
ret ^= hash<int>{}( text->GetPosition().y );
ret += hash<int>{}( text->GetPosition().x );
ret += hash<int>{}( text->GetPosition().y );
}
}
if( aFlags & ROTATION )
ret ^= hash<double>{}( text->GetTextAngle() );
ret += hash<double>{}( text->GetTextAngle() );
}
break;
case PCB_MODULE_EDGE_T:
{
const EDGE_MODULE* segment = static_cast<const EDGE_MODULE*>( aItem );
ret ^= hash_board_item( segment, aFlags );
ret ^= hash<int>{}( segment->GetType() );
ret ^= hash<int>{}( segment->GetShape() );
ret ^= hash<int>{}( segment->GetWidth() );
ret ^= hash<int>{}( segment->GetRadius() );
ret += hash_board_item( segment, aFlags );
ret += hash<int>{}( segment->GetType() );
ret += hash<int>{}( segment->GetShape() );
ret += hash<int>{}( segment->GetWidth() );
ret += hash<int>{}( segment->GetRadius() );
if( aFlags & POSITION )
{
if( aFlags & REL_COORD )
{
ret ^= hash<int>{}( segment->GetStart0().x );
ret ^= hash<int>{}( segment->GetStart0().y );
ret ^= hash<int>{}( segment->GetEnd0().x );
ret ^= hash<int>{}( segment->GetEnd0().y );
ret += hash<int>{}( segment->GetStart0().x );
ret += hash<int>{}( segment->GetStart0().y );
ret += hash<int>{}( segment->GetEnd0().x );
ret += hash<int>{}( segment->GetEnd0().y );
}
else
{
ret ^= hash<int>{}( segment->GetStart().x );
ret ^= hash<int>{}( segment->GetStart().y );
ret ^= hash<int>{}( segment->GetEnd().x );
ret ^= hash<int>{}( segment->GetEnd().y );
ret += hash<int>{}( segment->GetStart().x );
ret += hash<int>{}( segment->GetStart().y );
ret += hash<int>{}( segment->GetEnd().x );
ret += hash<int>{}( segment->GetEnd().y );
}
}
if( aFlags & ROTATION )
ret ^= hash<double>{}( segment->GetAngle() );
ret += hash<double>{}( segment->GetAngle() );
}
break;
+13 -7
View File
@@ -28,16 +28,20 @@
#include <common.h>
HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString& aTitle) :
DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, aTitle )
HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* aParent, const wxString& aTitle,
const wxPoint& aPosition, const wxSize& aSize ) :
DIALOG_DISPLAY_HTML_TEXT_BASE( aParent, wxID_ANY, aTitle, aPosition, aSize )
{
m_htmlWindow->SetLayoutDirection( wxLayout_LeftToRight );
ListClear();
// Gives a default logical size (the actual size depends on the display definition)
SetSizeInDU( 320, 120 );
if( aSize != wxDefaultSize )
SetSizeInDU( aSize.x, aSize.y );
Center();
m_sdbSizer1OK->SetDefault();
}
@@ -49,12 +53,14 @@ HTML_MESSAGE_BOX::~HTML_MESSAGE_BOX()
}
void HTML_MESSAGE_BOX::OnCloseButtonClick( wxCommandEvent& event )
void HTML_MESSAGE_BOX::OnOKButtonClick( wxCommandEvent& event )
{
// the dialog can be shown modal or not modal.
// the dialog can be shown quasi-model, modal, or not modeless.
// therefore, use the right way to close it.
if( IsModal() )
EndModal( 0 );
if( IsQuasiModal() )
EndQuasiModal( wxID_OK );
else if( IsModal() )
EndModal( wxID_OK );
else
Destroy();
}
+27
View File
@@ -94,6 +94,7 @@ void KIWAY::SetTop( wxFrame* aTop )
const wxString KIWAY::dso_search_path( FACE_T aFaceId )
{
const char* name;
const char* dirName;
switch( aFaceId )
{
@@ -110,6 +111,13 @@ const wxString KIWAY::dso_search_path( FACE_T aFaceId )
return wxEmptyString;
}
// The subdirectories usually have the same name as the kiface
switch( aFaceId )
{
case FACE_PL_EDITOR: dirName = "pagelayout_editor"; break;
default: dirName = name + 1; break;
}
#ifndef __WXMAC__
wxString path;
@@ -131,6 +139,25 @@ const wxString KIWAY::dso_search_path( FACE_T aFaceId )
fn.SetName( name );
#ifdef DEBUG
// To speed up development, it's sometimes nice to run kicad from inside
// the build path. In that case, each program will be in a subdirectory.
// To find the DSOs, we need to go up one directory and then enter a subdirectory.
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
{
#ifdef __WXMAC__
fn = wxStandardPaths::Get().GetExecutablePath();
fn.RemoveLastDir();
fn.AppendDir( wxT( "PlugIns" ) );
fn.SetName( name );
#else
fn.RemoveLastDir();
fn.AppendDir( dirName );
#endif
}
#endif
// Here a "suffix" == an extension with a preceding '.',
// so skip the preceding '.' to get an extension
fn.SetExt( KIFACE_SUFFIX + 1 ); // + 1 => &KIFACE_SUFFIX[1]
+1 -1
View File
@@ -613,7 +613,7 @@ void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
{
SetStatusText( msg, 5 );
SetStatusText( msg, 6 );
}
+1 -1
View File
@@ -621,7 +621,7 @@ void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
{
SetStatusText( msg, 5 );
SetStatusText( msg, 6 );
}
+6
View File
@@ -398,6 +398,12 @@ std::vector<wxString> LIB_TABLE::GetLogicalLibs()
ret.push_back( *it );
}
// We want to allow case-sensitive duplicates but sort by case-insensitive ordering
std::sort( ret.begin(), ret.end(), []( const wxString& lhs, const wxString& rhs )
{
return lhs.CmpNoCase( rhs ) < 0;
} );
return ret;
}
+71 -112
View File
@@ -498,7 +498,45 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAn
}
void GERBER_PLOTTER:: PlotPoly( const std::vector< wxPoint >& aCornerList,
void GERBER_PLOTTER::PlotGerberRegion( const std::vector< wxPoint >& aCornerList,
void * aData )
{
if( aCornerList.size() <= 2 )
return;
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
if( gbr_metadata )
{
std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
if( !attrib.empty() )
{
fputs( attrib.c_str(), outputFile );
clearTA_AperFunction = true;
}
}
PlotPoly( aCornerList, FILLED_SHAPE, 0 , gbr_metadata );
// Clear the TA attribute, to avoid the next item to inherit it:
if( clearTA_AperFunction )
{
if( m_useX2format )
{
fputs( "%TD.AperFunction*%\n", outputFile );
}
else
{
fputs( "G04 #@! TD.AperFunction*\n", outputFile );
}
}
}
void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth, void * aData )
{
if( aCornerList.size() <= 1 )
@@ -524,7 +562,10 @@ void GERBER_PLOTTER:: PlotPoly( const std::vector< wxPoint >& aCornerList,
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
LineTo( aCornerList[ii] );
FinishTo( aCornerList[0] );
// If the polygon is not closed, close it:
if( aCornerList[0] != aCornerList[aCornerList.size()-1] )
FinishTo( aCornerList[0] );
fputs( "G37*\n", outputFile );
}
@@ -676,7 +717,7 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
wxSize size( aSize );
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
/* Plot a flashed shape. */
// Flash a vertical or horizontal shape (this is a basic aperture).
if( ( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 )
&& trace_mode == FILLED )
{
@@ -692,7 +733,8 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
emitDcode( pos_dev, 3 );
}
else /* Plot pad as a segment. */
else // Plot pad as region.
// Only regions and flashed items accept a object attribute TO.P for the pin name
{
if( size.x > size.y )
{
@@ -707,43 +749,20 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
if( trace_mode == FILLED )
{
// TODO: use an aperture macro to declare the rotated pad
// Flash a pad anchor, if a netlist attribute is set
if( aData )
FlashPadCircle( pos, size.x, trace_mode, aData );
// to be able to flash the shape
// For now, the pad is drawn as segment
// The pad is reduced to an segment with dy > dx
int delta = size.y - size.x;
int x0 = 0;
int y0 = -delta / 2;
int x1 = 0;
int y1 = delta / 2;
RotatePoint( &x0, &y0, orient );
RotatePoint( &x1, &y1, orient );
GBR_METADATA metadata;
wxPoint p0( 0, -delta / 2 );
wxPoint p1( 0, delta / 2 );
RotatePoint( &p0.x, &p0.y, orient );
RotatePoint( &p1.x, &p1.y, orient );
if( gbr_metadata )
{
metadata = *gbr_metadata;
// If the pad is drawn on a copper layer,
// set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
if( metadata.IsCopper() )
metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR );
// Clear .P attribute, only allowed for flashed items
wxString attrname( ".P" );
metadata.m_NetlistMetadata.ClearAttribute( &attrname );
}
ThickSegment( wxPoint( pos.x + x0, pos.y + y0 ),
wxPoint( pos.x + x1, pos.y + y1 ),
size.x, trace_mode, &metadata );
ThickSegment( pos + p0, pos + p1, size.x, trace_mode, gbr_metadata );
}
else
{
sketchOval( pos, size, orient, -1 );
}
}
}
@@ -821,22 +840,7 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
EDA_DRAW_MODE_T aTraceMode, void* aData )
{
GBR_METADATA gbr_metadata;
if( aData )
{
gbr_metadata = *static_cast<GBR_METADATA*>( aData );
// If the pad is drawn on a copper layer,
// set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
if( gbr_metadata.IsCopper() )
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR );
wxString attrname( ".P" );
gbr_metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
}
if( aTraceMode != FILLED )
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &gbr_metadata );
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
// Currently, a Pad RoundRect is plotted as polygon.
// TODO: use Aperture macro and flash it
@@ -846,7 +850,10 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
aCornerRadius, segmentToCircleCount );
if( aTraceMode != FILLED )
{
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &gbr_metadata );
outline.Inflate( -GetCurrentLineWidth()/2, 16 );
}
std::vector< wxPoint > cornerList;
// TransformRoundRectToPolygon creates only one convex polygon
@@ -859,45 +866,24 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
// Close polygon
cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL,
aTraceMode == FILLED ? 0 : GetCurrentLineWidth(), &gbr_metadata );
// Now, flash a pad anchor, if a netlist attribute is set
// (remove me when a Aperture macro will be used)
if( aData && aTraceMode == FILLED )
{
int diameter = std::min( aSize.x, aSize.y );
FlashPadCircle( aPadPos, diameter, aTraceMode , aData );
}
if( aTraceMode == SKETCH )
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), gbr_metadata );
else
PlotGerberRegion( cornerList, gbr_metadata );
}
void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
SHAPE_POLY_SET* aPolygons,
EDA_DRAW_MODE_T aTraceMode, void* aData )
{
// A Pad custom is plotted as polygon.
// A flashed circle @aPadPos is added (anchor pad)
// However, because the anchor pad can be circle or rect, we use only
// a circle not bigger than the rect.
// the main purpose is to print a flashed DCode as pad anchor
if( aTraceMode == FILLED )
FlashPadCircle( aPadPos, std::min( aSize.x, aSize.y ), aTraceMode, aData );
// A Pad custom is plotted as Gerber region.
GBR_METADATA gbr_metadata;
if( aData )
{
gbr_metadata = *static_cast<GBR_METADATA*>( aData );
// If the pad is drawn on a copper layer,
// set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
if( gbr_metadata.IsCopper() )
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR );
wxString attrname( ".P" );
gbr_metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
}
SHAPE_POLY_SET polyshape = *aPolygons;
@@ -921,9 +907,10 @@ void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
// Close polygon
cornerList.push_back( cornerList[0] );
PlotPoly( cornerList,
aTraceMode == FILLED ? FILLED_SHAPE : NO_FILL,
aTraceMode == FILLED ? 0 : GetCurrentLineWidth(), &gbr_metadata );
if( aTraceMode == SKETCH )
PlotPoly( cornerList, NO_FILL, GetCurrentLineWidth(), &gbr_metadata );
else
PlotGerberRegion( cornerList, &gbr_metadata );
}
}
@@ -941,25 +928,6 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
for( int ii = 0; ii < 4; ii++ )
cornerList.push_back( aCorners[ii] );
// Now, flash a pad anchor, if a netlist attribute is set
// (remove me when a Aperture macro will be used)
if( aData && ( aTrace_Mode == FILLED ) )
{
// Calculate the radius of the circle inside the shape
// It is the smaller dist from shape pos to edges
int radius = INT_MAX;
for( unsigned ii = 0, jj = cornerList.size()-1; ii < cornerList.size();
jj = ii, ii++ )
{
SEG segment( aCorners[ii], aCorners[jj] );
int dist = segment.LineDistance( VECTOR2I( 0, 0) );
radius = std::min( radius, dist );
}
FlashPadCircle( aPadPos, radius*2, aTrace_Mode, aData );
}
// Draw the polygon and fill the interior as required
for( unsigned ii = 0; ii < 4; ii++ )
{
@@ -974,21 +942,12 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
GBR_METADATA metadata;
if( gbr_metadata )
{
metadata = *gbr_metadata;
// If the pad is drawn on a copper layer,
// set attribute to GBR_APERTURE_ATTRIB_CONDUCTOR
if( metadata.IsCopper() )
metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR );
wxString attrname( ".P" );
metadata.m_NetlistMetadata.ClearAttribute( &attrname ); // not allowed on inner layers
}
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, &metadata );
PlotPoly( cornerList, aTrace_Mode == FILLED ? FILLED_SHAPE : NO_FILL,
aTrace_Mode == FILLED ? 0 : GetCurrentLineWidth(),
&metadata );
if( aTrace_Mode == SKETCH )
PlotPoly( cornerList, NO_FILL, USE_DEFAULT_LINE_WIDTH, &metadata );
else
PlotGerberRegion( cornerList, &metadata );
}
+89 -8
View File
@@ -424,9 +424,6 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
if( StAngle > EndAngle )
std::swap( StAngle, EndAngle );
setFillMode( fill );
SetCurrentLineWidth( width );
// Calculate start point.
DPOINT centre_dev = userToDeviceCoordinates( centre );
double radius_dev = userToDeviceSize( radius );
@@ -487,6 +484,21 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
// flag arc size (0 = small arc > 180 deg, 1 = large arc > 180 deg),
// sweep arc ( 0 = CCW, 1 = CW),
// end point
if( fill != NO_FILL )
{
// Filled arcs (in eeschema) consist of the pie wedge and a stroke only on the arc
// This needs to be drawn in two steps.
setFillMode( fill );
SetCurrentLineWidth( 0 );
fprintf( outputFile, "<path d=\"M%g %g A%g %g 0.0 %d %d %g %g L %g %g Z\" />\n",
start.x, start.y, radius_dev, radius_dev,
flg_arc, flg_sweep,
end.x, end.y, centre_dev.x, centre_dev.y );
}
setFillMode( NO_FILL );
SetCurrentLineWidth( width );
fprintf( outputFile, "<path d=\"M%g %g A%g %g 0.0 %d %d %g %g \" />\n",
start.x, start.y, radius_dev, radius_dev,
flg_arc, flg_sweep,
@@ -517,15 +529,22 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
}
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
fprintf( outputFile, "d=\"M %d,%d\n", (int) pos.x, (int) pos.y );
fprintf( outputFile, "d=\"M %g,%g\n", pos.x, pos.y );
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
for( unsigned ii = 1; ii < aCornerList.size() - 1; ii++ )
{
pos = userToDeviceCoordinates( aCornerList[ii] );
fprintf( outputFile, "%d,%d\n", (int) pos.x, (int) pos.y );
fprintf( outputFile, "%g,%g\n", pos.x, pos.y );
}
fprintf( outputFile, "Z\" /> \n" );
// If the cornerlist ends where it begins, then close the poly
if( aCornerList.front() == aCornerList.back() )
fprintf( outputFile, "Z\" /> \n" );
else
{
pos = userToDeviceCoordinates( aCornerList.back() );
fprintf( outputFile, "%g,%g\n\" /> \n", pos.x, pos.y );
}
}
@@ -674,7 +693,69 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
SetColor( aColor );
SetCurrentLineWidth( aWidth );
// TODO: see if the postscript native text code can be used in SVG plotter
int width = currentPenWidth;
if( aWidth <= 0 && aBold )
width = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
if( aWidth <= 0 )
width = currentPenWidth;
wxPoint text_pos = aPos;
const char *hjust = "start";
switch( aH_justify )
{
case GR_TEXT_HJUSTIFY_CENTER:
hjust = "middle";
break;
case GR_TEXT_HJUSTIFY_RIGHT:
hjust = "end";
break;
case GR_TEXT_HJUSTIFY_LEFT:
hjust = "start";
break;
}
switch( aV_justify )
{
case GR_TEXT_VJUSTIFY_CENTER:
text_pos.y += aSize.y / 2;
break;
case GR_TEXT_VJUSTIFY_TOP:
text_pos.y += aSize.y;
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
break;
}
wxSize text_size;
text_size.x = GraphicTextWidth( aText, aSize, aItalic, width );
text_size.y = aSize.x * 4/3; // Hershey font height to em size conversion
DPOINT anchor_pos_dev = userToDeviceCoordinates( aPos );
DPOINT text_pos_dev = userToDeviceCoordinates( text_pos );
DPOINT sz_dev = userToDeviceSize( text_size );
if( aOrient != 0 ) {
fprintf( outputFile,
"<g transform=\"rotate(%g %g %g)\">\n",
- aOrient * 0.1, anchor_pos_dev.x, anchor_pos_dev.y );
}
fprintf( outputFile,
"<text x=\"%g\" y=\"%g\"\n"
"textLength=\"%g\" font-size=\"%g\" lengthAdjust=\"spacingAndGlyphs\"\n"
"text-anchor=\"%s\" opacity=\"0\">%s</text>\n",
text_pos_dev.x, text_pos_dev.y,
sz_dev.x, sz_dev.y,
hjust, TO_UTF8( XmlEsc( aText ) ) );
if( aOrient != 0 )
fputs( "</g>\n", outputFile );
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold, aMultilineAllowed );
+25 -2
View File
@@ -38,6 +38,7 @@
*/
#include <fctsys.h>
#include <vector>
#include <trigo.h>
#include <eda_base_frame.h>
@@ -164,7 +165,17 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r
/* Please NOTE the different sign due to Y-axis flip */
start.x = centre.x + KiROUND( cosdecideg( radius, -StAngle ) );
start.y = centre.y + KiROUND( sindecideg( radius, -StAngle ) );
MoveTo( start );
if( fill != NO_FILL )
{
MoveTo( centre );
LineTo( start );
}
else
{
MoveTo( start );
}
for( int ii = StAngle + delta; ii < EndAngle; ii += delta )
{
end.x = centre.x + KiROUND( cosdecideg( radius, -ii ) );
@@ -174,7 +185,16 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r
end.x = centre.x + KiROUND( cosdecideg( radius, -EndAngle ) );
end.y = centre.y + KiROUND( sindecideg( radius, -EndAngle ) );
FinishTo( end );
if( fill != NO_FILL )
{
LineTo( end );
FinishTo( centre );
}
else
{
FinishTo( end );
}
}
@@ -530,6 +550,9 @@ void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
for( int ii = 0; ii < aCornerList.PointCount(); ii++ )
cornerList.push_back( wxPoint( aCornerList.CPoint( ii ) ) );
if( aCornerList.IsClosed() && cornerList.front() != cornerList.back() )
cornerList.push_back( wxPoint( aCornerList.CPoint( 0 ) ) );
PlotPoly( cornerList , aFill, aWidth, aData );
}
+51 -8
View File
@@ -20,6 +20,7 @@
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <limits>
#include <preview_items/polygon_geom_manager.h>
@@ -67,6 +68,7 @@ bool POLYGON_GEOM_MANAGER::AddPoint( const VECTOR2I& aPt )
void POLYGON_GEOM_MANAGER::SetFinished()
{
m_client.OnComplete( *this );
}
@@ -95,9 +97,9 @@ bool POLYGON_GEOM_MANAGER::IsSelfIntersecting( bool aIncludeLeaderPts ) const
}
void POLYGON_GEOM_MANAGER::SetCursorPosition( const VECTOR2I& aPos, LEADER_MODE aModifier )
void POLYGON_GEOM_MANAGER::SetCursorPosition( const VECTOR2I& aPos )
{
updateLeaderPoints( aPos, aModifier );
updateLeaderPoints( aPos );
}
@@ -143,17 +145,58 @@ void POLYGON_GEOM_MANAGER::Reset()
void POLYGON_GEOM_MANAGER::updateLeaderPoints( const VECTOR2I& aEndPoint, LEADER_MODE aModifier )
{
wxCHECK( m_lockedPoints.PointCount() > 0, /*void*/ );
const VECTOR2I& lastPt = m_lockedPoints.CLastPoint();
auto newEnd = VECTOR2I( aEndPoint );
const VECTOR2I& last_pt = m_lockedPoints.CLastPoint();
if( m_leaderMode == LEADER_MODE::DEG45 || aModifier == LEADER_MODE::DEG45 )
{
const VECTOR2I lineVector( aEndPoint - lastPt );
const VECTOR2I line_vec( aEndPoint - last_pt );
// get a restricted 45/H/V line from the last fixed point to the cursor
newEnd = lastPt + GetVectorSnapped45( lineVector );
auto new_end = last_pt + GetVectorSnapped45( line_vec );
OPT_VECTOR2I pt;
if( m_lockedPoints.SegmentCount() > 1 )
{
const VECTOR2I& start_pt = m_lockedPoints.CPoint( 0 );
VECTOR2I completed_vec( start_pt - new_end );
if( completed_vec != GetVectorSnapped45( completed_vec ) )
{
SEG v_first( new_end, VECTOR2I( new_end.x, start_pt.y ) );
SEG h_first( new_end, VECTOR2I( start_pt.x, new_end.y ) );
SHAPE_LINE_CHAIN::INTERSECTIONS intersections;
auto v_hits = m_lockedPoints.Intersect( v_first, intersections );
v_hits += m_lockedPoints.Intersect( SEG( v_first.B, start_pt ), intersections );
pt = v_first.B;
if( v_hits > 0 )
{
intersections.clear();
auto h_hits = m_lockedPoints.Intersect( h_first, intersections );
h_hits += m_lockedPoints.Intersect( SEG( h_first.B, start_pt ), intersections );
if( h_hits < v_hits )
pt = h_first.B;
}
}
}
m_leaderPts = SHAPE_LINE_CHAIN( last_pt, new_end );
if( pt )
{
// This checks for backtracking from the point to intersection
if( SEG( last_pt, new_end ).Collinear( SEG( new_end, *pt ) ) )
m_leaderPts = SHAPE_LINE_CHAIN( last_pt, *pt );
else
m_leaderPts.Append( *pt );
}
}
else
{
// direct segment
m_leaderPts = SHAPE_LINE_CHAIN( last_pt, aEndPoint );
}
// direct segment
m_leaderPts = SHAPE_LINE_CHAIN( lastPt, newEnd );
m_client.OnGeometryChange( *this );
}
+4 -1
View File
@@ -31,6 +31,7 @@
using namespace KIGFX::PREVIEW;
const double POLYGON_ITEM::POLY_LINE_WIDTH = 150000.0;
POLYGON_ITEM::POLYGON_ITEM():
SIMPLE_OVERLAY_ITEM()
@@ -60,12 +61,14 @@ void POLYGON_ITEM::drawPreviewShape( KIGFX::VIEW* aView ) const
auto& gal = *aView->GetGAL();
auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() );
gal.SetLineWidth( POLY_LINE_WIDTH );
gal.DrawPolyline( m_lockedChain );
gal.DrawPolygon( m_polyfill );
// draw the leader line in a different color
gal.SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ) );
gal.DrawPolyline( m_leaderChain );
gal.DrawPolygon( m_polyfill );
}
+5 -1
View File
@@ -209,8 +209,12 @@ int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize )
}
std::string EscapedUTF8( const wxString& aString )
std::string EscapedUTF8( wxString aString )
{
// No new-lines allowed in quoted strings
aString.Replace( "\r\n", "\r" );
aString.Replace( "\n", "\r" );
std::string utf8 = TO_UTF8( aString );
std::string ret;
+1
View File
@@ -34,6 +34,7 @@
%include <std_map.i>
%include <std_shared_ptr.i>
%include <std_set.i>
%include <stdint.i>
%include "ki_exception.i" // affects all that follow it
+51 -55
View File
@@ -1040,36 +1040,36 @@ __asm (
# endif
#endif
" # reserve space on stack\n"
" subi %r1, %r1, 328\n"
" subi %r1, %r1, 320\n"
#if _CALL_ELF != 2
" std %r2, 152(%r1) # save TOC\n"
" std %r2, 144(%r1) # save TOC\n"
#endif
" std %r14, 160(%r1) # save R14\n"
" std %r15, 168(%r1) # save R15\n"
" std %r16, 176(%r1) # save R16\n"
" std %r17, 184(%r1) # save R17\n"
" std %r18, 192(%r1) # save R18\n"
" std %r19, 200(%r1) # save R19\n"
" std %r20, 208(%r1) # save R20\n"
" std %r21, 216(%r1) # save R21\n"
" std %r22, 224(%r1) # save R22\n"
" std %r23, 232(%r1) # save R23\n"
" std %r24, 240(%r1) # save R24\n"
" std %r25, 248(%r1) # save R25\n"
" std %r26, 256(%r1) # save R26\n"
" std %r27, 264(%r1) # save R27\n"
" std %r28, 272(%r1) # save R28\n"
" std %r29, 280(%r1) # save R29\n"
" std %r30, 288(%r1) # save R30\n"
" std %r31, 296(%r1) # save R31\n"
" std %r14, 152(%r1) # save R14\n"
" std %r15, 160(%r1) # save R15\n"
" std %r16, 168(%r1) # save R16\n"
" std %r17, 176(%r1) # save R17\n"
" std %r18, 184(%r1) # save R18\n"
" std %r19, 192(%r1) # save R19\n"
" std %r20, 200(%r1) # save R20\n"
" std %r21, 208(%r1) # save R21\n"
" std %r22, 216(%r1) # save R22\n"
" std %r23, 224(%r1) # save R23\n"
" std %r24, 232(%r1) # save R24\n"
" std %r25, 240(%r1) # save R25\n"
" std %r26, 248(%r1) # save R26\n"
" std %r27, 256(%r1) # save R27\n"
" std %r28, 264(%r1) # save R28\n"
" std %r29, 272(%r1) # save R29\n"
" std %r30, 280(%r1) # save R30\n"
" std %r31, 288(%r1) # save R31\n"
" # save CR\n"
" mfcr %r0\n"
" std %r0, 304(%r1)\n"
" std %r0, 296(%r1)\n"
" # save LR\n"
" mflr %r0\n"
" std %r0, 312(%r1)\n"
" std %r0, 304(%r1)\n"
" # save LR as PC\n"
" std %r0, 320(%r1)\n"
" std %r0, 312(%r1)\n"
" # test if fpu env should be preserved\n"
" cmpwi cr7, %r6, 0\n"
" beq cr7, 1f\n"
@@ -1091,8 +1091,6 @@ __asm (
" stfd %f29, 120(%r1) # save F29\n"
" stfd %f30, 128(%r1) # save F30\n"
" stfd %f31, 136(%r1) # save F31\n"
" mffs %f0 # load FPSCR\n"
" stfd %f0, 144(%r1) # save FPSCR\n"
"1:\n"
" # store RSP (pointing to context-data) in R3\n"
" std %r1, 0(%r3)\n"
@@ -1119,42 +1117,40 @@ __asm (
" lfd %f29, 120(%r1) # restore F29\n"
" lfd %f30, 128(%r1) # restore F30\n"
" lfd %f31, 136(%r1) # restore F31\n"
" lfd %f0, 144(%r1) # load FPSCR\n"
" mtfsf 0xff, %f0 # restore FPSCR\n"
"2:\n"
#if _CALL_ELF != 2
" ld %r2, 152(%r1) # restore TOC\n"
" ld %r2, 144(%r1) # restore TOC\n"
#endif
" ld %r14, 160(%r1) # restore R14\n"
" ld %r15, 168(%r1) # restore R15\n"
" ld %r16, 176(%r1) # restore R16\n"
" ld %r17, 184(%r1) # restore R17\n"
" ld %r18, 192(%r1) # restore R18\n"
" ld %r19, 200(%r1) # restore R19\n"
" ld %r20, 208(%r1) # restore R20\n"
" ld %r21, 216(%r1) # restore R21\n"
" ld %r22, 224(%r1) # restore R22\n"
" ld %r23, 232(%r1) # restore R23\n"
" ld %r24, 240(%r1) # restore R24\n"
" ld %r25, 248(%r1) # restore R25\n"
" ld %r26, 256(%r1) # restore R26\n"
" ld %r27, 264(%r1) # restore R27\n"
" ld %r28, 272(%r1) # restore R28\n"
" ld %r29, 280(%r1) # restore R29\n"
" ld %r30, 288(%r1) # restore R30\n"
" ld %r31, 296(%r1) # restore R31\n"
" ld %r14, 152(%r1) # restore R14\n"
" ld %r15, 160(%r1) # restore R15\n"
" ld %r16, 168(%r1) # restore R16\n"
" ld %r17, 176(%r1) # restore R17\n"
" ld %r18, 184(%r1) # restore R18\n"
" ld %r19, 192(%r1) # restore R19\n"
" ld %r20, 200(%r1) # restore R20\n"
" ld %r21, 208(%r1) # restore R21\n"
" ld %r22, 216(%r1) # restore R22\n"
" ld %r23, 224(%r1) # restore R23\n"
" ld %r24, 232(%r1) # restore R24\n"
" ld %r25, 240(%r1) # restore R25\n"
" ld %r26, 248(%r1) # restore R26\n"
" ld %r27, 256(%r1) # restore R27\n"
" ld %r28, 264(%r1) # restore R28\n"
" ld %r29, 272(%r1) # restore R29\n"
" ld %r30, 280(%r1) # restore R30\n"
" ld %r31, 288(%r1) # restore R31\n"
" # restore CR\n"
" ld %r0, 304(%r1)\n"
" ld %r0, 296(%r1)\n"
" mtcr %r0\n"
" # restore LR\n"
" ld %r0, 312(%r1)\n"
" ld %r0, 304(%r1)\n"
" mtlr %r0\n"
" # load PC\n"
" ld %r12, 320(%r1)\n"
" ld %r12, 312(%r1)\n"
" # restore CTR\n"
" mtctr %r12\n"
" # adjust stack\n"
" addi %r1, %r1, 328\n"
" addi %r1, %r1, 320\n"
" # use third arg as return value after jump\n"
" # use third arg as first arg in context function\n"
" mr %r3, %r5\n"
@@ -1212,19 +1208,19 @@ __asm (
" clrrdi %r3, %r3, 4\n"
" # reserve space for context-data on context-stack\n"
" # including 64 byte of linkage + parameter area (R1 % 16 == 0)\n"
" subi %r3, %r3, 392\n"
" subi %r3, %r3, 384\n"
" # third arg of make_fcontext() == address of context-function\n"
" # entry point (ELFv2) or descriptor (ELFv1)\n"
#if _CALL_ELF == 2
" # save address of context-function entry point\n"
" std %r5, 320(%r3)\n"
" std %r5, 312(%r3)\n"
#else
" # save address of context-function entry point\n"
" ld %r4, 0(%r5)\n"
" std %r4, 320(%r3)\n"
" std %r4, 312(%r3)\n"
" # save TOC of context-function\n"
" ld %r4, 8(%r5)\n"
" std %r4, 152(%r3)\n"
" std %r4, 144(%r3)\n"
#endif
" # load LR\n"
" mflr %r0\n"
@@ -1239,7 +1235,7 @@ __asm (
" mtlr %r0\n"
" # save address of finish as return-address for context-function\n"
" # will be entered after context-function returns\n"
" std %r4, 312(%r3)\n"
" std %r4, 304(%r3)\n"
" # restore return address from R6\n"
" mtlr %r6\n"
" blr # return pointer to context-data\n"
+1 -1
View File
@@ -1526,7 +1526,7 @@ bool VIEW::IsVisible( const VIEW_ITEM* aItem ) const
{
const auto viewData = aItem->viewPrivData();
return viewData->m_flags & VISIBLE;
return viewData && ( viewData->m_flags & VISIBLE );
}
+15 -26
View File
@@ -326,10 +326,8 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
return;
}
#if wxCHECK_VERSION( 3, 0, 0 )
if( !m_parentPanel->HasFocus() )
break;
#endif
double borderSize = std::min( m_settings.m_autoPanMargin * m_view->GetScreenPixelSize().x,
m_settings.m_autoPanMargin * m_view->GetScreenPixelSize().y );
@@ -626,16 +624,9 @@ void WX_VIEW_CONTROLS::refreshMouse()
moveEvent.SetY( msp.y );
// Set the modifiers state
#if wxCHECK_VERSION( 3, 0, 0 )
moveEvent.SetControlDown( wxGetKeyState( WXK_CONTROL ) );
moveEvent.SetShiftDown( wxGetKeyState( WXK_SHIFT ) );
moveEvent.SetAltDown( wxGetKeyState( WXK_ALT ) );
#else
// wx <3.0 do not have accessors, but the fields are exposed
moveEvent.m_controlDown = wxGetKeyState( WXK_CONTROL );
moveEvent.m_shiftDown = wxGetKeyState( WXK_SHIFT );
moveEvent.m_altDown = wxGetKeyState( WXK_ALT );
#endif
m_cursorPos = m_view->ToWorld( VECTOR2D( msp.x, msp.y ) );
wxPostEvent( m_parentPanel, moveEvent );
@@ -660,30 +651,28 @@ void WX_VIEW_CONTROLS::UpdateScrollbars()
VECTOR2I newScroll( ( viewport.Centre().x - boundary.GetLeft() ) * m_scrollScale.x,
( viewport.Centre().y - boundary.GetTop() ) * m_scrollScale.y );
// We add the width of the scroll bar thumb to the range because the scroll range is given by
// the full bar while the position is given by the left/top position of the thumb
VECTOR2I newRange( m_scrollScale.x * boundary.GetWidth() + m_parentPanel->GetScrollThumb( wxSB_HORIZONTAL ),
m_scrollScale.y * boundary.GetHeight() + m_parentPanel->GetScrollThumb( wxSB_VERTICAL ) );
// Flip scroll direction in flipped view
if( m_view->IsMirroredX() )
newScroll.x = ( boundary.GetRight() - viewport.Centre().x ) * m_scrollScale.x;
// Adjust scrollbars only if it is needed. Otherwise there are cases when canvas is continuosly
// Adjust scrollbars only if it is needed. Otherwise there are cases when canvas is continuously
// refreshed (Windows)
if( m_scrollPos != newScroll )
if( m_scrollPos != newScroll || newRange.x != m_parentPanel->GetScrollRange( wxSB_HORIZONTAL )
|| newRange.y != m_parentPanel->GetScrollRange( wxSB_VERTICAL ) )
{
// Another example of wxWidgets being broken by design: scroll position is determined by the
// left (or top, if vertical) edge of the slider. Fortunately, slider size seems to be constant
// (at least for wxGTK and wxMSW), so we have to add its size to allow user to scroll the workspace
// till the end.
m_parentPanel->SetScrollbars( 1, 1,
#if defined(__LINUX__)
m_scrollScale.x * boundary.GetWidth() + 1623, m_scrollScale.y * boundary.GetHeight() + 1623,
#elif defined(__WIN32__) || defined(__WIN64__)
m_scrollScale.x * boundary.GetWidth() + 1377, m_scrollScale.y * boundary.GetHeight() + 741,
#else
m_scrollScale.x * boundary.GetWidth(), m_scrollScale.y * boundary.GetHeight(),
#endif
newScroll.x, newScroll.y, false );
m_parentPanel->SetScrollbars( 1, 1, newRange.x, newRange.y, newScroll.x, newScroll.y, true );
m_scrollPos = newScroll;
#ifndef __APPLE__
// Trigger a mouse refresh to get the canvas update in GTK (re-draws the scrollbars).
// Note that this causes an infinite loop on OSX as it generates a paint event.
refreshMouse();
#endif
}
}
+9 -4
View File
@@ -715,8 +715,11 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
continue;
}
if( x0 == x1 ) // continue until a new X coordinate is reached
continue;
// This gives disastrous results with very high-frequency plots where the
// X coordinate may not increment until several waves later
//
// if( x0 == x1 ) // continue until a new X coordinate is reached
// continue;
bool outDown = ( y0 > maxYpx ) && ( y1 > maxYpx );
bool outUp = ( y0 < minYpx ) && ( y1 < minYpx );
@@ -2168,9 +2171,11 @@ void mpWindow::AdjustLimitedView()
if( !m_enableLimitedView )
return;
// m_min and m_max are plot limits for curves
// xMin, xMax, yMin, yMax are the full limits (plot limit + margin)
const double xMin = m_minX - m_marginLeft / m_scaleX;
const double xMax = m_maxX - m_marginRight / m_scaleX;
const double yMin = m_minY + m_marginTop / m_scaleY;
const double xMax = m_maxX + m_marginRight / m_scaleX;
const double yMin = m_minY - m_marginTop / m_scaleY;
const double yMax = m_maxY + m_marginBottom / m_scaleY;
if( m_desiredXmin < xMin )
-1
View File
@@ -114,7 +114,6 @@ WX_PROGRESS_REPORTER::WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& a
WX_PROGRESS_REPORTER::~WX_PROGRESS_REPORTER()
{
Destroy();
}
+23
View File
@@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/clipbrd.h>
#include <wx/stattext.h>
#include <wx/textentry.h>
#include <limits>
@@ -46,6 +47,8 @@ UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent,
m_useMils = aUseMils;
m_allowEval = allowEval && dynamic_cast<wxTextEntry*>( m_value );
m_needsEval = false;
m_selStart = 0;
m_selEnd = 0;
auto textEntry = dynamic_cast<wxTextEntry*>( m_value );
if( textEntry )
@@ -79,7 +82,10 @@ void UNIT_BINDER::onSetFocus( wxFocusEvent& aEvent )
wxString oldStr = m_eval.OriginalText();
if( oldStr.length() )
{
textEntry->SetValue( oldStr );
textEntry->SetSelection( m_selStart, m_selEnd );
}
m_needsEval = true;
}
@@ -95,8 +101,25 @@ void UNIT_BINDER::onKillFocus( wxFocusEvent& aEvent )
if( m_allowEval && textEntry )
{
if( m_eval.Process( textEntry->GetValue() ) )
{
textEntry->GetSelection( &m_selStart, &m_selEnd );
wxString sel = textEntry->GetStringSelection();
textEntry->ChangeValue( m_eval.Result() );
#ifdef __WXGTK__
// Manually copy the selected text to the primary selection clipboard
if( wxTheClipboard->Open() )
{
bool clipTarget = wxTheClipboard->IsUsingPrimarySelection();
wxTheClipboard->UsePrimarySelection( true );
wxTheClipboard->SetData( new wxTextDataObject( sel ) );
wxTheClipboard->UsePrimarySelection( clipTarget );
wxTheClipboard->Close();
}
#endif
}
m_needsEval = false;
}
+4 -6
View File
@@ -599,12 +599,10 @@ void WIDGET_HOTKEY_LIST::initializeElements()
// Add the bitmap image for invalid hotkey warning
// bitmap size is not know (depending on it is built). So get it:
wxSize iconsize;
wxBitmap bm_invalid = KiBitmap( cancel_xpm );
iconsize.x = bm_invalid.GetWidth();
iconsize.y = bm_invalid.GetHeight();
m_imgList = new wxImageList( iconsize.x, iconsize.y, true, 1);
m_imgList->Add( bm_invalid );
wxIcon icon;
icon.CopyFromBitmap( KiBitmap( cancel_xpm ) );
m_imgList = new wxImageList( icon.GetSize().x, icon.GetSize().y, true, 1 );
m_imgList->Add( icon );
AssignImageList( m_imgList );
if( !m_readOnly )
+5
View File
@@ -148,7 +148,12 @@ void WX_GRID::DrawColLabel( wxDC& dc, int col )
// It is reported that we need to erase the background to avoid display
// artefacts, see #12055.
// wxWidgets renamed this variable between 3.1.2 and 3.1.3 ...
#if wxCHECK_VERSION( 3, 1, 3 )
wxDCBrushChanger setBrush( dc, m_colLabelWin->GetBackgroundColour() );
#else
wxDCBrushChanger setBrush( dc, m_colWindow->GetBackgroundColour() );
#endif
dc.DrawRectangle(rect);
rend.DrawBorder( *this, dc, rect );
+26 -2
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -27,9 +27,34 @@
* @file wildcards_and_files_ext.cpp
* Definition of file extensions used in Kicad.
*/
#include <regex>
#include <wildcards_and_files_ext.h>
bool compareFileExtensions( const std::string& aExtension,
const std::vector<std::string>& aReference, bool aCaseSensitive )
{
// Form the regular expression string by placing all possible extensions into it as alternatives
std::string regexString = "(";
bool first = true;
for( auto ext : aReference )
{
// The | separate goes between the extensions
if( !first )
regexString += "|";
else
first = false;
regexString += ext;
}
regexString += ")";
// Create the regex and see if it matches
std::regex extRegex( regexString, aCaseSensitive ? std::regex::ECMAScript : std::regex::icase );
return std::regex_match( aExtension, extRegex );
}
wxString formatWildcardExt( const wxString& aWildcard )
{
wxString wc;
@@ -91,7 +116,6 @@ wxString AddFileExtListToFilter( const std::vector<std::string>& aExts )
const std::string SchematicSymbolFileExtension( "sym" );
const std::string SchematicLibraryFileExtension( "lib" );
const std::string SchematicBackupFileExtension( "bak" );
const std::string VrmlFileExtension( "wrl" );
+1 -1
View File
@@ -140,7 +140,7 @@ static int guessNickname( FP_LIB_TABLE* aTbl, LIB_ID* aFootprintId )
{
wxArrayString fpnames;
aTbl->FootprintEnumerate( fpnames, nicks[libNdx] );
aTbl->FootprintEnumerate( fpnames, nicks[libNdx], true );
for( unsigned nameNdx = 0; nameNdx<fpnames.size(); ++nameNdx )
{
+1 -1
View File
@@ -79,7 +79,7 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
KiScaledBitmap( module_filtered_list_xpm, this ),
wxNullBitmap,
true, NULL,
_( "Filter footprint list by schematic symbol keywords" ),
_( "Use schematic symbol footprint filters" ),
wxEmptyString );
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
+6 -1
View File
@@ -63,9 +63,14 @@ int SCH_EDIT_FRAME::BlockCommand( EDA_KEY key )
switch( key )
{
default:
cmd = key & 0xFF;
cmd = key & 0xFFFF;
if( cmd == 0 ) // All not handled values are seen as block move
cmd = BLOCK_MOVE;
break;
case GR_KB_ALT: // Should be BLOCK_ROTATE. Not suported: fall into move
case 0:
cmd = BLOCK_MOVE;
break;
-1
View File
@@ -745,7 +745,6 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
{
aItem->SetFlags( STRUCT_DELETED );
itemList.PushItem( ITEM_PICKER( aItem, UR_DELETED ) );
RemoveFromScreen( aItem );
};
remove_item( aJunction );
+4 -48
View File
@@ -64,9 +64,7 @@ int LIB_PART::m_subpartFirstId = 'A';
LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_PART* aRootPart ) :
EDA_ITEM( LIB_ALIAS_T ),
shared( aRootPart ),
tmpUnit( 0 ),
tmpConversion( 0 )
shared( aRootPart )
{
SetName( aName );
}
@@ -74,9 +72,7 @@ LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_PART* aRootPart ) :
LIB_ALIAS::LIB_ALIAS( const LIB_ALIAS& aAlias, LIB_PART* aRootPart ) :
EDA_ITEM( aAlias ),
shared( aRootPart ),
tmpUnit( 0 ),
tmpConversion( 0 )
shared( aRootPart )
{
name = aAlias.name;
@@ -534,7 +530,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
}
// Not filled items and filled shapes are now plotted
// (plot only items which are not already plotted)
// Items that have BG fills only get re-stroked to ensure the edges are in the foreground
for( LIB_ITEM& item : m_drawings )
{
if( item.Type() == LIB_FIELD_T )
@@ -546,8 +542,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
continue;
if( item.m_Fill != FILLED_WITH_BG_BODYCOLOR )
item.Plot( aPlotter, aOffset, fill, aTransform );
item.Plot( aPlotter, aOffset, fill && ( item.m_Fill != FILLED_WITH_BG_BODYCOLOR ), aTransform );
}
}
@@ -931,45 +926,6 @@ LIB_FIELD& LIB_PART::GetFootprintField()
}
bool LIB_PART::SaveDateAndTime( OUTPUTFORMATTER& aFormatter )
{
int year, mon, day, hour, min, sec;
if( m_dateLastEdition == 0 )
return true;
sec = m_dateLastEdition & 63;
min = ( m_dateLastEdition >> 6 ) & 63;
hour = ( m_dateLastEdition >> 12 ) & 31;
day = ( m_dateLastEdition >> 17 ) & 31;
mon = ( m_dateLastEdition >> 22 ) & 15;
year = ( m_dateLastEdition >> 26 ) + 1990;
aFormatter.Print( 0, "Ti %d/%d/%d %d:%d:%d\n", year, mon, day, hour, min, sec );
return true;
}
bool LIB_PART::LoadDateAndTime( char* aLine )
{
int year, mon, day, hour, min, sec;
year = mon = day = hour = min = sec = 0;
strtok( aLine, " \r\t\n" );
strtok( NULL, " \r\t\n" );
if( sscanf( aLine, "%d/%d/%d %d:%d:%d", &year, &mon, &day, &hour, &min, &sec ) != 6 )
return false;
m_dateLastEdition = ( sec & 63 ) + ( ( min & 63 ) << 6 ) +
( ( hour & 31 ) << 12 ) + ( ( day & 31 ) << 17 ) +
( ( mon & 15 ) << 22 ) + ( ( year - 1990 ) << 26 );
return true;
}
void LIB_PART::SetOffset( const wxPoint& aOffset )
{
for( LIB_ITEM& item : m_drawings )
-31
View File
@@ -87,9 +87,6 @@ protected:
wxString keyWords; ///< keyword list (used for search for parts by keyword)
wxString docFileName; ///< Associate doc file name
int tmpUnit; ///< Temporary unit designator (used for rendering)
int tmpConversion; ///< Temporary conversion designator (used for rendering)
public:
LIB_ALIAS( const wxString& aName, LIB_PART* aRootComponent );
LIB_ALIAS( const LIB_ALIAS& aAlias, LIB_PART* aRootComponent = NULL );
@@ -174,12 +171,6 @@ public:
*/
wxString GetUnitReference( int aUnit ) override;
/**
* A temporary conversion (deMorgan) designation for rendering, preview, etc.
*/
void SetTmpConversion( int aConversion ) { tmpConversion = aConversion; }
int GetTmpConversion() { return tmpConversion; }
/**
* KEEPCASE sensitive comparison of the part entry name.
*/
@@ -272,8 +263,6 @@ class LIB_PART : public EDA_ITEM
private:
void deleteAllFields();
public:
LIB_PART( const wxString& aName, PART_LIB* aLibrary = NULL );
@@ -377,26 +366,6 @@ public:
return GetUnitBoundingBox( 0, 0 );
}
/**
* Write the date and time of part to \a aFile in the format:
* "Ti yy/mm/jj hh:mm:ss"
*
* @param aFormatter A reference to an #OUTPUTFORMATTER object containing the
* output format to write to.
* @return True if the date and time were successfully written to \a aFormatter.
*/
bool SaveDateAndTime( OUTPUTFORMATTER& aFormatter );
bool LoadDateAndTime( char* aLine );
/**
* Write the data structures out to \a aFormatter in the part library "*.lib" format.
*
* @param aFormatter A reference to an OUTPUTFORMATTER to write to.
* @return True if success writing else false.
*/
bool Save( OUTPUTFORMATTER& aFormatter );
bool IsPower() const { return m_options == ENTRY_POWER; }
bool IsNormal() const { return m_options == ENTRY_NORMAL; }
@@ -456,20 +456,8 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
candidate.m_Screen = item.GetSheetPath().LastScreen();
SCH_SHEET_PATH sheetpath = item.GetSheetPath();
candidate.m_Reference = candidate.m_Component->GetRef( &sheetpath );
// For multi units per package , add unit id.
// however, there is a problem: the unit id stored is always >= 1
// and 1 for no multi units.
// so add unit id only if unit > 1 if the unit count is > 1
// (can be 0 if the symbol is not found)
int unit = candidate.m_Component->GetUnitSelection( &sheetpath );
int unitcount = candidate.m_Component->GetUnitCount();
candidate.m_IsOrphan = ( unitcount == 0 );
if( unitcount > 1 || unit > 1 )
{
candidate.m_Reference << wxChar( ('A' + unit -1) );
}
m_components.push_back( candidate );
}
#endif
@@ -484,14 +472,12 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
wxString last_str_libid = m_components.front().GetStringLibId();
int row = 0;
wxString refs;
wxString last_ref;
bool mark_cell = m_components.front().m_IsOrphan;
CMP_CANDIDATE* cmp = nullptr;
for( unsigned ii = 0; ii < m_components.size(); ii++ )
for( auto& cmp : m_components )
{
cmp = &m_components[ii];
wxString str_libid = cmp->GetStringLibId();
wxString str_libid = cmp.GetStringLibId();
if( last_str_libid != str_libid )
{
@@ -499,17 +485,24 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
AddRowToGrid( mark_cell, refs, last_str_libid );
// prepare next entry
mark_cell = cmp->m_IsOrphan;
mark_cell = cmp.m_IsOrphan;
last_str_libid = str_libid;
refs.Empty();
row++;
}
else if( cmp.GetSchematicReference() == last_ref )
{
cmp.m_Row = row;
continue;
}
last_ref = cmp.GetSchematicReference();
if( !refs.IsEmpty() )
refs += wxT( ", " );
refs += cmp->GetSchematicReference();
cmp->m_Row = row;
refs += cmp.GetSchematicReference();
cmp.m_Row = row;
}
// Add last component group:
+6 -1
View File
@@ -151,10 +151,15 @@ void DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick( wxCommandEvent& aEvent
void DIALOG_EDIT_ONE_FIELD::OnSetFocusText( wxFocusEvent& event )
{
#ifdef __WXGTK__
// Force an update of the text control before setting the text selection
// This is needed because GTK seems to ignore the selection on first update
//
// Note that we can't do this on OSX as it tends to provoke Apple's
// "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair"
// bug. See: https://bugs.launchpad.net/kicad/+bug/1837225
m_TextValue->Update();
#endif
if( m_fieldId == REFERENCE )
SelectReferenceNumber( static_cast<wxTextEntry*>( m_TextValue ) );
+130 -130
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// C++ code generated with wxFormBuilder (version Aug 15 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -16,186 +16,186 @@
DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 1, 0 );
gbSizer1 = new wxGridBagSizer( 5, 5 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_pinNameLabel = new wxStaticText( this, wxID_ANY, _("Pin &name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinNameLabel->Wrap( -1 );
gbSizer1->Add( m_pinNameLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
m_textPinName = new wxTextCtrl( this, ID_M_TEXTPINNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_textPinName, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_pinNumberLabel = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_pinNameLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_textPinName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_textPinName, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_pinNumberLabel = new wxStaticText( this, wxID_ANY, _("Pin num&ber:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinNumberLabel->Wrap( -1 );
m_pinNumberLabel->SetToolTip( _("Pin number: 1 to 4 ASCII letters and/or digits") );
gbSizer1->Add( m_pinNumberLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
m_textPinNumber = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_textPinNumber, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticTextEType = new wxStaticText( this, wxID_ANY, _("&Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextEType->Wrap( -1 );
m_staticTextEType->SetToolTip( _("Used by the ERC.") );
gbSizer1->Add( m_staticTextEType, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
m_choiceElectricalType = new PinTypeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
gbSizer1->Add( m_choiceElectricalType, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGstyle->Wrap( -1 );
gbSizer1->Add( m_staticTextGstyle, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
m_choiceStyle = new PinShapeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
gbSizer1->Add( m_choiceStyle, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_posXLabel = new wxStaticText( this, wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_pinNumberLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_textPinNumber = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_textPinNumber, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_posXLabel = new wxStaticText( this, wxID_ANY, _("&X position:"), wxDefaultPosition, wxDefaultSize, 0 );
m_posXLabel->Wrap( -1 );
gbSizer1->Add( m_posXLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
gbSizer1->Add( m_posXLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_posXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_posXCtrl->SetMinSize( wxSize( 110,-1 ) );
gbSizer1->Add( m_posXCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
gbSizer1->Add( m_posXCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_posYLabel = new wxStaticText( this, wxID_ANY, _("&Y position:"), wxDefaultPosition, wxDefaultSize, 0 );
m_posYLabel->Wrap( -1 );
gbSizer1->Add( m_posYLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_posYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_posYCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_pinLengthLabel = new wxStaticText( this, wxID_ANY, _("&Pin length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinLengthLabel->Wrap( -1 );
gbSizer1->Add( m_pinLengthLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_pinLengthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_pinLengthCtrl, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_nameSizeLabel = new wxStaticText( this, wxID_ANY, _("N&ame text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_nameSizeLabel->Wrap( -1 );
gbSizer1->Add( m_nameSizeLabel, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_nameSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_nameSizeCtrl, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_numberSizeLabel = new wxStaticText( this, wxID_ANY, _("Number text si&ze:"), wxDefaultPosition, wxDefaultSize, 0 );
m_numberSizeLabel->Wrap( -1 );
gbSizer1->Add( m_numberSizeLabel, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_numberSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_numberSizeCtrl, wxGBPosition( 9, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextEType = new wxStaticText( this, wxID_ANY, _("Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextEType->Wrap( -1 );
m_staticTextEType->SetToolTip( _("Used by the ERC.") );
gbSizer1->Add( m_staticTextEType, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_choiceElectricalType = new PinTypeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
gbSizer1->Add( m_choiceElectricalType, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGstyle->Wrap( -1 );
gbSizer1->Add( m_staticTextGstyle, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_choiceStyle = new PinShapeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
gbSizer1->Add( m_choiceStyle, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextOrient->Wrap( -1 );
gbSizer1->Add( m_staticTextOrient, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
gbSizer1->Add( m_choiceOrientation, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_posXUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_posXUnits->Wrap( -1 );
gbSizer1->Add( m_posXUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
m_posYLabel = new wxStaticText( this, wxID_ANY, _("Y position:"), wxDefaultPosition, wxDefaultSize, 0 );
m_posYLabel->Wrap( -1 );
gbSizer1->Add( m_posYLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_posYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_posYCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
gbSizer1->Add( m_posXUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_posYUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_posYUnits->Wrap( -1 );
gbSizer1->Add( m_posYUnits, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextOrient->Wrap( -1 );
gbSizer1->Add( m_staticTextOrient, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
gbSizer1->Add( m_choiceOrientation, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_pinLengthLabel = new wxStaticText( this, ID_M_STATICTEXTPINLEN, _("Pin length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinLengthLabel->Wrap( -1 );
gbSizer1->Add( m_pinLengthLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_pinLengthCtrl = new wxTextCtrl( this, ID_M_TEXTLENGTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_pinLengthCtrl, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_pinLengthUnits = new wxStaticText( this, ID_M_STATICLENGTHUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_posYUnits, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_pinLengthUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinLengthUnits->Wrap( -1 );
gbSizer1->Add( m_pinLengthUnits, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
m_nameSizeLabel = new wxStaticText( this, ID_M_STATICTEXTNAMESIZE, _("N&ame text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_nameSizeLabel->Wrap( -1 );
gbSizer1->Add( m_nameSizeLabel, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
m_nameSizeCtrl = new wxTextCtrl( this, ID_M_TEXTPINNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_nameSizeCtrl, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_nameSizeUnits = new wxStaticText( this, ID_M_STATICNAMETEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_pinLengthUnits, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_nameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_nameSizeUnits->Wrap( -1 );
gbSizer1->Add( m_nameSizeUnits, wxGBPosition( 8, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
m_numberSizeLabel = new wxStaticText( this, ID_M_STATICTEXTPADNAMESIZE, _("Number te&xt size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_numberSizeLabel->Wrap( -1 );
gbSizer1->Add( m_numberSizeLabel, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_numberSizeCtrl = new wxTextCtrl( this, ID_M_TEXTPADNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_numberSizeCtrl, wxGBPosition( 9, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_numberSizeUnits = new wxStaticText( this, ID_M_STATICNUMBERTEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_nameSizeUnits, wxGBPosition( 8, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_numberSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_numberSizeUnits->Wrap( -1 );
gbSizer1->Add( m_numberSizeUnits, wxGBPosition( 9, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
gbSizer1->Add( m_numberSizeUnits, wxGBPosition( 9, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
gbSizer1->AddGrowableCol( 1 );
bLeftSizer->Add( gbSizer1, 1, wxEXPAND|wxTOP, 5 );
bLeftSizer->Add( gbSizer1, 1, wxEXPAND, 5 );
bUpperSizer->Add( bLeftSizer, 1, wxEXPAND|wxALL, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* checkboxesSizer;
checkboxesSizer = new wxBoxSizer( wxVERTICAL );
m_checkApplyToAllParts = new wxCheckBox( this, wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
checkboxesSizer->Add( m_checkApplyToAllParts, 0, wxALL, 3 );
checkboxesSizer->Add( m_checkApplyToAllParts, 0, wxBOTTOM, 3 );
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
checkboxesSizer->Add( m_checkApplyToAllConversions, 0, wxALL, 3 );
checkboxesSizer->Add( m_checkApplyToAllConversions, 0, wxBOTTOM, 3 );
checkboxesSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_checkShow = new wxCheckBox( this, wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShow->SetValue(true);
checkboxesSizer->Add( m_checkShow, 0, wxALL, 3 );
m_checkShow->SetValue(true);
checkboxesSizer->Add( m_checkShow, 0, wxBOTTOM, 3 );
bRightSizer->Add( checkboxesSizer, 0, wxEXPAND|wxALL, 5 );
m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
m_panelShowPin->SetMinSize( wxSize( 150,150 ) );
bRightSizer->Add( m_panelShowPin, 1, wxEXPAND | wxALL, 5 );
bRightSizer->Add( m_panelShowPin, 1, wxEXPAND|wxLEFT, 5 );
bUpperSizer->Add( bRightSizer, 1, wxEXPAND|wxALL, 5 );
mainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
mainSizer->Add( bUpperSizer, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
mainSizer->Add( m_sdbSizerButtons, 0, wxALL|wxALIGN_RIGHT, 5 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
m_textPinName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_textPinNumber->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceElectricalType->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceStyle->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_pinLengthCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_nameSizeCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_numberSizeCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceElectricalType->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceStyle->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllParts->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllConversions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_checkShow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
@@ -207,15 +207,15 @@ DIALOG_LIB_EDIT_PIN_BASE::~DIALOG_LIB_EDIT_PIN_BASE()
// Disconnect Events
m_textPinName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_textPinNumber->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceElectricalType->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceStyle->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_pinLengthCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_nameSizeCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_numberSizeCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceElectricalType->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceStyle->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllParts->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllConversions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_checkShow->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
m_panelShowPin->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPaintShowPanel ), NULL, this );
}
File diff suppressed because it is too large Load Diff
+21 -39
View File
@@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// C++ code generated with wxFormBuilder (version Aug 15 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_LIB_EDIT_PIN_BASE_H__
#define __DIALOG_LIB_EDIT_PIN_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@@ -40,48 +39,32 @@ class wxBitmapComboBox;
class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
{
private:
protected:
enum
{
ID_M_TEXTPINNAME = 1000,
ID_M_STATICTEXTPADNAME,
ID_M_TEXTPADNAME,
ID_M_STATICTEXTPINLEN,
ID_M_TEXTLENGTH,
ID_M_STATICLENGTHUNITS,
ID_M_STATICTEXTNAMESIZE,
ID_M_TEXTPINNAMETEXTSIZE,
ID_M_STATICNAMETEXTSIZEUNITS,
ID_M_STATICTEXTPADNAMESIZE,
ID_M_TEXTPADNAMETEXTSIZE,
ID_M_STATICNUMBERTEXTSIZEUNITS
};
wxStaticText* m_pinNameLabel;
wxTextCtrl* m_textPinName;
wxStaticText* m_pinNumberLabel;
wxTextCtrl* m_textPinNumber;
wxStaticText* m_posXLabel;
wxTextCtrl* m_posXCtrl;
wxStaticText* m_posYLabel;
wxTextCtrl* m_posYCtrl;
wxStaticText* m_pinLengthLabel;
wxTextCtrl* m_pinLengthCtrl;
wxStaticText* m_nameSizeLabel;
wxTextCtrl* m_nameSizeCtrl;
wxStaticText* m_numberSizeLabel;
wxTextCtrl* m_numberSizeCtrl;
wxStaticText* m_staticTextEType;
PinTypeComboBox* m_choiceElectricalType;
wxStaticText* m_staticTextGstyle;
PinShapeComboBox* m_choiceStyle;
wxStaticText* m_posXLabel;
wxTextCtrl* m_posXCtrl;
wxStaticText* m_posXUnits;
wxStaticText* m_posYLabel;
wxTextCtrl* m_posYCtrl;
wxStaticText* m_posYUnits;
wxStaticText* m_staticTextOrient;
wxBitmapComboBox* m_choiceOrientation;
wxStaticText* m_pinLengthLabel;
wxTextCtrl* m_pinLengthCtrl;
wxStaticText* m_posXUnits;
wxStaticText* m_posYUnits;
wxStaticText* m_pinLengthUnits;
wxStaticText* m_nameSizeLabel;
wxTextCtrl* m_nameSizeCtrl;
wxStaticText* m_nameSizeUnits;
wxStaticText* m_numberSizeLabel;
wxTextCtrl* m_numberSizeCtrl;
wxStaticText* m_numberSizeUnits;
wxCheckBox* m_checkApplyToAllParts;
wxCheckBox* m_checkApplyToAllConversions;
@@ -91,17 +74,16 @@ class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnPropertiesChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); }
public:
DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_EDIT_PIN_BASE();
};
#endif //__DIALOG_LIB_EDIT_PIN_BASE_H__
+16 -2
View File
@@ -309,6 +309,9 @@ public:
ascending = GetView()->IsSortOrderAscending();
}
for( LIB_PINS& row : m_rows )
SortPins( row );
SortRows( sortCol, ascending );
if ( GetView() )
@@ -321,8 +324,19 @@ public:
void SortRows( int aSortCol, bool ascending )
{
std::sort( m_rows.begin(), m_rows.end(),
[ aSortCol, ascending, this ]( LIB_PINS lhs, LIB_PINS rhs ) -> bool
{ return compare( lhs, rhs, aSortCol, ascending, m_userUnits ); } );
[ aSortCol, ascending, this ]( LIB_PINS& lhs, LIB_PINS& rhs ) -> bool
{
return compare( lhs, rhs, aSortCol, ascending, m_userUnits );
} );
}
void SortPins( LIB_PINS& aRow )
{
std::sort( aRow.begin(), aRow.end(),
[]( LIB_PIN* lhs, LIB_PIN* rhs ) -> bool
{
return PinNumbers::Compare( lhs->GetNumber(), rhs->GetNumber() ) < 0;
} );
}
void AppendRow( LIB_PIN* aPin )
+10 -4
View File
@@ -226,7 +226,8 @@ void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent )
book->AddPage( new PANEL_EESCHEMA_SETTINGS( this, book ), _( "Eeschema" ) );
book->AddSubPage( new PANEL_EESCHEMA_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
book->AddSubPage( new PANEL_EESCHEMA_COLOR_CONFIG( this, book ), _( "Colors" ) );
book->AddSubPage( new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( this, book ), _( "Field Name Templates" ) );
book->AddSubPage( new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( this, book ),
_( "Field Name Templates" ) );
}
@@ -355,6 +356,7 @@ static const wxString PrintSheetRefEntry = "PrintSheetReferenceAndTitle
static const wxString RepeatStepXEntry = "RepeatStepX";
static const wxString RepeatStepYEntry = "RepeatStepY";
static const wxString RepeatLabelIncrementEntry = "RepeatLabelIncrement";
static const wxString ShowIllegalSymboLibDialog = "ShowIllegalSymbolLibDialog";
// Library editor wxConfig entry names.
static const wxChar defaultLibWidthEntry[] = wxT( "LibeditLibWidth" );
@@ -395,8 +397,11 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings()
-REPEAT_OFFSET_MAX,
REPEAT_OFFSET_MAX ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatLabelIncrementEntry,
&m_repeatDeltaLabel,
DEFAULT_REPEAT_LABEL_INC, -10, +10 ) );
&m_repeatDeltaLabel, DEFAULT_REPEAT_LABEL_INC,
-10, +10 ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowIllegalSymboLibDialog,
&m_showIllegalSymbolLibDialog, true ) );
return m_configSettings;
}
@@ -551,7 +556,8 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
ReadHotkeyConfig( LIB_EDIT_FRAME_NAME, g_Libedit_Hotkeys_Descr );
SetDefaultLineThickness( (int) aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SetDefaultLineThickness( (int) aCfg->Read( DefaultDrawLineWidthEntry,
DEFAULTDRAWLINETHICKNESS ) );
SetDefaultPinLength( (int) aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) );
m_textPinNumDefaultSize = (int) aCfg->Read( defaultPinNumSizeEntry, DEFAULTPINNUMSIZE );
m_textPinNameDefaultSize = (int) aCfg->Read( defaultPinNameSizeEntry, DEFAULTPINNAMESIZE );
+33 -226
View File
@@ -94,8 +94,8 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, bool aSaveUnderNewName,
{
wxFileName backupFileName = schematicFileName;
// Rename the old file to a '.bak' one:
backupFileName.SetExt( SchematicBackupFileExtension );
// Rename the old file to a '-bak' suffixed one:
backupFileName.SetExt( schematicFileName.GetExt() + GetBackupSuffix() );
if( backupFileName.FileExists() )
wxRemoveFile( backupFileName.GetFullPath() );
@@ -351,6 +351,36 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
}
else
{
// Double check to ensure no legacy library list entries have been
// added to the projec file symbol library list.
wxString paths;
wxArrayString libNames;
PART_LIBS::LibNamesAndPaths( &Prj(), false, &paths, &libNames );
if( !libNames.IsEmpty() )
{
if( m_showIllegalSymbolLibDialog )
{
wxRichMessageDialog invalidLibDlg(
this,
_( "Illegal entry found in project file symbol library list." ),
_( "Project Load Warning" ),
wxOK | wxCENTER | wxICON_EXCLAMATION );
invalidLibDlg.SetExtendedMessage(
_( "Symbol libraries defined in the project file symbol library list "
"are no longer supported and will be\nremoved. This may cause "
"broken symbol library links under certain conditions." ) );
invalidLibDlg.ShowCheckBox( _( "Do not show this dialog again." ) );
invalidLibDlg.ShowModal();
m_showIllegalSymbolLibDialog = !invalidLibDlg.IsCheckBoxChecked();
}
libNames.Clear();
paths.Clear();
PART_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
}
// Check to see whether some old library parts need to be rescued
// Only do this if RescueNeverShow was not set.
wxConfigBase *config = Kiface().KifaceSettings();
@@ -386,7 +416,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
bool SCH_EDIT_FRAME::AppendSchematic()
{
wxString msg;
wxString fullFileName;
SCH_SCREEN* screen = GetScreen();
@@ -407,232 +436,10 @@ bool SCH_EDIT_FRAME::AppendSchematic()
fullFileName = dlg.GetPath();
wxFileName fn = fullFileName;
if( fn.IsRelative() )
{
fn.MakeAbsolute();
fullFileName = fn.GetFullPath();
}
wxString cache_name = PART_LIBS::CacheName( fullFileName );
if( !!cache_name )
{
PART_LIBS* libs = Prj().SchLibs();
try
{
if( PART_LIB* lib = libs->AddLibrary( cache_name ) )
lib->SetCache();
}
catch( const IO_ERROR& ioe )
{
DisplayError( this, ioe.What() );
}
}
wxLogDebug( wxT( "Importing schematic " ) + fullFileName );
// Load the schematic into a temporary sheet.
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
std::unique_ptr< SCH_SHEET> newSheet( new SCH_SHEET );
newSheet->SetFileName( fullFileName );
try
{
pi->Load( fullFileName, &Kiway(), newSheet.get() );
if( !pi->GetError().IsEmpty() )
{
DisplayErrorMessage( this,
_( "The entire schematic could not be loaded. Errors "
"occurred attempting to load hierarchical sheet "
"schematics." ),
pi->GetError() );
}
}
catch( const IO_ERROR& ioe )
{
msg.Printf( _( "Error occurred loading schematic file \"%s\"." ), fullFileName );
DisplayErrorMessage( this, msg, ioe.What() );
msg.Printf( _( "Failed to load schematic \"%s\"" ), fullFileName );
AppendMsgPanel( wxEmptyString, msg, CYAN );
if( !LoadSheetFromFile( GetCurrentSheet().Last(), &GetCurrentSheet(), fullFileName ) )
return false;
}
// Make sure any new sheet changes do not cause any recursion issues.
SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the schematic sheet hierarchy.
SCH_SHEET_LIST sheetHierarchy( newSheet.get() ); // This is the hierarchy of the import.
wxFileName destFile = screen->GetFileName();
if( destFile.IsRelative() )
destFile.MakeAbsolute( Prj().GetProjectPath() );
if( hierarchy.TestForRecursion( sheetHierarchy, destFile.GetFullPath( wxPATH_UNIX ) ) )
{
msg.Printf( _( "The sheet changes cannot be made because the destination sheet already "
"has the sheet \"%s\" or one of it's subsheets as a parent somewhere in "
"the schematic hierarchy." ),
destFile.GetFullPath() );
DisplayError( this, msg );
return false;
}
wxArrayString names;
// Make sure the imported schematic has been remapped to the symbol library table.
SCH_SCREENS newScreens( newSheet.get() ); // All screens associated with the import.
if( newScreens.HasNoFullyDefinedLibIds() )
{
DisplayInfoMessage( this,
"This schematic has not been remapped to the symbol library\n"
"table. The project this schematic belongs to must first be\n"
"remapped before it can be imported into the current project." );
return false;
}
else
{
// If there are symbol libraries in the imported schematic that are not in the
// symbol library table of this project, there could be a lot of broken symbol
// library links. Attempt to add the missing libraries to the project symbol
// library table.
newScreens.GetLibNicknames( names );
wxArrayString newLibNames;
for( const auto& name : names )
{
if( !Prj().SchSymbolLibTable()->HasLibrary( name ) )
newLibNames.Add( name );
}
wxFileName symLibTableFn( fn.GetPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
if( !newLibNames.IsEmpty() && symLibTableFn.Exists() && symLibTableFn.IsFileReadable() )
{
SYMBOL_LIB_TABLE table;
try
{
table.Load( symLibTableFn.GetFullPath() );
}
catch( const IO_ERROR& ioe )
{
msg.Printf( _( "An error occurred loading the symbol library table \"%s\"." ),
symLibTableFn.GetFullPath() );
DisplayErrorMessage( NULL, msg, ioe.What() );
}
if( !table.IsEmpty() )
{
for( const auto& libName : newLibNames )
{
if( !table.HasLibrary( libName ) )
continue;
// Don't expand environment variable because KIPRJMOD will not be correct
// for a different project.
wxString uri = table.GetFullURI( libName, false );
wxFileName newLib;
if( uri.Contains( "${KIPRJMOD}" ) )
{
newLib.SetPath( fn.GetPath() );
newLib.SetFullName( uri.AfterLast( '}' ) );
uri = newLib.GetFullPath();
}
else if( uri.Contains( "$(KIPRJMOD)" ) )
{
newLib.SetPath( fn.GetPath() );
newLib.SetFullName( uri.AfterLast( ')' ) );
uri = newLib.GetFullPath();
}
else
{
uri = table.GetFullURI( libName );
}
// Add the library from the imported project to the current project
// symbol library table.
const SYMBOL_LIB_TABLE_ROW* row = table.FindRow( libName );
wxCHECK2_MSG( row, continue, "Library '" + libName +
"' missing from symbol library table '" +
symLibTableFn.GetFullPath() + "'." );
wxString newLibName = libName;
int libNameCnt = 1;
// Rename the imported symbol library if it already exists.
while( Prj().SchSymbolLibTable()->HasLibrary( newLibName ) )
newLibName = wxString::Format( "%s%d", libName, libNameCnt );
auto newRow = new SYMBOL_LIB_TABLE_ROW( newLibName, uri, row->GetType(),
row->GetOptions(), row->GetDescr() );
Prj().SchSymbolLibTable()->InsertRow( newRow );
if( libName != newLibName )
newScreens.ChangeSymbolLibNickname( libName, newLibName );
}
}
}
}
newScreens.ClearAnnotation();
// Check for duplicate sheet names in the current page.
wxArrayString duplicateSheetNames;
SCH_TYPE_COLLECTOR sheets;
sheets.Collect( screen->GetDrawItems(), SCH_COLLECTOR::SheetsOnly );
for( int i = 0; i < sheets.GetCount(); ++i )
{
if( newSheet->GetScreen()->GetSheet( ( ( SCH_SHEET* ) sheets[i] )->GetName() ) )
duplicateSheetNames.Add( ( ( SCH_SHEET* ) sheets[i] )->GetName() );
}
if( !duplicateSheetNames.IsEmpty() )
{
msg.Printf( "Duplicate sheet names exist on the current page. Do you want to "
"automatically rename the duplicate sheet names?" );
if( !IsOK( this, msg ) )
return false;
}
SCH_SCREEN* newScreen = newSheet->GetScreen();
wxCHECK_MSG( newScreen, false, "No screen defined for imported sheet." );
for( const auto& duplicateName : duplicateSheetNames )
{
SCH_SHEET* renamedSheet = newScreen->GetSheet( duplicateName );
wxCHECK2_MSG( renamedSheet, continue,
"Sheet " + duplicateName + " not found in imported schematic." );
timestamp_t newtimestamp = GetNewTimeStamp();
renamedSheet->SetTimeStamp( newtimestamp );
renamedSheet->SetName( wxString::Format( "Sheet%8.8lX", (unsigned long) newtimestamp ) );
}
// It is finally safe to add the imported schematic.
screen->Append( newScreen );
SCH_SCREENS allScreens;
allScreens.ReplaceDuplicateTimeStamps();
SCH_SCREENS screens( GetCurrentSheet().Last() );
screens.UpdateSymbolLinks( true );
// Clear all annotation in the imported schematic to prevent clashes with existing annotation.
// Must be done after updating the symbol links as we need to know about multi-unit parts.
// screens.ClearAnnotation();
screens.TestDanglingEnds();
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
+6 -23
View File
@@ -729,34 +729,15 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
MapY1 * radius * 2 + y1 );
GRLineTo( clipbox, aDC, posX, posY, width, color );
}
else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK ) /* an alternative for Inverted Clock */
{
const int clock_size = InternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1, y1 + clock_size );
GRLineTo( clipbox, aDC, x1 + MapX1 * clock_size * 2, y1,
width, color );
GRLineTo( clipbox, aDC, x1, y1 - clock_size, width, color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1 + clock_size, y1 );
GRLineTo( clipbox, aDC, x1, y1 + MapY1 * clock_size * 2,
width, color );
GRLineTo( clipbox, aDC, x1 - clock_size, y1,
width, color );
}
GRMoveTo( MapX1 * clock_size * 2 + x1, MapY1 * clock_size * 2 + y1 );
GRLineTo( clipbox, aDC, posX, posY, width, color );
}
else
{
GRMoveTo( x1, y1 );
GRLineTo( clipbox, aDC, posX, posY, width, color );
}
if( m_shape == PINSHAPE_CLOCK || m_shape == PINSHAPE_INVERTED_CLOCK || m_shape == PINSHAPE_CLOCK_LOW )
// Draw the clock shape (>)inside the symbol
if( m_shape == PINSHAPE_CLOCK || m_shape == PINSHAPE_INVERTED_CLOCK ||
m_shape == PINSHAPE_FALLING_EDGE_CLOCK || m_shape == PINSHAPE_CLOCK_LOW )
{
const int clock_size = InternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
@@ -777,7 +758,9 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
}
}
if( m_shape == PINSHAPE_INPUT_LOW || m_shape == PINSHAPE_CLOCK_LOW )
// Draw the active low (or H to L active transition)
if( m_shape == PINSHAPE_INPUT_LOW ||
m_shape == PINSHAPE_FALLING_EDGE_CLOCK || m_shape == PINSHAPE_CLOCK_LOW )
{
const int symbol_size = ExternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
+2 -2
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras ar wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -126,7 +126,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
component->GetLibId().GetUniStringLibId() );
}
if( !tmp.empty() )
if( !tmp.empty() && !errorMsg.Contains( component->GetLibId().GetUniStringLibId() ) )
{
if( errorMsg.empty() )
errorMsg += tmp;
+7 -9
View File
@@ -171,7 +171,11 @@ int LIB_EDIT_FRAME::BlockCommand( EDA_KEY key )
switch( key )
{
default:
cmd = key & 0xFF;
cmd = key & 0xFFFF;
if( cmd == 0 ) // All not handled values are seen as block move
cmd = BLOCK_MOVE;
break;
case EDA_KEY_C( 0xffffffff ): // -1
@@ -185,6 +189,8 @@ int LIB_EDIT_FRAME::BlockCommand( EDA_KEY key )
cmd = BLOCK_PRESELECT_MOVE;
break;
case GR_KB_ALT: // Should be BLOCK_ROTATE. Not suported: fall into move
case GR_KB_CTRL: // Should be BLOCK_MIRROR_Y. Not suported: fall into move
case GR_KEY_NONE:
cmd = BLOCK_MOVE;
break;
@@ -193,18 +199,10 @@ int LIB_EDIT_FRAME::BlockCommand( EDA_KEY key )
cmd = BLOCK_DUPLICATE;
break;
case GR_KB_ALT:
cmd = BLOCK_ROTATE;
break;
case GR_KB_SHIFTCTRL:
cmd = BLOCK_DELETE;
break;
case GR_KB_CTRL:
cmd = BLOCK_MIRROR_Y;
break;
case MOUSE_MIDDLE:
cmd = BLOCK_ZOOM;
break;
+12
View File
@@ -1084,7 +1084,19 @@ void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event )
m_libMgr->UpdatePart( GetCurPart(), GetCurLib() );
if( oldAliases != GetCurPart()->GetAliasNames( false ) )
{
// If the number of aliases (or their names) have changed, do a full re-sync
SyncLibraries( false );
}
else
{
// Otherwise just update each alias
for( LIB_ALIAS* alias : GetCurPart()->GetAliases() )
{
wxDataViewItem item = m_libMgr->GetAdapter()->FindItem( alias->GetLibId() );
static_cast<LIB_TREE_NODE_LIB_ID*>( item.GetID() )->Update( alias );
}
}
}
UpdatePartSelectList();
@@ -454,7 +454,9 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
|| couplingK.Matches( line ) // K## L## L## coupling constant
|| ( directiveStarted && line.StartsWith( '+' ) ) ) // multiline directives
{
m_directives.push_back( line );
// Pad the directive to ensure we distinguish between short directives
// and the start of a longer directive
m_directives.emplace_back( line + " " );
}
// Mark directive as started or continued in case it is a multi-line one
+1 -15
View File
@@ -148,9 +148,6 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
// If the clarify item selection context menu is aborted, don't show the context menu.
if( item == NULL && actionCancelled )
return false;
if( item )
SetCrossHairPosition( item->GetPosition(), false );
}
// If a command is in progress: add "cancel" and "end tool" menu
@@ -676,10 +673,6 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct
{
if( m_collectedItems.IsDraggableJunction() )
AddMenuItem( aMenu, ID_SCH_DRAG_ITEM, _( "Drag Junction" ), KiBitmap( drag_xpm ) );
if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) )
AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
KiBitmap( break_line_xpm ) );
}
if( screen->GetWireOrBus( aJunction->GetPosition() ) )
@@ -694,7 +687,6 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
{
SCH_SCREEN* screen = frame->GetScreen();
wxPoint pos = frame->GetCrossHairPosition();
wxString msg;
@@ -721,12 +713,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
KiBitmap( delete_node_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
KiBitmap( delete_connection_xpm ) );
SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
KiBitmap( break_line_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), KiBitmap( break_line_xpm ) );
PopMenu->AppendSeparator();
@@ -763,7 +750,6 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hotkeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
PopMenu->AppendSeparator();
@@ -672,10 +672,11 @@ class netlist():
for t in re.split( '(\d+)', str ) ]
for g in groups:
g = sorted(g, key=lambda g: sortKey(g.getRef()))
#g = sorted(g, key=lambda g: sortKey(g.getRef()))
g.sort(key=lambda g: sortKey(g.getRef()))
# Finally, sort the groups to order the references alphabetically
groups = sorted(groups, key=lambda group: sortKey(group[0].getRef()))
groups.sort(key=lambda group: sortKey(group[0].getRef()))
return groups
+3 -1
View File
@@ -259,6 +259,7 @@ void SCH_BASE_FRAME::UpdateStatusBar()
locformatter = "dx %f dy %f dist %f";
break;
case PERCENT:
case DEGREES:
wxASSERT( false );
break;
@@ -525,6 +526,7 @@ bool SCH_BASE_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& a
case BLOCK_DELETE: // Delete
case BLOCK_COPY: // Copy
case BLOCK_FLIP: // Flip
case BLOCK_ROTATE: // Rotate
case BLOCK_ZOOM: // Window Zoom
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: // mirror
@@ -574,7 +576,7 @@ bool SCH_BASE_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& a
break;
default:
wxFAIL_MSG( wxString::Format( "SCH_BASE_FRAME::HandleBlockBegin() unknown command: %s",
wxFAIL_MSG( wxString::Format( "SCH_BASE_FRAME::HandleBlockBegin() unknown command: %d",
block->GetCommand() ) );
break;
}
+2 -3
View File
@@ -472,13 +472,12 @@ void SCH_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{
auto cmd = (GetParent()->GetToolId() == ID_ZOOM_SELECTION) ? BLOCK_ZOOM : 0;
DBG(printf("start block\n");)
// DBG(printf("start block\n"); fflush(0);)
if( !GetParent()->HandleBlockBegin( nullptr, cmd_type, m_CursorStartPos, cmd ) )
{
// should not occur: error
GetParent()->DisplayToolMsg(
wxT( "EDA_DRAW_PANEL::OnMouseEvent() Block Error" ) );
GetParent()->DisplayToolMsg( "SCH_DRAW_PANEL: Block Error" );
}
else
{
+1
View File
@@ -386,6 +386,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_findReplaceStatus = new wxString( wxEmptyString );
m_undoItem = NULL;
m_hasAutoSave = true;
m_showIllegalSymbolLibDialog = true;
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
m_AboutTitle = "Eeschema";
+80 -37
View File
@@ -126,7 +126,7 @@ private:
wxPageSetupDialogData m_pageSetupData;
wxFindReplaceData* m_findReplaceData;
wxString* m_findReplaceStatus;
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
bool m_printSheetReference;
DIALOG_SCH_FIND* m_dlgFindReplace;
wxArrayString m_findStringHistoryList;
@@ -150,6 +150,7 @@ private:
bool m_autoplaceJustify; ///< allow autoplace to change justification
bool m_autoplaceAlign; ///< align autoplaced fields to the grid
bool m_footprintPreview; ///< whether to show footprint previews
bool m_showIllegalSymbolLibDialog;
/// An index to the last find item in the found items list #m_foundItems.
int m_foundItemIndex;
@@ -703,33 +704,9 @@ public:
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
/**
* Import a KiCad schematic into the current page.
* Import a KiCad schematic into the current sheet.
*
* In order to import a schematic a lot of things have to happen to before the contents
* of the imported schematic can be appended to the current page. The following list
* describes this process:
*
* - Load the schematic into a temporary SCH_SHEET object.
* - Make sure the imported schematic does not cause any hierarchy recursion issues.
* - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table).
* - Check to see if any symbol libraries need to be added to the current project's symbol
* library table. This includes:
* - Check if the symbol library already exists in the project or global symbol library
* table.
* - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute
* paths. ${KIPRJMOD} will not be the same for this project.
* - Check for duplicate symbol library nicknames and change the new symbol library nickname
* to prevent library name clashes.
* - Update all schematic symbol LIB_ID object library nicknames when the library nickname
* was changed to prevent clashes.
* - Check for duplicate sheet names which is illegal and automatically rename any duplicate
* sheets in the imported schematic.
* - Clear all of the annotation in the imported schematic to prevent clashes.
* - Append the objects from the temporary sheet to the current page.
* - Replace any duplicate time stamps.
* - Refresh the symbol library links.
*
* @return True if the project was imported properly.
* @return True if the schematic was imported properly.
*/
bool AppendSchematic();
@@ -980,6 +957,35 @@ private:
void EditSchematicText( SCH_TEXT* TextStruct );
void ChangeTextOrient( SCH_TEXT* aTextItem );
/**
* Verify that \a aSheet will not cause a recursion error in \a aHierarchy.
*
* @param aSheet is the #SCH_SHEET object to test.
* @param aHierarchy is the #SCH_SHEET_PATH where \a aSheet is going to reside.
*
* @return true if \a aSheet will cause a resursion error in \a aHierarchy.
*/
bool checkSheetForRecursion( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy );
/**
* Verify that the symbol library links \a aSheet and all of it's child sheets have
* been remapped to the symbol library table.
*
* @param aSheet is the #SCH_SHEET object to test.
*
* @return true if \a aSheet and it's child sheets have not been remapped.
*/
bool checkForNoFullyDefinedLibIds( SCH_SHEET* aSheet );
/**
* Load the given filename but sets the path to the current project path.
*
* @param full filepath of file to be imported.
* @param aFileType SCH_FILE_T value for file type
*/
bool importFile( const wxString& aFileName, int aFileType );
public:
/**
* Command event handler to change a text type to another one.
*
@@ -1102,15 +1108,54 @@ public:
wxPoint GetLastSheetPinPosition() const { return m_lastSheetPinPosition; }
private:
/**
* Load the given filename but sets the path to the current project path.
*
* @param full filepath of file to be imported.
* @param aFileType SCH_FILE_T value for file type
*/
bool importFile( const wxString& aFileName, int aFileType );
void InitSheet( SCH_SHEET* aSheet, const wxString& aNewFilename );
bool validateSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy );
/**
* Load a the KiCad schematic file \a aFileName into the sheet \a aSheet.
*
* If \a aSheet does not have a valid #SCH_SCREEN object, the schematic is loaded into
* \a Sheet. Otherwise, it is appended to the current #SCH_SCREEN object.
*
* In order to import a schematic a lot of things have to happen to before the contents
* of the imported schematic can be appended to the current page. The following list
* describes this process:
*
* - Load the schematic into a temporary #SCH_SHEET object.
* - Make sure the imported schematic does not cause any hierarchy recursion issues.
* - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table).
* - Check all of the possible combinations that could cause broken symbol library links
* and give the user the option to cancel the append process. The following conditions
* are check but they still do not guarantee that there will not be any broken symbol
* library links:
* - The source schematic is in the current project path and contains symbol library
* nicknames not found in the project symbol library table. This can happen if the
* schematic is copied to the current project path from another project.
* - The source schematic is in a different path and there are symbol library link nicknames
* that do not exist in either the current symbol library table or the source project
* symbol library table if it exists in the source path.
* - The source schematic is in a different path and contains duplicate symbol library
* nicknames that point to different libraries.
* - Check to see if any symbol libraries need to be added to the current project's symbol
* library table. This includes:
* - Check if the symbol library already exists in the project or global symbol library
* table.
* - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute
* paths. ${KIPRJMOD} will not be the same for this project.
* - Clear all of the annotation in the imported schematic to prevent clashes.
* - Append the objects from the temporary sheet to the current page.
* - Replace any duplicate time stamps.
* - Refresh the symbol library links.
*
* @param aSheet is the sheet to either append or load the schematic.
* @param aHierarchy is the current position in the schematic hierarchy used to test for
* possible file recursion issues.
* @param aFileName is the file name to load. The file name is expected to have an absolute
* path.
*
* @return True if the schematic was imported properly.
*/
bool LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
const wxString& aFileName );
/**
* Create a new SCH_SHEET_PIN object and add it to \a aSheet at the current cursor position.
@@ -1210,7 +1255,6 @@ public:
*/
void OrientComponent( COMPONENT_ORIENTATION_T aOrientation = CMP_NORMAL );
private:
void OnSelectUnit( wxCommandEvent& aEvent );
void ConvertPart( SCH_COMPONENT* DrawComponent );
@@ -1229,7 +1273,6 @@ private:
void PasteListOfItems( wxDC* DC );
/* Undo - redo */
public:
/**
* Create a copy of the current schematic item, and put it in the undo list.
-4
View File
@@ -1754,10 +1754,6 @@ void SCH_LEGACY_PLUGIN::Format( SCH_SCREEN* aScreen )
// Write the header
m_out->Print( 0, "%s %s %d\n", "EESchema", SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION );
// Write the project libraries.
for( const PART_LIB& lib : *m_kiway->Prj().SchLibs() )
m_out->Print( 0, "LIBS:%s\n", TO_UTF8( lib.GetName() ) );
// This section is not used, but written for file compatibility
m_out->Print( 0, "EELAYER %d %d\n", SCH_LAYER_ID_COUNT, 0 );
m_out->Print( 0, "EELAYER END\n" );
+19 -1
View File
@@ -30,6 +30,7 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <macros.h>
#include <trigo.h>
#include <sch_draw_panel.h>
#include <plotter.h>
#include <base_units.h>
@@ -299,7 +300,7 @@ int SCH_LINE::GetPenSize() const
{
if( m_size > 0 )
return m_size;
return GetDefaultWidth();
}
@@ -487,6 +488,19 @@ EDA_ITEM* SCH_LINE::MergeOverlap( SCH_LINE* aLine )
}
wxPoint SCH_LINE::GetClosestPoint( const wxPoint& aPoint )
{
// Compute the euclidean distance between the reference and the ends
double startDis = GetLineLength( aPoint, m_start );
double endDis = GetLineLength( aPoint, m_end );
if( startDis < endDis )
return m_start;
else
return m_end;
}
void SCH_LINE::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
{
if( GetLayer() == LAYER_NOTES )
@@ -705,6 +719,10 @@ bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const
bool SCH_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
// Performance enhancement for connection-building
if( aPosition == m_start || aPosition == m_end )
return true;
return TestSegmentHit( aPosition, m_start, m_end, aAccuracy );
}
+9
View File
@@ -81,6 +81,15 @@ public:
void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; }
/**
* Find the end point of the line (either start or end) that is closest
* to the provided point.
*
* @param aPoint the point to compare against
* @return The coordinates of the closest end point
*/
wxPoint GetClosestPoint( const wxPoint& aPoint );
int GetDefaultStyle() const;
void SetLineStyle( const int aStyle );
+123 -70
View File
@@ -366,8 +366,27 @@ void SCH_PAINTER::draw( LIB_ARC *aArc, int aLayer )
int sai = aArc->GetFirstRadiusAngle();
int eai = aArc->GetSecondRadiusAngle();
if( TRANSFORM().MapAngles( &sai, &eai ) )
std::swap( sai, eai );
/**
* This accounts for an oddity in the old library format, where the symbol
* is overdefined. The previous draw (based on wxwidgets) used start point and end
* point and always drew counter-clockwise. The new GAL draw takes center, radius and
* start/end angles. All of these points were stored in the file, so we need to mimic the
* swapping of start/end points rather than using the stored angles in order to properly map
* edge cases.
*
* todo(v6): Remove this hack when we update the file format and do translation on loading.
*/
if( !TRANSFORM().MapAngles( &sai, &eai ) )
{
LIB_ARC new_arc( *aArc );
new_arc.SetStart( aArc->GetEnd() );
new_arc.SetEnd( aArc->GetStart() );
new_arc.CalcRadiusAngles();
sai = new_arc.GetFirstRadiusAngle();
eai = new_arc.GetSecondRadiusAngle();
TRANSFORM().MapAngles( &sai, &eai );
}
double sa = (double) sai * M_PI / 1800.0;
double ea = (double) eai * M_PI / 1800.0 ;
@@ -539,7 +558,6 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool aIsDangling, bool isMovi
VECTOR2I p0, dir;
int len = aPin->GetLength();
int width = aPin->GetPenSize();
int shape = aPin->GetShape();
int orient = aPin->GetOrientation();
switch( orient )
@@ -575,76 +593,10 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool aIsDangling, bool isMovi
const int diam = radius*2;
const int clock_size = InternalPinDecoSize( *aPin );
if( shape == PINSHAPE_INVERTED )
{
m_gal->DrawCircle( p0 + dir * radius, radius );
m_gal->DrawLine( p0 + dir * ( diam ), pos );
}
else if( shape == PINSHAPE_FALLING_EDGE_CLOCK )
{
pc = p0 + dir * clock_size ;
triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
pc,
p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
m_gal->DrawLine( pos, pc );
}
else
if( aPin->GetType() == PIN_NC ) // Draw a N.C. symbol
{
m_gal->DrawLine( p0, pos );
}
if( shape == PINSHAPE_CLOCK )
{
if (!dir.y)
{
triLine( p0 + VECTOR2D( 0, clock_size ),
p0 + VECTOR2D( -dir.x * clock_size, 0 ),
p0 + VECTOR2D( 0, -clock_size ) );
}
else
{
triLine( p0 + VECTOR2D( clock_size, 0 ),
p0 + VECTOR2D( 0, -dir.y * clock_size ),
p0 + VECTOR2D( -clock_size, 0 ) );
}
}
if( shape == PINSHAPE_INPUT_LOW )
{
if(!dir.y)
{
triLine( p0 + VECTOR2D(dir.x, 0) * diam,
p0 + VECTOR2D(dir.x, -1) * diam,
p0 );
}
else /* MapX1 = 0 */
{
triLine( p0 + VECTOR2D( 0, dir.y) * diam,
p0 + VECTOR2D(-1, dir.y) * diam,
p0 );
}
}
if( shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
{
if( !dir.y ) // Horizontal pin
m_gal->DrawLine( p0 - VECTOR2D( 0, diam ), p0 + VECTOR2D( dir.x, 0 ) * diam );
else // Vertical pin
m_gal->DrawLine( p0 - VECTOR2D( diam, 0 ), p0 + VECTOR2D( 0, dir.y ) * diam );
}
if( shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
{
m_gal->DrawLine( p0 - VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius,
p0 + VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius );
m_gal->DrawLine( p0 - VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius,
p0 + VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius );
}
if( aPin->GetType() == PIN_NC ) // Draw a N.C. symbol
{
m_gal->DrawLine( pos + VECTOR2D( -1, -1 ) * TARGET_PIN_RADIUS,
pos + VECTOR2D( 1, 1 ) * TARGET_PIN_RADIUS );
m_gal->DrawLine( pos + VECTOR2D( 1, -1 ) * TARGET_PIN_RADIUS ,
@@ -652,6 +604,107 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool aIsDangling, bool isMovi
aIsDangling = false; // PIN_NC pin type is always not connected and dangling.
}
else
{
switch( aPin->GetShape() )
{
case PINSHAPE_LINE:
m_gal->DrawLine( p0, pos );
break;
case PINSHAPE_INVERTED:
m_gal->DrawCircle( p0 + dir * radius, radius );
m_gal->DrawLine( p0 + dir * ( diam ), pos );
break;
case PINSHAPE_INVERTED_CLOCK:
pc = p0 - dir * clock_size ;
triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
pc,
p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
m_gal->DrawCircle( p0 + dir * radius, radius );
m_gal->DrawLine( p0 + dir * ( diam ), pos );
break;
case PINSHAPE_CLOCK_LOW:
case PINSHAPE_FALLING_EDGE_CLOCK:
pc = p0 - dir * clock_size ;
triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
pc,
p0 + VECTOR2D( -dir.y, dir.x) * clock_size );
if(!dir.y)
{
triLine( p0 + VECTOR2D(dir.x, 0) * diam,
p0 + VECTOR2D(dir.x, -1) * diam,
p0 );
}
else /* MapX1 = 0 */
{
triLine( p0 + VECTOR2D( 0, dir.y) * diam,
p0 + VECTOR2D(-1, dir.y) * diam,
p0 );
}
m_gal->DrawLine( p0, pos );
break;
case PINSHAPE_CLOCK:
m_gal->DrawLine( p0, pos );
if (!dir.y)
{
triLine( p0 + VECTOR2D( 0, clock_size ),
p0 + VECTOR2D( -dir.x * clock_size, 0 ),
p0 + VECTOR2D( 0, -clock_size ) );
}
else
{
triLine( p0 + VECTOR2D( clock_size, 0 ),
p0 + VECTOR2D( 0, -dir.y * clock_size ),
p0 + VECTOR2D( -clock_size, 0 ) );
}
break;
case PINSHAPE_INPUT_LOW:
m_gal->DrawLine( p0, pos );
if(!dir.y)
{
triLine( p0 + VECTOR2D(dir.x, 0) * diam,
p0 + VECTOR2D(dir.x, -1) * diam,
p0 );
}
else /* MapX1 = 0 */
{
triLine( p0 + VECTOR2D( 0, dir.y) * diam,
p0 + VECTOR2D(-1, dir.y) * diam,
p0 );
}
break;
case PINSHAPE_OUTPUT_LOW: // IEEE symbol "Active Low Output"
m_gal->DrawLine( p0, pos );
if( !dir.y ) // Horizontal pin
m_gal->DrawLine( p0 - VECTOR2D( 0, diam ), p0 + VECTOR2D( dir.x, 0 ) * diam );
else // Vertical pin
m_gal->DrawLine( p0 - VECTOR2D( diam, 0 ), p0 + VECTOR2D( 0, dir.y ) * diam );
break;
case PINSHAPE_NONLOGIC: // NonLogic pin symbol
m_gal->DrawLine( p0, pos );
m_gal->DrawLine( p0 - VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius,
p0 + VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius );
m_gal->DrawLine( p0 - VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius,
p0 + VECTOR2D( dir.x - dir.y, dir.x + dir.y ) * radius );
break;
}
}
if( aIsDangling && ( aPin->IsVisible() || aPin->IsPowerConnection() ) )
drawPinDanglingSymbol( m_gal, pos, color );
+12
View File
@@ -1607,6 +1607,18 @@ int SCH_SCREENS::ChangeSymbolLibNickname( const wxString& aFrom, const wxString&
}
bool SCH_SCREENS::HasSchematic( const wxString& aSchematicFileName )
{
for( const SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
{
if( screen->GetFileName() == aSchematicFileName )
return true;
}
return false;
}
void SCH_SCREENS::BuildClientSheetPathList()
{
SCH_SHEET_LIST sheetList( g_RootSheet );
+11
View File
@@ -622,6 +622,17 @@ public:
*/
int ChangeSymbolLibNickname( const wxString& aFrom, const wxString& aTo );
/**
* Check if one of the schematics in the list of screens is \a aSchematicFileName.
*
* Schematic file names in SCH_SCREEN object are stored with the absolute path to
* the schematic file.
*
* @param aSchematicFileName is the schematic file name to search.
* @return true if the a schematic matching the file name has been found.
*/
bool HasSchematic( const wxString& aSchematicFileName );
/**
* built the list of sheet paths sharing a screen for each screen in use
*/
+12 -1
View File
@@ -45,6 +45,8 @@
#include <netlist_object.h>
#include <trace_helpers.h>
#include <wx/debug.h>
extern void IncrementLabelMember( wxString& name, int aIncrement );
@@ -251,7 +253,10 @@ void SCH_TEXT::SetLabelSpinStyle( int aSpinStyle )
switch( aSpinStyle )
{
default:
case 0: // Horiz Normal Orientation (left justified)
wxASSERT_MSG( 1, "Bad spin style" );
case 0: // Horiz Normal Orientation
//
m_spin_style = 0; // Handle the error spin style by resetting
SetTextAngle( TEXT_ANGLE_HORIZ );
SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
@@ -773,7 +778,10 @@ void SCH_GLOBALLABEL::SetLabelSpinStyle( int aSpinStyle )
switch( aSpinStyle )
{
default:
wxASSERT_MSG( 1, "Bad spin style" );
case 0: // Horiz Normal Orientation
//
m_spin_style = 0; // Handle the error spin style by resetting
SetTextAngle( TEXT_ANGLE_HORIZ );
SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
@@ -1037,7 +1045,10 @@ void SCH_HIERLABEL::SetLabelSpinStyle( int aSpinStyle )
switch( aSpinStyle )
{
default:
wxASSERT_MSG( 1, "Bad spin style" );
case 0: // Horiz Normal Orientation
//
m_spin_style = 0; // Handle the error spin style by resetting
SetTextAngle( TEXT_ANGLE_HORIZ );
SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
+4 -1
View File
@@ -203,7 +203,10 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_BREAK_WIRE:
SaveWireImage();
m_canvas->MoveCursorToCrossHair();
BreakSegments( GetCrossHairPosition() );
if( BreakSegments( GetCrossHairPosition() ) &&
screen->IsJunctionNeeded( GetCrossHairPosition(), true ) )
AddJunction( GetCrossHairPosition(), true );
TestDanglingEnds();
m_canvas->Refresh();
+525 -67
View File
@@ -38,8 +38,484 @@
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <sch_view.h>
#include <symbol_lib_table.h>
#include <dialogs/dialog_sch_sheet_props.h>
#include <dialogs/dialog_sch_edit_sheet_pin.h>
#include <tool/actions.h>
bool SCH_EDIT_FRAME::checkSheetForRecursion( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
{
wxASSERT( aSheet && aHierarchy );
wxString msg;
SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the full schematic sheet hierarchy.
SCH_SHEET_LIST sheetHierarchy( aSheet ); // This is the hierarchy of the loaded file.
wxFileName destFile = aHierarchy->LastScreen()->GetFileName();
// SCH_SCREEN object file paths are expected to be absolute. If this assert fires,
// something is seriously broken.
wxASSERT( destFile.IsAbsolute() );
if( hierarchy.TestForRecursion( sheetHierarchy, destFile.GetFullPath() ) )
{
msg.Printf( _( "The sheet changes cannot be made because the destination sheet already "
"has the sheet \"%s\" or one of it's subsheets as a parent somewhere in "
"the schematic hierarchy." ),
destFile.GetFullPath() );
DisplayError( this, msg );
return true;
}
return false;
}
bool SCH_EDIT_FRAME::checkForNoFullyDefinedLibIds( SCH_SHEET* aSheet )
{
wxASSERT( aSheet && aSheet->GetScreen() );
wxString msg;
SCH_SCREENS newScreens( aSheet );
if( newScreens.HasNoFullyDefinedLibIds() )
{
msg.Printf( _( "The schematic \"%s\" has not had it's symbol library links remapped "
"to the symbol library table. The project this schematic belongs to "
"must first be remapped before it can be imported into the current "
"project." ), aSheet->GetScreen()->GetFileName() );
DisplayInfoMessage( this, msg );
return true;
}
return false;
}
void SCH_EDIT_FRAME::InitSheet( SCH_SHEET* aSheet, const wxString& aNewFilename )
{
aSheet->SetScreen( new SCH_SCREEN( &Kiway() ) );
aSheet->GetScreen()->SetModify();
aSheet->GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
aSheet->GetScreen()->SetFileName( aNewFilename );
}
bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
const wxString& aFileName )
{
wxASSERT( aSheet && aHierarchy );
int i;
wxString msg;
wxString topLevelSheetPath;
wxFileName tmp;
wxFileName currentSheetFileName;
bool libTableChanged = false;
SCH_SCREEN* currentScreen = aHierarchy->LastScreen();
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
std::unique_ptr< SCH_SHEET> newSheet( new SCH_SHEET );
wxFileName fileName( aFileName );
if( !fileName.IsAbsolute() )
{
wxCHECK_MSG( fileName.MakeAbsolute(), false,
wxString::Format( "Cannot make file name \"%s\" path absolute.",
aFileName ) );
}
wxString fullFilename = fileName.GetFullPath();
try
{
if( aSheet->GetScreen() != nullptr )
{
newSheet.reset( pi->Load( fullFilename, &Kiway() ) );
}
else
{
newSheet->SetFileName( fullFilename );
pi->Load( fullFilename, &Kiway(), newSheet.get() );
}
if( !pi->GetError().IsEmpty() )
{
msg = _( "The entire schematic could not be loaded. Errors occurred attempting "
"to load hierarchical sheet schematics." );
wxMessageDialog msgDlg1( this, msg, _( "Schematic Load Error" ),
wxOK | wxCANCEL | wxCANCEL_DEFAULT |
wxCENTER | wxICON_QUESTION );
msgDlg1.SetOKLabel( wxMessageDialog::ButtonLabel( _( "Use partial schematic" ) ) );
msgDlg1.SetExtendedMessage( pi->GetError() );
if( msgDlg1.ShowModal() == wxID_CANCEL )
return false;
}
}
catch( const IO_ERROR& ioe )
{
msg.Printf( _( "Error occurred loading schematic file \"%s\"." ), fullFilename );
DisplayErrorMessage( this, msg, ioe.What() );
msg.Printf( _( "Failed to load schematic \"%s\"" ), fullFilename );
AppendMsgPanel( wxEmptyString, msg, CYAN );
return false;
}
tmp = fileName;
// If the loaded schematic is in a different folder from the current project and
// it contains hierarchical sheets, the hierarchical sheet paths need to be updated.
if( fileName.GetPath( wxPATH_GET_SEPARATOR ) != Prj().GetProjectPath()
&& newSheet->CountSheets() )
{
// Give the user the option to choose relative path if possible.
if( tmp.MakeRelativeTo( Prj().GetProjectPath() ) )
{
wxMessageDialog msgDlg2(
this,
"Do you want to use a relative path to the loaded "
"schematic?", "Select Path Type",
wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxICON_QUESTION | wxCENTER );
msgDlg2.SetYesNoLabels( wxMessageDialog::ButtonLabel( "Use Relative Path" ),
wxMessageDialog::ButtonLabel( "Use Absolute Path" ) );
int rsp = msgDlg2.ShowModal();
if( rsp == wxID_CANCEL )
{
return false;
}
else if( rsp == wxID_NO )
{
topLevelSheetPath = fileName.GetPathWithSep();
}
else
{
topLevelSheetPath = tmp.GetPathWithSep();
}
}
else
{
topLevelSheetPath = tmp.GetPathWithSep();
}
if( wxFileName::GetPathSeparator() == '\\' )
topLevelSheetPath.Replace( "\\", "/" );
}
// Make sure any new sheet changes do not cause any recursion issues.
SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the schematic sheet hierarchy.
SCH_SHEET_LIST sheetHierarchy( newSheet.get() ); // This is the hierarchy of the loaded file.
if( checkSheetForRecursion( newSheet.get(), aHierarchy )
|| checkForNoFullyDefinedLibIds( newSheet.get() ) )
return false;
// Make a valiant attempt to warn the user of all possible scenarios where there could
// be broken symbol library links.
wxArrayString names;
wxArrayString newLibNames;
SCH_SCREENS newScreens( newSheet.get() ); // All screens associated with the import.
SCH_SCREENS prjScreens( g_RootSheet );
newScreens.GetLibNicknames( names );
wxMessageDialog::ButtonLabel okButtonLabel( _( "Continue Load" ) );
wxMessageDialog::ButtonLabel cancelButtonLabel( _( "Cancel Load" ) );
if( fileName.GetPath( wxPATH_GET_SEPARATOR ) == Prj().GetProjectPath()
&& !prjScreens.HasSchematic( fullFilename ) )
{
// A schematic in the current project path that isn't part of the current project.
// It's possible the user copied this schematic from another project so the library
// links may not be avaible. Even this is check is no guarantee that all symbol
// library links are valid but it's better than nothing.
for( const auto& name : names )
{
if( !Prj().SchSymbolLibTable()->HasLibrary( name ) )
newLibNames.Add( name );
}
if( !newLibNames.IsEmpty() )
{
msg = _( "There are library names in the loaded schematic that are missing "
"from the project library table. This may result in broken symbol "
"library links for the loaded schematic. Do you wish to continue?" );
wxMessageDialog msgDlg3( this, msg, _( "Continue Load Schematic" ),
wxOK | wxCANCEL | wxCANCEL_DEFAULT |
wxCENTER | wxICON_QUESTION );
msgDlg3.SetOKCancelLabels( okButtonLabel, cancelButtonLabel );
if( msgDlg3.ShowModal() == wxID_CANCEL )
return false;
}
}
else if( fileName.GetPath( wxPATH_GET_SEPARATOR ) != Prj().GetProjectPath() )
{
// A schematic loaded from a path other than the current project path.
// If there are symbol libraries in the imported schematic that are not in the
// symbol library table of this project, there could be a lot of broken symbol
// library links. Attempt to add the missing libraries to the project symbol
// library table.
wxArrayString duplicateLibNames;
for( const auto& name : names )
{
if( !Prj().SchSymbolLibTable()->HasLibrary( name ) )
newLibNames.Add( name );
else
duplicateLibNames.Add( name );
}
SYMBOL_LIB_TABLE table;
wxFileName symLibTableFn( fileName.GetPath(),
SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
// If there are any new or duplicate libraries, check to see if it's possible that
// there could be any missing libraries that would cause broken symbol library links.
if( !newLibNames.IsEmpty() || !duplicateLibNames.IsEmpty() )
{
if( !symLibTableFn.Exists() || !symLibTableFn.IsFileReadable() )
{
msg.Printf( _( "The project library table \"%s\" does not exist or cannot "
"be read. This may result in broken symbol links for the "
"schematic. Do you wish to continue?" ),
fileName.GetFullPath() );
wxMessageDialog msgDlg4( this, msg, _( "Continue Load Schematic" ),
wxOK | wxCANCEL | wxCANCEL_DEFAULT |
wxCENTER | wxICON_QUESTION );
msgDlg4.SetOKCancelLabels( okButtonLabel, cancelButtonLabel );
if( msgDlg4.ShowModal() == wxID_CANCEL )
return false;
}
else
{
try
{
table.Load( symLibTableFn.GetFullPath() );
}
catch( const IO_ERROR& ioe )
{
msg.Printf( _( "An error occurred loading the symbol library table "
"\"%s\"." ),
symLibTableFn.GetFullPath() );
DisplayErrorMessage( NULL, msg, ioe.What() );
return false;
}
}
}
// Check to see if any of the symbol libraries found in the appended schematic do
// not exist in the current project are missing from the appended project symbol
// library table.
if( !newLibNames.IsEmpty() )
{
bool missingLibNames = table.IsEmpty();
if( !missingLibNames )
{
for( const auto& newLibName : newLibNames )
{
if( !table.HasLibrary( newLibName ) )
{
missingLibNames = true;
break;
}
}
}
if( missingLibNames )
{
msg = _( "There are library names in the loaded schematic that are missing "
"from the loaded schematic project library table. This may result "
"in broken symbol library links for the schematic. "
"Do you wish to continue?" );
wxMessageDialog msgDlg5( this, msg, _( "Continue Load Schematic" ),
wxOK | wxCANCEL | wxCANCEL_DEFAULT |
wxCENTER | wxICON_QUESTION );
msgDlg5.SetOKCancelLabels( okButtonLabel, cancelButtonLabel );
if( msgDlg5.ShowModal() == wxID_CANCEL )
return false;
}
}
// The library name already exists in the current project. Check to see if the
// duplicate name is the same library in the current project. If it's not, it's
// most likely that the symbol library links will be broken.
if( !duplicateLibNames.IsEmpty() && !table.IsEmpty() )
{
bool libNameConflict = false;
for( const auto& duplicateLibName : duplicateLibNames )
{
const SYMBOL_LIB_TABLE_ROW* thisRow = nullptr;
const SYMBOL_LIB_TABLE_ROW* otherRow = nullptr;
if( Prj().SchSymbolLibTable()->HasLibrary( duplicateLibName ) )
thisRow = Prj().SchSymbolLibTable()->FindRow( duplicateLibName );
if( table.HasLibrary( duplicateLibName ) )
otherRow = table.FindRow( duplicateLibName );
// It's in the global library table so there is no conflict.
if( thisRow && !otherRow )
continue;
if( !thisRow || !otherRow )
continue;
wxFileName otherUriFileName;
wxString thisURI = thisRow->GetFullURI( true );
wxString otherURI = otherRow->GetFullURI( false);
if( otherURI.Contains( "${KIPRJMOD}" ) || otherURI.Contains( "$(KIPRJMOD)" ) )
{
// Cannot use relative paths here, "${KIPRJMOD}../path-to-cache-lib" does
// not expand to a valid symbol library path.
otherUriFileName.SetPath( fileName.GetPath() );
otherUriFileName.SetFullName( otherURI.AfterLast( '}' ) );
otherURI = otherUriFileName.GetFullPath();
}
if( thisURI != otherURI )
{
libNameConflict = true;
break;
}
}
if( libNameConflict )
{
msg = _( "A duplicate library name that references a different library exists "
"in the current library table. This conflict cannot be resolved and "
"may result in broken symbol library links for the schematic. "
"Do you wish to continue?" );
wxMessageDialog msgDlg6( this, msg, _( "Continue Load Schematic" ),
wxOK | wxCANCEL | wxCANCEL_DEFAULT |
wxCENTER | wxICON_QUESTION );
msgDlg6.SetOKCancelLabels( okButtonLabel, cancelButtonLabel );
if( msgDlg6.ShowModal() == wxID_CANCEL )
return false;
}
}
// All (most?) of the possible broken symbol library link cases are covered. Map the
// new appended schematic project symbol library table entries to the current project
// symbol library table.
if( !newLibNames.IsEmpty() && !table.IsEmpty() )
{
for( const auto& libName : newLibNames )
{
if( !table.HasLibrary( libName )
|| Prj().SchSymbolLibTable()->HasLibrary( libName ) )
continue;
// Don't expand environment variable because KIPRJMOD will not be correct
// for a different project.
wxString uri = table.GetFullURI( libName, false );
wxFileName newLib;
if( uri.Contains( "${KIPRJMOD}" ) || uri.Contains( "$(KIPRJMOD)" ) )
{
// Cannot use relative paths here, "${KIPRJMOD}../path-to-cache-lib" does
// not expand to a valid symbol library path.
newLib.SetPath( fileName.GetPath() );
newLib.SetFullName( uri.AfterLast( '}' ) );
uri = newLib.GetFullPath();
}
else
{
uri = table.GetFullURI( libName );
}
// Add the library from the imported project to the current project
// symbol library table.
const SYMBOL_LIB_TABLE_ROW* row = table.FindRow( libName );
auto newRow = new SYMBOL_LIB_TABLE_ROW( libName, uri, row->GetType(),
row->GetOptions(), row->GetDescr() );
Prj().SchSymbolLibTable()->InsertRow( newRow );
libTableChanged = true;
}
}
}
// Check for duplicate sheet names in the current page.
wxArrayString duplicateSheetNames;
SCH_TYPE_COLLECTOR sheets;
sheets.Collect( currentScreen->GetDrawItems(), SCH_COLLECTOR::SheetsOnly );
for( i = 0; i < sheets.GetCount(); ++i )
{
if( newSheet->GetScreen()->GetSheet( ( ( SCH_SHEET* ) sheets[i] )->GetName() ) )
duplicateSheetNames.Add( ( ( SCH_SHEET* ) sheets[i] )->GetName() );
}
if( !duplicateSheetNames.IsEmpty() )
{
msg.Printf( "Duplicate sheet names exist on the current page. Do you want to "
"automatically rename the duplicate sheet names?" );
if( !IsOK( this, msg ) )
return false;
}
// Rename all duplicate sheet names.
SCH_SCREEN* newScreen = newSheet->GetScreen();
wxCHECK_MSG( newScreen, false, "No screen defined for sheet." );
for( const auto& duplicateName : duplicateSheetNames )
{
SCH_SHEET* renamedSheet = newScreen->GetSheet( duplicateName );
wxCHECK2_MSG( renamedSheet, continue,
"Sheet " + duplicateName + " not found in imported schematic." );
timestamp_t newtimestamp = GetNewTimeStamp();
renamedSheet->SetTimeStamp( newtimestamp );
renamedSheet->SetName( wxString::Format( "Sheet%8.8lX", (unsigned long) newtimestamp ) );
}
// Set all sheets loaded into the correct sheet file paths.
SCH_TYPE_COLLECTOR newTopLevelSheets;
newTopLevelSheets.Collect( newSheet->GetScreen()->GetDrawItems(), SCH_COLLECTOR::SheetsOnly );
for( i = 0; i < newTopLevelSheets.GetCount(); ++i )
{
SCH_SHEET* tmpSheet = dynamic_cast< SCH_SHEET* >( newTopLevelSheets[i] );
wxCHECK2( tmpSheet != nullptr, continue );
tmpSheet->SetFileName( topLevelSheetPath + tmpSheet->GetFileName() );
}
if( libTableChanged )
Prj().SchSymbolLibTable()->Save( Prj().GetProjectPath() +
SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
// It is finally safe to add or append the imported schematic.
if( aSheet->GetScreen() == nullptr )
aSheet->SetScreen( newScreen );
else
aSheet->GetScreen()->Append( newScreen );
SCH_SCREENS allScreens;
allScreens.ReplaceDuplicateTimeStamps();
SCH_SCREENS screens( aSheet );
screens.UpdateSymbolLinks( true );
return true;
}
bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
@@ -48,8 +524,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
if( aSheet == NULL || aHierarchy == NULL )
return false;
SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the schematic sheet hierarchy.
// Get the new texts
DIALOG_SCH_SHEET_PROPS dlg( this, aSheet );
@@ -60,8 +534,11 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
fileName.SetExt( SchematicFileExtension );
wxString msg;
bool renameFile = false;
bool loadFromFile = false;
bool clearAnnotation = false;
bool restoreSheet = false;
bool isExistingSheet = false;
SCH_SCREEN* useScreen = NULL;
// Relative file names are relative to the path of the current sheet. This allows for
@@ -95,9 +572,9 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
if( aSheet->GetScreen() == NULL ) // New sheet.
if( aSheet->GetScreen() == NULL ) // New sheet.
{
if( useScreen || loadFromFile ) // Load from existing file.
if( useScreen || loadFromFile ) // Load from existing file.
{
clearAnnotation = true;
@@ -111,7 +588,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
return false;
}
else // New file.
else // New file.
{
aSheet->SetScreen( new SCH_SCREEN( &Kiway() ) );
aSheet->GetScreen()->SetModify();
@@ -119,14 +596,15 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
aSheet->GetScreen()->SetFileName( newFilename );
}
}
else // Existing sheet.
else // Existing sheet.
{
bool isUndoable = true;
bool renameFile = false;
wxString replaceMsg;
wxString newMsg;
wxString noUndoMsg;
isExistingSheet = true;
// Changing the filename of a sheet can modify the full hierarchy structure
// and can be not always undoable.
// So prepare messages for user notifications:
@@ -154,7 +632,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
// Sheet file name changes cannot be undone.
isUndoable = false;
if( useScreen || loadFromFile ) // Load from existing file.
if( useScreen || loadFromFile ) // Load from existing file.
{
clearAnnotation = true;
@@ -166,7 +644,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
if( loadFromFile )
aSheet->SetScreen( NULL );
}
else // Save to new file name.
else // Save to new file name.
{
if( aSheet->GetScreenCount() > 1 )
{
@@ -222,43 +700,55 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
wxFileName userFileName = dlg.GetFileName();
userFileName.SetExt( SchematicFileExtension );
aSheet->SetFileName( userFileName.GetFullPath( wxPATH_UNIX ) );
if( useScreen )
{
aSheet->SetScreen( useScreen );
}
else if( loadFromFile )
{
try
{
aSheet = pi->Load( newFilename, &Kiway(), aSheet );
// Create a temporary sheet for recursion testing to prevent a possible recursion error.
std::unique_ptr< SCH_SHEET> tmpSheet( new SCH_SHEET );
tmpSheet->SetName( dlg.GetSheetName() );
tmpSheet->SetFileName( userFileName.GetFullPath() );
tmpSheet->SetScreen( useScreen );
if( !pi->GetError().IsEmpty() )
{
DisplayErrorMessage( this,
_( "The entire schematic could not be loaded.\n"
"Errors occurred loading hierarchical sheets." ),
pi->GetError() );
}
}
catch( const IO_ERROR& ioe )
// No need to check for valid library IDs if we are using an existing screen.
if( checkSheetForRecursion( tmpSheet.get(), aHierarchy ) )
{
msg.Printf( _( "Error occurred loading schematic file \"%s\"." ), newFilename );
DisplayErrorMessage( this, msg, ioe.What() );
msg.Printf( _( "Failed to load schematic \"%s\"" ), newFilename );
AppendMsgPanel( wxEmptyString, msg, CYAN );
if( restoreSheet )
aHierarchy->LastScreen()->Append( aSheet );
return false;
}
SCH_SCREEN* screen = aSheet->GetScreen();
// It's safe to set the sheet screen now.
aSheet->SetScreen( useScreen );
}
else if( loadFromFile )
{
if( isExistingSheet )
{
// Temporarily remove the sheet from the current schematic page so that recursion
// and symbol library link tests can be performed with the modified sheet settings.
restoreSheet = true;
aHierarchy->LastScreen()->Remove( aSheet );
}
if( screen )
screen->UpdateSymbolLinks( true );
if( !LoadSheetFromFile( aSheet, aHierarchy, newFilename ) )
{
if( restoreSheet )
aHierarchy->LastScreen()->Append( aSheet );
return false;
}
if( restoreSheet )
aHierarchy->LastScreen()->Append( aSheet );
}
wxString tmpFn = userFileName.GetFullPath();
if( wxFileName::GetPathSeparator() == '\\' )
tmpFn.Replace( "\\", "/" );
aSheet->SetFileName( tmpFn );
aSheet->SetFileNameSize( dlg.GetFileNameTextSize() );
aSheet->SetName( dlg.GetSheetName() );
aSheet->SetSheetNameSize( dlg.GetSheetNameTextSize() );
@@ -267,38 +757,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ),
(long unsigned) aSheet->GetTimeStamp() ) );
// Make sure the sheet changes do not cause any recursion.
SCH_SHEET_LIST sheetHierarchy( aSheet );
// Make sure files have fully qualified path and file name.
wxFileName destFn = aHierarchy->Last()->GetFileName();
if( destFn.IsRelative() )
destFn.MakeAbsolute( Prj().GetProjectPath() );
if( hierarchy.TestForRecursion( sheetHierarchy, destFn.GetFullPath( wxPATH_UNIX ) ) )
{
msg.Printf( _( "The sheet changes cannot be made because the destination sheet already "
"has the sheet \"%s\" or one of it's subsheets as a parent somewhere in "
"the schematic hierarchy." ),
newFilename );
DisplayError( this, msg );
return false;
}
// Check to make sure the symbols have been remapped to the symbol library table.
SCH_SCREENS newScreens( aSheet );
if( newScreens.HasNoFullyDefinedLibIds() )
{
msg.Printf(_( "The schematic \"%s\" has not been remapped to the symbol\nlibrary table. "
" The project this schematic belongs to must first be remapped\nbefore it "
"can be imported into the current project." ), fileName.GetFullName() );
DisplayInfoMessage( this, msg );
return false;
}
if( aClearAnnotationNewItems )
*aClearAnnotationNewItems = clearAnnotation;
+11 -5
View File
@@ -117,9 +117,9 @@ SIM_TYPE NETLIST_EXPORTER_PSPICE_SIM::GetSimType()
SIM_TYPE NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType( const wxString& aCmd )
{
const std::map<wxString, SIM_TYPE> simCmds = {
{ ".ac", ST_AC }, { ".dc", ST_DC }, { ".disto", ST_DISTORTION }, { ".noise", ST_NOISE },
{ ".op", ST_OP }, { ".pz", ST_POLE_ZERO }, { ".sens", ST_SENSITIVITY }, { ".tf", ST_TRANS_FUNC },
{ ".tran", ST_TRANSIENT }
{ ".ac ", ST_AC }, { ".dc ", ST_DC }, { ".disto ", ST_DISTORTION }, { ".noise ", ST_NOISE },
{ ".op ", ST_OP }, { ".pz ", ST_POLE_ZERO }, { ".sens ", ST_SENSITIVITY }, { ".tf ", ST_TRANS_FUNC },
{ ".tran ", ST_TRANSIENT }
};
wxString lcaseCmd = aCmd.Lower();
@@ -187,8 +187,14 @@ void NETLIST_EXPORTER_PSPICE_SIM::writeDirectives( OUTPUTFORMATTER* aFormatter,
// If we print out .save directives for currents, then it needs to be done for voltages as well
for( const auto& netMap : GetNetIndexMap() )
{
aFormatter->Print( 0, ".save %s\n",
(const char*) GetSpiceVector( netMap.first, SPT_VOLTAGE ).c_str() );
// the "0" and the "GND" nets are automaticallly saved internally by ngspice.
// Skip them
wxString netname = GetSpiceVector( netMap.first, SPT_VOLTAGE );
if( netname == "V(0)" || netname == "V(GND)" )
continue;
aFormatter->Print( 0, ".save %s\n", (const char*) netname.c_str() );
}
if( m_simCommand.IsEmpty() )
+3 -2
View File
@@ -423,10 +423,11 @@ string NGSPICE::findCmPath() const
"/Applications/ngspice/lib/ngspice",
"Contents/Frameworks",
wxStandardPaths::Get().GetPluginsDir() + "/sim/ngspice",
wxFileName( wxStandardPaths::Get().GetExecutablePath() ).GetPath() + "/../../../../../Contents/PlugIns/sim/ngspice"
wxFileName( wxStandardPaths::Get().GetExecutablePath() ).GetPath() + "/../../../../../Contents/PlugIns/sim/ngspice",
"../Plugins/sim/ngspice",
#endif /* __WXMAC__ */
"../lib/ngspice",
"../../lib/ngspice"
"../../lib/ngspice",
"lib/ngspice",
"ngspice"
};
+7 -16
View File
@@ -232,22 +232,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie
break;
case 1:
if( node->LibId == m_libMgr->GetCurrentLibId() )
{
LIB_ALIAS* alias = nullptr;
// When the node parent name is empty, the node is a lib name, not a symbol name
// However should not happen, but happens.
if( !node->Parent->Name.IsEmpty() )
alias = m_libMgr->GetAlias( node->Name, node->Parent->Name );
if( alias )
aVariant = alias->GetDescription();
else
aVariant = node->Desc;
}
else
aVariant = node->Desc;
aVariant = node->Desc;
break;
default: // column == -1 is used for default Compare function
@@ -284,7 +269,10 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
#else
// mark the current library with background color
if( node->Name == m_libMgr->GetCurrentLib() )
{
aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT ) );
}
#endif
break;
@@ -303,7 +291,10 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
#else
// mark the current part with background color
if( node->LibId == m_libMgr->GetCurrentLibId() )
{
aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT ) );
}
#endif
break;
+19 -6
View File
@@ -691,14 +691,27 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PAN
msg = ShowGBRShape();
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
// Display D_Code value with its attributes:
msg.Printf( _( "D Code %d" ), m_DCode );
D_CODE* apertDescr = GetDcodeDescr();
if( !apertDescr || apertDescr->m_AperFunction.IsEmpty() )
text = _( "No attribute" );
// Display D_Code value with its attributes for items using a DCode:
if( m_Shape == GBR_POLYGON ) // Has no DCode, but can have an attribute
{
msg = _( "Attribute" );
if( m_AperFunction.IsEmpty() )
text = _( "No attribute" );
else
text = m_AperFunction;
}
else
text = apertDescr->m_AperFunction;
{
msg.Printf( _( "D Code %d" ), m_DCode );
D_CODE* apertDescr = GetDcodeDescr();
if( !apertDescr || apertDescr->m_AperFunction.IsEmpty() )
text = _( "No attribute" );
else
text = apertDescr->m_AperFunction;
}
aList.push_back( MSG_PANEL_ITEM( msg, text, RED ) );
+7 -2
View File
@@ -88,9 +88,14 @@ public:
// Lines : m_Size.x = m_Size.y = line width
bool m_Flashed; // True for flashed items
int m_DCode; // DCode used to draw this item.
// 0 for items that do not use DCodes (polygons)
// or when unknown and normal values are 10 to 999
// Allowed values are >= 10. 0 when unknown
// values 0 to 9 can be used for special purposes
// Regions (polygons) doo not use DCode,
// so it is set to 0
wxString m_AperFunction; // the aperture function set by a %TA.AperFunction, xxx
// (stores thre xxx value).
// used for regions that do not have a attached DCode, but
// have a TA.AperFunction defined
GERBER_FILE_IMAGE* m_GerberImageFile; /* Gerber file image source of this item
* Note: some params stored in this class are common
* to the whole gerber file (i.e) the whole graphic
+2
View File
@@ -226,6 +226,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_canvas->Refresh();
}
m_canvasType = GetGalCanvas()->GetBackend();
// Enable the axes to match legacy draw style
auto& galOptions = GetGalDisplayOptions();
galOptions.m_axesEnabled = true;
+2
View File
@@ -74,6 +74,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName )
dlg.ShowModal();
}
#if 0 // Outdated warning
/* if the gerber file is only a RS274D file
* (i.e. without any aperture information, but with items), warn the user:
*/
@@ -84,6 +85,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName )
"Therefore the size of items is undefined");
wxMessageBox( msg );
}
#endif
auto canvas = GetGalCanvas();
+9
View File
@@ -619,6 +619,14 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
m_Drawings.Append( gbritem );
gbritem->m_Shape = GBR_POLYGON;
gbritem->m_Flashed = false;
gbritem->m_DCode = 0; // No DCode for a Polygon (Region in Gerber dialect)
if( gbritem->m_GerberImageFile )
{
gbritem->SetNetAttributes( gbritem->m_GerberImageFile->m_NetAttributeDict );
gbritem->m_AperFunction = gbritem->m_GerberImageFile->m_AperFunction;
}
}
switch( m_Iterpolation )
@@ -676,6 +684,7 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
m_Exposure = true;
tool = GetDCODE( m_Current_Tool );
if( tool )
{
size = tool->m_Size;
+1 -1
View File
@@ -726,7 +726,7 @@ void GERBVIEW_SELECTION_TOOL::select( EDA_ITEM* aItem )
}
m_selection.Add( aItem );
getView()->Add( &m_selection );
getView()->Add( &m_selection, std::numeric_limits<int>::max() );
selectVisually( aItem );
if( m_selection.Size() == 1 )
+80 -15
View File
@@ -46,13 +46,15 @@ class EDA_RECT
private:
wxPoint m_Pos; // Rectangle Origin
wxSize m_Size; // Rectangle Size
bool m_init; // Is the rectangle initialized
public:
EDA_RECT() { };
EDA_RECT() : m_init( false ) { };
EDA_RECT( const wxPoint& aPos, const wxSize& aSize ) :
m_Pos( aPos ),
m_Size( aSize )
m_Size( aSize ),
m_init( true )
{ }
virtual ~EDA_RECT() { };
@@ -121,20 +123,83 @@ public:
int GetTop() const { return m_Pos.y; }
int GetBottom() const { return m_Pos.y + m_Size.y; } // Y axis from top to bottom
void SetOrigin( const wxPoint& pos ) { m_Pos = pos; }
void SetOrigin( int x, int y ) { m_Pos.x = x; m_Pos.y = y; }
void SetSize( const wxSize& size ) { m_Size = size; }
void SetSize( int w, int h ) { m_Size.x = w; m_Size.y = h; }
void Offset( int dx, int dy ) { m_Pos.x += dx; m_Pos.y += dy; }
void Offset( const wxPoint& offset ) { m_Pos += offset; }
void SetX( int val ) { m_Pos.x = val; }
void SetY( int val ) { m_Pos.y = val; }
void SetWidth( int val ) { m_Size.x = val; }
void SetHeight( int val ) { m_Size.y = val; }
void SetEnd( int x, int y ) { SetEnd( wxPoint( x, y ) ); }
void SetEnd( const wxPoint& pos )
bool IsValid() const
{
m_Size.x = pos.x - m_Pos.x; m_Size.y = pos.y - m_Pos.y;
return m_init;
}
void SetOrigin( const wxPoint &pos )
{
m_Pos = pos;
m_init = true;
}
void SetOrigin( int x, int y )
{
m_Pos.x = x;
m_Pos.y = y;
m_init = true;
}
void SetSize( const wxSize &size )
{
m_Size = size;
m_init = true;
}
void SetSize( int w, int h )
{
m_Size.x = w;
m_Size.y = h;
m_init = true;
}
void Offset( int dx, int dy )
{
m_Pos.x += dx;
m_Pos.y += dy;
}
void Offset( const wxPoint &offset )
{
m_Pos += offset;
}
void SetX( int val )
{
m_Pos.x = val;
m_init = true;
}
void SetY( int val )
{
m_Pos.y = val;
m_init = true;
}
void SetWidth( int val )
{
m_Size.x = val;
m_init = true;
}
void SetHeight( int val )
{
m_Size.y = val;
m_init = true;
}
void SetEnd( int x, int y )
{
SetEnd( wxPoint( x, y ) );
m_init = true;
}
void SetEnd( const wxPoint &pos )
{
m_Size.x = pos.x - m_Pos.x;
m_Size.y = pos.y - m_Pos.y;
m_init = true;
}
/**
+3 -1
View File
@@ -147,10 +147,12 @@ public:
* @param aFootprintNames is the list to fill with the footprint names found in \a aNickname
*
* @param aNickname is a locator for the "library", it is a "name" in LIB_TABLE_ROW.
* @param aBestEfforts if true, don't throw on errors
*
* @throw IO_ERROR if the library cannot be found, or footprint cannot be loaded.
*/
void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aNickname );
void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aNickname,
bool aBestEfforts );
/**
* Generate a hashed timestamp representing the last-mod-times of the library indicated
-10
View File
@@ -39,16 +39,6 @@
#include <memory>
#if defined(__WXMSW__)
#define SCREEN_DEPTH 24
#else
#if wxCHECK_VERSION( 2, 9, 0 )
#define SCREEN_DEPTH wxBITMAP_SCREEN_DEPTH
#else
#define SCREEN_DEPTH 32
#endif
#endif
/**
* @brief Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
*
+1 -1
View File
@@ -42,7 +42,7 @@ namespace KIGFX
{
class GAL;
typedef std::deque< std::deque<VECTOR2D> > GLYPH;
typedef std::vector<std::vector<VECTOR2D>> GLYPH;
typedef std::vector<GLYPH> GLYPH_LIST;
/**
+1 -1
View File
@@ -82,7 +82,7 @@ public:
GBR_APERTURE_ATTRIB_NONE, ///< uninitialized attribute
GBR_APERTURE_ATTRIB_ETCHEDCMP, ///< aperture used for etched components
GBR_APERTURE_ATTRIB_CONDUCTOR, ///< aperture used for connected items like tracks (not vias)
GBR_APERTURE_ATTRIB_CUTOUT, ///< aperture used for board cutout
GBR_APERTURE_ATTRIB_EDGECUT, ///< aperture used for board outlines (edge.cut layer)
GBR_APERTURE_ATTRIB_NONCONDUCTOR, ///< aperture used for not connected items (texts, outlines on copper)
GBR_APERTURE_ATTRIB_VIAPAD, ///< aperture used for vias
GBR_APERTURE_ATTRIB_COMPONENTPAD, ///< aperture used for through hole component on outer layer
+1 -1
View File
@@ -46,7 +46,7 @@ enum HASH_FLAGS
ALL = 0xff
};
/*
/**
* Calculates hash of an EDA_ITEM.
* @param aItem is the item for which the hash will be computed.
* @return Hash value.
+15 -12
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -27,9 +27,10 @@
/**
@file
Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder.
*/
* @file include/html_messagebox.h
*
* Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder.
*/
#include <../common/dialogs/dialog_display_info_HTML_base.h>
@@ -41,10 +42,12 @@ class HTML_MESSAGE_BOX : public DIALOG_DISPLAY_HTML_TEXT_BASE
{
protected:
// Handlers for HTML_MESSAGE_BOX_BASE events.
void OnCloseButtonClick( wxCommandEvent& event ) override;
void OnOKButtonClick( wxCommandEvent& event ) override;
public:
HTML_MESSAGE_BOX( wxWindow* parent, const wxString& aTitle );
HTML_MESSAGE_BOX( wxWindow* aParent, const wxString& aTitle = wxEmptyString,
const wxPoint& aPosition = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize );
~HTML_MESSAGE_BOX() override;
/**
@@ -61,15 +64,15 @@ public:
}
/**
* Function ListSet
* Add a list of items.
*
* @param aList = a string containing items. Items are separated by '\n'
*/
void ListSet( const wxString& aList );
/**
* Function ListSet
* Add a list of items.
*
* @param aList = a wxArrayString containing items.
*/
void ListSet( const wxArrayString& aList );
@@ -77,15 +80,15 @@ public:
void ListClear();
/**
* Function MessageSet
* adds a message (in bold) to message list.
* Add a message (in bold) to message list.
*
* @param message = the message
*/
void MessageSet( const wxString& message );
/**
* Function AddHTML_Text
* adds html text (without any change) to message list.
* Add HTML text (without any change) to message list.
*
* @param message = the text to add
*/
void AddHTML_Text( const wxString& message );
+1 -1
View File
@@ -81,7 +81,7 @@ int ReadDelimitedText( wxString* aDest, const char* aSource );
* @param aString is the input string to convert.
* @return std::string - the escaped input text, without the wrapping double quotes.
*/
std::string EscapedUTF8( const wxString& aString );
std::string EscapedUTF8( wxString aString );
/**
* Return a new wxString escaped for embedding in HTML.
+9
View File
@@ -1135,6 +1135,14 @@ public:
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
double aPadOrient, EDA_DRAW_MODE_T aTraceMode, void* aData ) override;
/**
* Plot a Gerber region: similar to PlotPoly but plot only filled polygon,
* and add the TA.AperFunction if aData contains this attribute, and clear it
* after plotting
*/
void PlotGerberRegion( const std::vector< wxPoint >& aCornerList,
void * aData = NULL );
/**
* Change the plot polarity and begin a new layer
* Used to 'scratch off' silk screen away from solder mask
@@ -1171,6 +1179,7 @@ public:
*/
virtual void EndBlock( void* aData ) override;
protected:
/**
* Pick an existing aperture or create a new one, matching the

Some files were not shown because too many files have changed in this diff Show More