Compare commits

...

173 Commits

Author SHA1 Message Date
Wayne Stambaugh c000d70a51 Tag release version 5.0.1 2018-10-08 17:14:38 -04:00
Seth Hillbrand 234b01905d eeschema: fix mistaken wire removal bug
The wire between two points should not be trimmed if it starts or ends
on one of the component's connection points.

(cherry picked from commit d2906f7975)
2018-10-08 11:35:12 -07:00
Seth Hillbrand a5bdee747a pcbnew: Fix memory leak in Eagle importer
unqiue_ptr release creates a memory leak unless the returned pointer is
freed.

(cherry picked from commit 45d438cd13)
2018-10-08 11:35:05 -07:00
Seth Hillbrand 9977d0d737 pcbnew: fix pad distance calc in gateways
The pad distance was fixed to 0, making the gateway priority set
artificially to 1

(cherry picked from commit 77eeda4191)
2018-10-08 11:34:46 -07:00
Seth Hillbrand 46f7011463 pcbnew: Zone selection heuristic continuity for edge
If the user is carefully selecting the zone edge, we do not filter the
zone preemptively from our disambiguation list in the same manner as we
do for selecting on zone copper.

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

(cherry picked from commit f11cb736e5)
2018-10-08 11:34:38 -07:00
Wayne Stambaugh 876232aa7a Fix LIB_ID illegal character tests.
The '/' and ':' are reserved and cannot be used in symbol or footprint
names.  They will cause the LIB_ID parser and formatter to fail.  While
it seems like they should be legal in symbol alias names, they will
trigger a symbol rescue the next time the schematic is loaded.

Use ID_SCH as in the Eagle schematic plugin rather than ID_ALIAS to
ensure symbol names do not need rescued the next time the schematic is
opened.

Remove ID_ALIAS since the rules for alias names are the same as the
rules for symbol names.  Otherwise, allowing '/' and ':' in alias names
will force a symbol rescue on the next schematic load.

Fixes lp:1795600

https://bugs.launchpad.net/kicad/+bug/1795600
2018-10-07 15:35:16 -04:00
jean-pierre charras 39c38fb386 Fix a side effect of our LOCALE_IO by using setlocale( LC_NUMERIC, "C" ) instead of setlocale( LC_ALL, "C" ) LC_NUMERIC is the right option to use in LOCALE_IO because only the floating point separator must be modified When using LC_ALL, the Env var expansion wxGetEnv() was not working when the env var contains non ascii7 codes after a call to LOCALE_IO. When using setlocale( LC_NUMERIC, "C" ) in LOCALE_IO, wxGetEnv() works fine.
Fixes: lp:1795990
https://bugs.launchpad.net/kicad/+bug/1795990
2018-10-07 16:27:47 +02:00
jean-pierre charras 99f25b0895 Opengl fix: bitmaps having a width not multiple of 4 were incorrectly drawn.
This fix draws a "sub bitmap" having a width multiple of 4.
(The loss of 1 to 3 pixels in horizontal size should be not really noticeable)

(cherry picked from commit 3a02e54411)
2018-10-06 07:22:38 -07:00
Tomasz Wlostowski a43ec3e3f0 OPENGL_GAL: optimized JP's bitmap drawing function to use textures
(cherry picked from commit 516cf47946)
2018-10-06 07:22:38 -07:00
jean-pierre charras 7b596f0365 GAL canvases: add DrawBitmap(), using a basic brute force algo for OpenGL, and a optimized code for Cairo. In this fix the brute force means draw each pixel as a rectangle. It works fine, but could be optimized.
(cherry picked from commit fefc7b8172)
2018-10-06 07:22:38 -07:00
Seth Hillbrand dd22c73666 pcbnew: Allow deselection when clicking on zone
Deselection by clicking on a zone makes working with plane zones easier
by allowing the selected item to de-selected by clicking on a zone.
Once the selection is cleared, the zone may be re-selected as normal.
Clicking on non-zone items while a separate item is selected will still
select the new non-zone item without requiring a second click.
2018-10-06 07:22:35 -07:00
Seth Hillbrand d15b34988d pcbnew: Adjust selection behavior in highlight net
Prefer non-zones in highlight net in the same way we do for the
selection tool.  Highlight net just has separate logic and was missed
previously.
2018-10-05 19:58:25 -07:00
Seth Hillbrand 5e0ef36719 pcbnew: Improve zone/polygon selection
Allows selection of polygons and zones by their visible area.  Will only
select polygons/filled areas when they are unobstructed by other
elements in the footprint/pcb.  Also adds a "skip heuristics" modifier
key for clicking (ALT) that allows the full disambiguation list to be
displayed without removing less-likely elements.  This dovetails the
zone/polygon selection as it allows selecting even when areas a fully
overlapped.

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

(cherry picked from commit 6a6d580a1c)
2018-10-03 07:22:16 -07:00
jean-pierre charras 6994291997 Re activate Zone Unfill All command, accidentally removed by a previous commit.
Fixes: lp:1795293
https://bugs.launchpad.net/kicad/+bug/1795293
2018-10-01 09:05:08 +02:00
Seth Hillbrand 9837d1624f pcbnew: Force at least one connectivity thread
We want to keep at most 1 thread per 2 connectivity updates but we need
to force that floor to be at least 1 for when there is only 1
connectivity update.

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

(cherry picked from commit 89a3d2b451)
2018-09-30 12:14:26 -07:00
Jeff Young 13a41f11eb Don't deselected items that have been deleted.
De-referencing freed memory is never a good idea.

Fixes: lp:1795195
* https://bugs.launchpad.net/kicad/+bug/1795195
2018-09-30 15:46:58 +01:00
Seth Hillbrand 59723ce3ab pcbnew: Handle SEGZONE in GAL
SEGZONEs are no longer created by pcbnew but may exist in older boards.
This allows deleting the old fills in a manner similar to the deletion
in Legacy canvas.

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

(cherry picked from commit ef6f7e96f3)
2018-09-29 15:12:24 -07:00
Seth Hillbrand 79d19d9055 pcbnew: Rename PCB_ZONE_T and remove from connectivity
SEGZONE types were confusingly named PCB_ZONE_T.  Zones in pcbnew are
now _only_ PCB_ZONE_AREA_T, so we name segzone types PCB_SEGZONE_T to be
clear.

This also removes processing of the SEGZONEs from connectivity
calculations.

(cherry picked from commit b3a5e08c2f)
2018-09-29 15:12:21 -07:00
Seth Hillbrand 115f318976 pcbnew: Avoid double-separators in context menu
(cherry picked from commit a81e3c2b13)
2018-09-29 15:10:10 -07:00
jean-pierre charras 51a74b53cb Pcbnew: Crash after running external plugin Happens only in Opengl mode. So enforce controls in 3 group function: DrawGroup, ChangeGroupColor, ChangeGroupDepth.
Fixes: lp:1795044
https://bugs.launchpad.net/kicad/+bug/1795044
2018-09-29 14:19:07 +02:00
John Beard f591f8741a Prevent segfault when undoing or resetting non-hotkey rows
This is caused by:

* Not checking the hotkey data is not null when performing a
  hotkey action
* Allowing hotkey actions on non-hotkey rows.

This fixes both of these, and adds an assert to warn if someone
does manage to fire a hotkey action on a non-hotkey row (but it
won't crash).

This is a ported version of commit 704615721 on the master branch.

Fixes: lp:1794756
* https://bugs.launchpad.net/kicad/+bug/1794756
2018-09-28 10:20:53 -04:00
Jeff Young f56ea6bf3c Don't assume GetFlags() != 0 means it's being edited.
It could just mean it's selected, highlighted or brightened.

Fixes: lp:1794624
* https://bugs.launchpad.net/kicad/+bug/1794624
2018-09-27 22:17:32 +01:00
Seth Hillbrand e3f12ec0d9 pcbnew: Do not allow drag to violate DRC without permission
m_dragstatus is set to true when a valid route is created given the
user's constraints.  We need to check this before committing the route
to the board.

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

(cherry picked from commit 317ca8e64d)
2018-09-27 13:09:40 -07:00
Seth Hillbrand c26311918e pcbnew: Deselect all items in a delete commit at once
Deselecting each individually had the side-effect of possibly re-drawing
the view in between actions, leading to visible artifacts in the router
(where invisible items are set visible before committing a change)

(cherry-picked from commit 491098af35)
(cherry picked from commit 65678b223a)
2018-09-26 09:06:48 -07:00
Jeff Young 1f19903e7e Backport text nanny limits by hand (as other commit was mixed up).
Fixes: lp:1794345
* https://bugs.launchpad.net/kicad/+bug/1794345
2018-09-25 21:13:13 +01:00
Jeff Young 1e223b9027 Don't use nullprt for a dialog's parent.
Fixes: lp:1791561
* https://bugs.launchpad.net/kicad/+bug/1791561

(cherry picked from commit 3f23e9ac46)
2018-09-25 04:41:42 -07:00
Seth Hillbrand 036288d18f pcbnew: Fixup for edde02481 to enable aux axis
Correcting edde02481 which had side effects to
efdbc91e42 while dragging a line but not a
zone.

(cherry picked from commit ee465fb23c)
2018-09-24 14:33:28 -07:00
Seth Hillbrand 8efdcbfaf1 pcbnew: Fix alignment with off-grid drag
Commit efdbc91e42 broken the primary
alignment mechanism for maintaining the current point as an auxilliary
grid reference.  This reverts that commit and fixes both the initial
issue and the associated bug by applying the primary constraint after
the secondary.  In this way, we consider the secondary constraint as an
additive rather than alternative constraint.

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

(cherry picked from commit edde02481e)
2018-09-24 14:08:49 -07:00
Wayne Stambaugh 6c3b4e5824 Pcbnew: change step export dialog action button text.
Change "OK" to "Export" so user is not surprised by the fact that the
dialog does not close after the step file is created..

Fixes lp:1784260

https://bugs.launchpad.net/kicad/+bug/1784260
2018-09-24 14:58:24 -04:00
Seth Hillbrand 9831a14ef3 eeschema: Re-add auto-wire removal
Somewhere during v5 rc cycle, the trimming of wires laid over simple
components was removed.  The wires were still removed as soon as the
user moved the component again.  This corrects the first behavior to
intended action for simple components.

Fixes: lp:1794019
* https://bugs.launchpad.net/kicad/+bug/1794019
2018-09-24 06:38:52 -07:00
Seth Hillbrand f3400e03c6 pcbnew: fix temp var type 2018-09-24 06:38:52 -07:00
Jeff Young 04e699f789 Show pads when parent footprint is selected.
Fixes: lp:1670090
* https://bugs.launchpad.net/kicad/+bug/1670090

(cherry picked from commit 66848b9334)
2018-09-24 06:38:52 -07:00
Seth Hillbrand 9e61ebfb0b pcbnew: Standardize zone fills threading
This is a boyscouting commit to standardize the threading of zone fills.
We do not need to join threads after their completion, instead we simply
allow them to clean up their memory without blocking the user.  This
also sets the maximum number of threads that may be created to the
number of zones being filled.  More than this will only leave un-used
threads being created and immediately killed.

We also include the connectivity search as a phase in the fill progress
reporter.  This was the case before but did not utilize the correct
maxsize, leading to stalled progress bar.

(cherry picked from commit 969e85daa3)
2018-09-24 06:38:52 -07:00
Seth Hillbrand 9e355c29f1 Removing OpenMP
This commit finishes the removal of OpenMP from the KiCad codebase.
Removed in this commit are the OpenMP calls in 3d-viewer and
qa/polygon_triangulation as well as all references in CMakeLists.txt

std::thread is used instead for multithreaded computation
(cherry picked from commit f8784f30a8)
2018-09-24 06:38:52 -07:00
Seth Hillbrand 5ce0c2065c pcbnew: Cancel highlight with ESC
When editing the pcb, Ctrl-Click will highlight a net.  This allows
de-highlight with the ESC/cancel action from the selection tool.  Inside
the highlight tool, ESC reverts to the selection tool while keeping the
net highlighted.

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

(cherry picked from commit 518b53f78c)
2018-09-24 06:38:52 -07:00
Wayne Stambaugh 3f58dce1de Eeschema: fix yet another lock file issues.
Reset lock file when saving a schematic sheet to a different file name.
This prevents a file is already open error from being displayed when
opening the original file.

Fixes lp:1788507

https://bugs.launchpad.net/kicad/+bug/1788507
2018-09-24 09:00:11 -04:00
Seth Hillbrand c5c89fd216 pcbnew: Prevent redo while moving items
Fixes: lp:1793948
* https://bugs.launchpad.net/kicad/+bug/1793948
2018-09-23 06:02:50 -07:00
Jeff Young 1820e81f5e Don't allow drawing to a zero-height or zero-width GAL canvas.
Fixes: lp:1793913
* https://bugs.launchpad.net/kicad/+bug/1793913

(cherry picked from commit 0309228276)
2018-09-22 22:10:49 +01:00
Maciej Suminski 4fcd80eda1 Spice simulator: change gain units to dBV
(cherry-picked from commit 85ef0584)
2018-09-22 20:08:13 +02:00
Seth Hillbrand e7a9643b37 kicad2step: Provide floats separated
Clang++ seems to be in left-field here as it processes a stringstream
1.0X1.0 >> double as a hexadecimal floating point ('X' character) and
throws an error rather than converting 1.0 and stopping when it reaches
a non-numeric character.  This causes errors when exporting step on Mac,
which uses clang++ by default.

Adding spaces to the string is more explicit and doesn't break gcc.  It
will be sufficient until we get rid of kicad2step as an external
utility.

Fixes: lp:1778564
* https://bugs.launchpad.net/kicad/+bug/1778564
2018-09-22 08:52:05 -07:00
Wayne Stambaugh 3e28ac9c7c Pcbnew: fix lock file bug.
The lock file code would reset the lock file every other time the same
board file was opened in Pcbnew in the stand alone mode.  This created
the perfect toggle switch causing the board to be reloaded every other
time the same board was selected.

Fixes lp:1777599

https://bugs.launchpad.net/kicad/+bug/1777599
2018-09-22 09:12:16 -04:00
Seth Hillbrand 4c37defd35 pcbnew: Remove OpenMP
OpenMP is not available for macos, so moving to a std::threads
implementation brings platforms into shared code.

This also reduces the OpenMP overhead when computing connectivity and
ratsnests.

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

(cherry picked from commit c0f067bf90)
2018-09-20 16:48:08 -07:00
Seth Hillbrand a4564db082 Removing some unused code
(cherry picked from commit 47fac8a259)
2018-09-20 16:47:59 -07:00
Martin Aberg dd3c24faf8 Generate PYTHONPATH from CMake information
The CMake scripts calculate the install path for python scripts by
  distutils.sysconfig.get_python_lib(
    plat_specific=0,
    standard_lib=0,
    prefix=''
  )
which generates a string in line with
  lib/python2.7/site-packages

This string ends up in the CMake variable PYTHON_DEST and is used by the
install step as destination directory for pcbnew.py.

There has been a hard-coded assumption on the content of that string in
PcbNew which is not compatible with FreeBSD 11.1.

This commit eliminates the hard-coded assumption in PcbNew and reuses
the install path as known by CMake.

Fixes: lp:1777921
* https://bugs.launchpad.net/kicad/+bug/1777921
2018-09-20 12:03:25 -07:00
Seth Hillbrand 0a9aedda8b 3d-viewer: Require simplified polygons
3d viewer requires simplified polygons not just for triangulation but
also for its own internal routines.

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

(cherry picked from commit 8999f4604f)
2018-09-20 10:12:30 -07:00
Seth Hillbrand 48b4a897af pcbnew: Limit zone simplification
Commit 73c229714 was a bit of a sledgehammer for the associated problem
of degenerate points.  This commit replaces that one by only performing
additional simplification of the zone polygons on those polygons that
fail our initial triangulation attempt.

(cherry picked from commit 3ebba6cbe1)
2018-09-20 10:12:30 -07:00
Seth Hillbrand 4c409fbac9 triangulation: Fracture/Simplify all polygons
Calls the simplify/fracture polygon code on any polygon prior to
tesselation.  This avoids issues with degenerate polygons where the
degenerate points are not sequential.

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

(cherry picked from commit 73c2297144)
2018-09-20 10:12:30 -07:00
Seth Hillbrand b4fc7575a5 pcbnew: Parallelize initial board triangulation
Triangulation of zones can be time consuming for large boards.  This
adds a std::thread implementation of parallel zone loading to speed this
process on multi-core machines.

(cherry picked from commit a04ef37d67)
2018-09-20 10:12:30 -07:00
Seth Hillbrand 4560d4ef69 Replacing Tesselation
Replaces Poly2Tri with updated code to process polygons faster and more
robustly.  Notably, we can now handle overlapping holes in the polygons,
allowing us to cache the triangulation of complex boards

(cherry picked from commit a6325aab29)
2018-09-20 10:12:30 -07:00
Jeff Young 3a03c79255 Double opening speed of PCBs with ground and/or power planes.
(Or any other boards with complicated zones.)

(cherry picked from commit 7c04d8be1c)
2018-09-20 09:49:48 -07:00
Seth Hillbrand fca0785754 pcbnew: remove duplicate rebuild in GAL
When running GAL, the connectivity is built when the board loads, so the
extra call to rebuild connectivity is not needed.

(cherry picked from commit 13b96799ea)
2018-09-20 09:32:15 -07:00
Seth Hillbrand 30d398b108 pcbnew: Unify connected lists between items/zones
Keep the zoneitems in the same list as the rest of the items.

(cherry picked from commit 284c39acac)
2018-09-20 09:32:14 -07:00
Seth Hillbrand dd7ce9f00a pcbnew: Ensure connectivity layers are respected
This prevents non-copper layers from being included in the connectivity
search.  It also limits the layer search in the connectivity RTree to
just the copper layer range.

(cherry picked from commit f87cb64d65)
2018-09-20 09:32:14 -07:00
Seth Hillbrand 4f2f8e7f67 rtree: Updating to use functional
(cherry picked from commit 2cf38f68fe)
2018-09-20 09:32:14 -07:00
Seth Hillbrand c7e511c919 Remove connectivity debug statements
(cherry picked from commit 589e5b9ad7)
2018-09-20 09:32:14 -07:00
Seth Hillbrand d769d1649a pcbnew: Split Layers in connectivity
Splits the connectivity search RTree by layers to avoid large penalty on
zone searches.

(cherry picked from commit dc1736eb87)
2018-09-20 09:32:14 -07:00
Seth Hillbrand 2ae8f6337d 3d-viewer: corrected rrect zero-length radius
Previous commit mistakenly included the full clearance for the rounded
rectangle circle.  The CFILLEDCIRCLE2d takes the radius rather than the
diameter.

( cherry-picked from d139a4969 )
2018-09-20 08:54:33 -07:00
Seth Hillbrand 97c5e0a835 3d-viewer: Approximate 0-length element is rrect
Apply same logic of using a filled circle to represent a zero-length
element as a filled circle with radius of the line.

(cherry-picked from 8efcf81cf)

Fixes: lp:1785823
* https://bugs.launchpad.net/kicad/+bug/1785823
2018-09-19 21:38:13 -07:00
Wayne Stambaugh c722ea7a0c Eeschema: fix minor bug in block handler.
Under certain conditions, it was possible for the block handler to be
entered with no mouse capture callback which would raise a rather
cryptic error message to the user.  This should have always been an
assertion so users will not see this issue in release builds.

Fixes lp:1791839

https://bugs.launchpad.net/kicad/+bug/1791839
2018-09-19 15:34:34 -04:00
Jeff Young 5c600e992a Don't allow SELECTED flag to make us think item is already edited.
Fixes: lp:1793289
* https://bugs.launchpad.net/kicad/+bug/1793289
2018-09-19 19:37:28 +01:00
Wayne Stambaugh a055916f92 Pcbnew: fix minor bug in find dialog.
Repeating find with the same search string would result in a not found
error for absolute search strings.  Don't clear the found item if the
search string did not change from the previous search..

Fix another minor bug where the do not warp mouse pointer option was
always checked when the find dialog was called from one of the gal
canvases.

Fixes lp:1793300

https://bugs.launchpad.net/kicad/+bug/1793300
2018-09-19 12:44:25 -04:00
Jeff Young e3d5734f76 Don't use diff-pair gap as a clearance.
Fixes: lp:1789690
* https://bugs.launchpad.net/kicad/+bug/1789690

(cherry picked from commit 9f068d66a8)
2018-09-18 20:40:44 +01:00
Seth Hillbrand 3d0915a33e pcbnew: Don't merge zones with different params
Zones can be explicitly merged even if they do not have the same
parameters.  Automatic merging should only occur when all of the zone
parameters are exactly identical to allow for area-specific zone
parameters.

Fixes: lp:1695761
* https://bugs.launchpad.net/kicad/+bug/1695761
2018-09-17 12:15:48 -07:00
Seth Hillbrand a67bfa6207 pcbnew: prevent different keepout zones from merging
Keepout zones can have different layer sets and different restrictions
that should not be combined unless they are identical.

Fixes: lp:1789062
* https://bugs.launchpad.net/kicad/+bug/1789062
2018-09-17 11:53:12 -07:00
Seth Hillbrand a454adb3ba rename lang_chinese -> lang_zh
This is a 5.0 fix only.  Can't cherry pick from 5.1 as this was part of a
larger commit to unify preferences dialog
(7841f8a466)
2018-09-17 10:39:38 -07:00
John Beard 5019fd0aab Update CA and ZH source svg filename
These were updated in 7841f8a466, but the source
files seem to have not been changed.

(cherry-picked from c0615c5ef8 )
2018-09-17 10:39:38 -07:00
Seth Hillbrand 2c6d0ffe27 pcbnew: retain selection between edits
We had been deselecting items after calling edits to be safe in case the
item was deleted/exchanged by the edit.  The item pointer itself remains
valid even when deleting as it is assigned to the undo stack.  But it
should not remain visible or selected on the schematic if it is removed.

This tests for removed items by checking whether it (in the case of
first-level BOARD_ITEMS) or its parent (in the case of footprint item
components) remain in the view list after editing.  If they are still in
the view list, then we re-select them.

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

Fixes: lp:1775946
* https://bugs.launchpad.net/kicad/+bug/1775946
2018-09-17 10:39:31 -07:00
Wayne Stambaugh 0ff84865ca Update translators list to include simplified Chinese translator. 2018-09-17 11:53:55 -04:00
jean-pierre charras 36746a0941 Grid settings do not accept "." and "," as decimal separator unlike many other dialogs.
Fixes: lp:1792871
https://bugs.launchpad.net/kicad/+bug/1792871
2018-09-17 17:04:42 +02:00
Seth Hillbrand 22df4e301b pcbnew: Allow removing corners from graphical polygons
Fixes: lp:1792712
* https://bugs.launchpad.net/kicad/+bug/1792712
2018-09-16 10:26:00 -07:00
jean-pierre charras ac0c7441b4 pcb_parser.cpp: allows 0 width line thickness for circles in custom shaped pads.
the commit 1100ccb032 broke DRAWSEGMENT filled circles (line width = 0) used only in custom pads.

Fixes: lp:1792791
https://bugs.launchpad.net/kicad/+bug/1792791
2018-09-16 15:22:59 +02:00
Seth Hillbrand 2196959539 pcbnew: Fix dragging snap to items
Snapping while dragging depends on the current net being assigned during
dragging.  This initializes the placer to hold the current net while
performing inline dragging.  The placer is reset along with the dragger
in StopRouting().  This fixes the difference in snap between drag and
create new route.
2018-09-15 20:21:38 -07:00
Seth Hillbrand 06ac172c27 pcbnew: Add corners in polygons
Allow corner adding to polygons in both module editor and board editor.
The board editor was already allowed but only through special types.
The module editor is now sychronized to the same process and both
recognize standard context menus

Fixes: lp:1782966
* https://bugs.launchpad.net/kicad/+bug/1782966
2018-09-15 09:53:31 -07:00
Seth Hillbrand e7c51a6a6c pcbnew: snap final points to grid
When constraining moves, the cursor snaps to grid but does not
represent the position of the final edited point.  The point is rotated
to the nearest snap angle, while the vector length remains unchanged
resulting in a line longer than intended and off-grid.

This adds a grid-snap after the constraint is applied.

Fixes: lp:1792655
* https://bugs.launchpad.net/kicad/+bug/1792655
2018-09-15 07:52:17 -07:00
Wayne Stambaugh 079d6b2009 Eeschema, fix broken instances of symbols in rescue dialog.
The symbol library table rescue candidate was only using the item name
of the library ID object which was being compared to the fully formatted
library ID causing a comparison failure so no instances of any rescued
symbols was shown in the dialog.

Fixes lp:1791805

https://bugs.launchpad.net/kicad/+bug/1791805
2018-09-14 17:43:22 -04:00
jean-pierre charras 8cbe5c2184 3D viewer: Better axis rotation when selecting "Bottom view" It allows keeping texts on bottom side readable (rotation similar to the Flip board view in board editor) 2018-09-14 08:05:45 +02:00
Jeff Young a7d7ab32c6 Fix 5.0 regression on typing units into some dialog fields.
Fixes: lp:1792066
* https://bugs.launchpad.net/kicad/+bug/1792066
2018-09-13 19:14:32 +01:00
Seth Hillbrand 61715a8df5 pcbnew: Control cursor capture in microwave tool
Turns off cursor capture when the microwave tool is not actively drawing
a new inductor.

Fixes: lp:1792128
* https://bugs.launchpad.net/kicad/+bug/1792128
2018-09-12 09:10:58 -07:00
Maciej Suminski a149960faa Eagle SCH importer: fix slash characters when fixing symbol names
Even though slash is a valid character in symbol names, it is a revision
separator, but is not the case with Eagle symbol names.

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

(cherry-picked from commit 2c217499)
2018-09-12 10:54:58 +02:00
Maciej Suminski 650ff5e5fe kicad2step: Implement overwrite protection, handle 'force overwrite' flag
Fixes: lp:1791826
* https://bugs.launchpad.net/kicad/+bug/1791826

(cherry-picked from commit c120ae9e)
2018-09-11 09:26:55 +02:00
Maciej Suminski 0c42d988f7 kicad2step: Set correct file extension if no output file is specified
(cherry-picked from commit 7037e422)
2018-09-11 09:25:09 +02:00
Alexey Chernov a84de7cccf Adding OpenSSL include directory explicitly
Fixes: lp:1791164
* https://bugs.launchpad.net/kicad/+bug/1791164

( cherry-picked from 3ad1cd8d5 )
2018-09-10 07:18:18 -07:00
Maciej Suminski e9b1552b16 Spice netlist exporter: make directives case insensitive, extra comments
(cherry-picked from commit 4a57541b)
2018-09-10 14:21:27 +02:00
Joël Bertrand 27b88be61f Spice netlist exporter: handle .control .. .endc blocks
Spice may include a list of directives that are wrapped with
.control and .endc. Such directives do not have a dot prefix, so
they need to be handled in a special way.

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

(cherry-picked from commit 36f2eb11)
2018-09-10 14:21:27 +02:00
Maciej Suminski 280573e9af Relax selection discard rules for footprints with area larger than the viewport
Normally working at a zoom level when a footprint is not fully displayed
indicates that the user modifies other components. Selection Tool used
to discard footprints that had area larger than the viewport area, but
it may make sense to select them if there are no other candidates.

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

(cherry-picked from commit 5993b330)
2018-09-10 14:21:27 +02:00
Maciej Suminski 14e42fec7e Changed the OpenGL CMake preference to LEGACY
Certain distribution does not handle GLVND well, as the result the
accelerated canvas is not enabled. For the time being it is better to
keep using the legacy preference.

Thanks to Aurelio Lucchesi for investigating the cause.

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

(cherry-picked from commit 01925fd6)
2018-09-10 14:21:27 +02:00
jean-pierre charras 7e8c5b9574 Eeschema: fix incorrect/incomplete annotation clearing in duplicate and paste block (happens in complex hierarchy) 2018-09-09 09:19:22 +02:00
jean-pierre charras 500abd0ac4 Eeschema: fix incorrect references clearing for shared sheet paths.
Previously, when creating a new instance of a sheet, the full set of references
was cleared.
Moreover, if this sheet has sub-sheets, the annotation was incorrectly handled

Now only (and all) new sheet path(s) created have a reference cleared, as expected.
(new sheet paths can be more than one, if the new instance of the sheet has sub-sheets)

Fixes: lp:1789048
https://bugs.launchpad.net/kicad/+bug/1789048
2018-09-09 09:19:22 +02:00
Seth Hillbrand e29e7ff95d pcbnew: Fix Eagle import hole offset
Unplated holes in Ealge can either be free floating or part of a larger
footprint.  We handle both in the same packageHole routine by either
offsetting the hole in a centered footprint or offsetting the footprint
in a centered hole.

Fixes: lp:1791287
* https://bugs.launchpad.net/kicad/+bug/1791287
2018-09-08 20:41:53 -07:00
Seth Hillbrand fb580d3694 pcbnew: center the zone fill confirmation dialog
The zone fill confirmation should follow the parent dialog.  In the case
of plotting, this is the plot window.
2018-09-08 20:18:14 -07:00
Seth Hillbrand b987126b7d pcbnew: Keep Yes/No dialogs above the windows
Modal yes/no questions should not be allowed to fall behind other
windows.  They need to be answered before the program continues and
clicking outside of the dialog should not hide dialog itself.

Fixes: lp:1790640
* https://bugs.launchpad.net/kicad/+bug/1790640
2018-09-08 20:18:02 -07:00
Seth Hillbrand 3919345003 pcbnew: Allow selection of back pads
Pads should be selectable when the respective copper layer is enabled.

Fixes: lp:1789084
* https://bugs.launchpad.net/kicad/+bug/1789084
2018-09-08 17:24:44 -07:00
Seth Hillbrand 1df99c264f pcbnew: Add Eagle milling layer to edge_cuts
The Eagle milling layer (46) is valid for cutouts on the board.

Fixes: lp:1791284
* https://bugs.launchpad.net/kicad/+bug/1791284
2018-09-08 06:59:36 -07:00
Seth Hillbrand 4d094da2fa Correct previous (2c5154c63) default value 0.1->0.051 2018-09-08 06:45:23 -07:00
Seth Hillbrand 2c5154c630 pcbnew: adjust default soldermask/dam clearance
The previous clearance values were equivalent to the default copper
clearance, which could cause issues for users who didn't adjust the
values and had alignment errors at the board house.  New values default
to typical dry film minimums.
2018-09-08 06:33:07 -07:00
Tomasz Wlostowski f85dc57642 POLY_GRID_PARTITION: fixed incorrect point-in-polygon test in some corner cases
Fixes: lp:1787236
* https://bugs.launchpad.net/kicad/+bug/1787236
2018-09-06 20:55:40 -07:00
Seth Hillbrand 3da86dc24b kicad2step: limit small segment add/remove
The addition of very small segments in OCE triggers sliver
removal/cleanup in the BREP generation that can get stuck in a very long
loop during STEP export of boards.  These were introduced to ensure
closure of boards with small gaps that were too big for OCE to consider
joined.

Removing the small segments allows STEP export to proceed in a
reasonable time.  This also decreases the default minimum gap size that
kicad2step uses to determine curve matching.  This prevents mis-matching
small curves

Fixes: lp:1784626
* https://bugs.launchpad.net/kicad/+bug/1784626
2018-09-06 18:43:26 -07:00
Seth Hillbrand 5e9b4dd6a5 eeschema: Set images to draw first in eeschema
Bitmaps in eeschema are mainly used for referencing and data.  Having
them between functional items obscures the elements.  This places the
images in the background for eeschema as a partial fix for lp:1787404

This commit should not be picked into 5.1 as the canvas changes.
2018-09-06 14:10:11 -07:00
Seth Hillbrand 1f60d8fdbf eeschema: Only allow dragging of draggable items
When expanding the drag item to allow corners, we accidentally picked up
other items in the list.  This limits the items that can be dragged to
only those that are explicitly in the draggable list.

A side effect of this commit is that when converting from move to drag
(with tab), items not in the draggable list will be left in place.

Fixes: lp:1787966
* https://bugs.launchpad.net/kicad/+bug/1787966
2018-09-06 13:42:01 -07:00
Seth Hillbrand 7012226284 pcbnew: Set soldermask on NPTH imported from Eagle
Fixes: lp:1773253
* https://bugs.launchpad.net/kicad/+bug/1773253
2018-09-06 08:57:40 -07:00
Seth Hillbrand 48bbde65b3 pcbnew: Set default line width for invalids
Invalid graphical items that cannot be created in pcbnew may still be
created by external tools.  This synchronizes the pcbnew view display
with the gerber output and 3d viewer line widths for these types of
lines.  Only filled polygons are permitted 0-width lines.

Fixes: lp:1790534
* https://bugs.launchpad.net/kicad/+bug/1790534
2018-09-05 16:43:15 -07:00
Damian Wrobel bdcae5f593 Fix setting default cmake build type
Changes: Sets default cmake build type before
calling project(). Current version seems to follow
https://cmake.org/pipermail/cmake/2008-September/023808.html
however, it seems to miss the comment that:
"definition of CMAKE_BUILD_TYPE occurs in the PROJECT() command"
which means that setting cmake build type should happend prior
to calling PROJECT().

Fixes: lp:1785719
* https://bugs.launchpad.net/kicad/+bug/1785719
2018-09-05 08:12:54 -04:00
jean-pierre charras b7b125d83c Eeschema: Fix incorrect parsing of old schematic files (version 2) for HLabels and GLabels 2018-09-03 19:52:22 +02:00
Seth Hillbrand 9eec296b0a pcbnew: Select copper through THT connections
This allows full copper connections even when THT changes a trace layer.
It avoides selecting the actual pad to prevent actions on the copper
connections from affecting the footprints as well.

Fixes: lp:1789807
* https://bugs.launchpad.net/kicad/+bug/1789807
2018-09-03 07:43:59 -07:00
Seth Hillbrand ec81f3267f pcbnew: Only regenerate BBox if the item is valid
Items removed from the connectivity list will not have valid parents, so
we cannot update the BBox, thus we will only use the cached value.

Fixes: lp:1785605
* https://bugs.launchpad.net/kicad/+bug/1785605
2018-08-31 18:45:26 -07:00
qu1ck f0e9e3b9d5 Extend swig definitions to contain SHAPE_LINE_CHAIN and VECTOR2I 2018-08-31 13:16:13 -04:00
Seth Hillbrand ee12fe6eff modview: Re-instate the try/catch block when loading
Setting up the footprint viewer will attempt to load the current
footprint.  If the library does not exist, the loader will throw an
IO_ERROR that needs to be caught.

Fixes: lp:1789626
* https://bugs.launchpad.net/kicad/+bug/1789626
2018-08-31 08:45:34 -07:00
Seth Hillbrand d6b95236a4 gal: correct layer ordering
Net labels need to be rendered under the selected item.

Fixes: lp:1790016
* https://bugs.launchpad.net/kicad/+bug/1790016
2018-08-30 16:55:00 -07:00
Seth Hillbrand fbe677e46e pcbnew: Correcting commit f84bd0d83 for 5.0/release
Previous commit only functioned correctly in debug mode.  Also cleanup a
left-over debug printf() and revert a changed translated string.
2018-08-30 13:25:18 -07:00
Seth Hillbrand f84bd0d836 pcbnew: Fix Eagle UTF8 import error
Implicit convertion from wxString to std::string will use narrow strings
and drop UTF-8.

Fixes: lp:1789311
* https://bugs.launchpad.net/kicad/+bug/1789311
2018-08-30 13:07:33 -07:00
Seth Hillbrand 25b6604fc5 pcbnew: Swap all types of zones when swapping layers
This is a 5.0-only commit to implement correct layer swapping.

Fixes: lp:1789390
* https://bugs.launchpad.net/kicad/+bug/1789390
2018-08-30 09:45:39 -07:00
Ronnie Gaensli fbd6654f9a pcbnew: fix pan while moving mouse after cancelling selection box
Fixes: lp:1776648
* https://bugs.launchpad.net/kicad/+bug/1776648
2018-08-29 16:48:55 -07:00
Seth Hillbrand b8ae4e0195 pcbnew: Only dp clearance matrix when routing dp
Fixes: lp:1787766
* https://bugs.launchpad.net/kicad/+bug/1787766
2018-08-29 10:25:51 -07:00
Seth Hillbrand 9527034e0f cvpcb: don't show board-level soldermask
Only show soldermask in cvpcb if it was defined in the footprint or pad,
not the board defaults.
2018-08-28 17:00:27 -07:00
Seth Hillbrand 6754aa8a74 eeschema: Close ERC before placing components
We have a dialog shim that raises the ERC dialog in front of the
schematic frame, which is useful for keeping the ERC dialog visible
during debugging.  But mouse move events do not pass through to the
schematic, resulting in a captured mouse pointer but no drawing updates.

As a work-around we close the ERC dialog while placing new components.
Previous ERC data still exist when the window is launched again.

Fixes: lp:1779851
* https://bugs.launchpad.net/kicad/+bug/1779851
2018-08-28 16:03:02 -07:00
Seth Hillbrand 0c659eda78 gerbview: Add LAYER_SELECT_OVERLAY to GAL
Ensure selected gerbview layers plotted on newly created SELECT layer
2018-08-28 15:12:02 -07:00
Seth Hillbrand 20ea486378 GAL: Add a selected item layer
The selected items should be displayed above the rest of the items but
below informational overlays.

Fixes: lp:1789505
* https://bugs.launchpad.net/kicad/+bug/1789505
2018-08-28 14:58:37 -07:00
Seth Hillbrand 0c94b3239d pcbnew: keep selected zone highlighted when moding
When adding a cutout to a zone, it helps to have the zone highlighted so
that you can see when zone you are operating on.
2018-08-28 14:49:48 -07:00
Seth Hillbrand d8e276bc4f pcbnew: Adding some missing TypeOf() functions
Missing types were handled by the superclass (in the case of zones)
PCB_CONNECTED_ITEM, which incorrectly returned "true" when testing lines
against zones.

Fixes: lp:1789195
* https://bugs.launchpad.net/kicad/+bug/1789195
2018-08-28 13:16:34 -07:00
Seth Hillbrand b7a321d143 modedit: clear the pcb when closing the window
Before closing the window in the footprint editor, we clear the existing
pcb, undo/redo stack and associated memory to prevent callbacks
double-freeing on destruction.

Fixes: lp:1784504
* https://bugs.launchpad.net/kicad/+bug/1784504
2018-08-28 12:35:17 -07:00
Seth Hillbrand f6d9c3a733 pcbnew: set default soldermask clearance for footprint viewer
The default board soldermask clearance should not be used in the
footprint viewer.  Setting the board's solder mask margin to 0 will
leave the footprint displayed with only the soldermask defined by
the pads or the footprint.

Thanks to Fabian Inostroza for pointing out the missing line.

Fixes: lp:1779979
* https://bugs.launchpad.net/kicad/+bug/1779979
2018-08-28 10:03:25 -07:00
jean-pierre charras 7ed07cae70 Pcbnew, Plot: fix incorrect plot of custom shapes, when the shape has holes (missing holes).
Fixes: lp:1789404
https://bugs.launchpad.net/kicad/+bug/1789404
2018-08-28 17:51:52 +02:00
Wayne Stambaugh 8bb0fabcba Fix build error with Boost 1.68.
The Boost folks kindly decided to move the sha1.hpp header file location
so check the Boost version to include the proper header path.

Clean up debug trace code.
2018-08-28 10:30:49 -04:00
jean-pierre charras da4d9ee392 Footprint viewer: ensure all panes are always visible, regardless m_auimgr.LoadPerspective() has read.
Perspective is overzealous: it stores everything, so we need to be sure these panes are not hidden,
regardless what the perspective has stored.

Fixes: lp:1789254
https://bugs.launchpad.net/kicad/+bug/1789254
2018-08-27 20:32:45 +02:00
jean-pierre charras a4ddbff321 Kicad archive project: add missing file extensions (.kicad_mod, .gbrjob) in files to archive filter.
From master.
2018-08-27 15:53:16 +02:00
Jeff Young 3c87ab94a2 Fix fast grid switching for OSX and Footprint Editor.
Fixes: lp:1787066
* https://bugs.launchpad.net/kicad/+bug/1787066
2018-08-26 19:01:40 +01:00
Jeff Young e424f29bbb Don't inadvertantly strip hotkey off Save All Libraries.
Fixes: lp:1786066
* https://bugs.launchpad.net/kicad/+bug/1786066
2018-08-26 00:32:38 +01:00
Jeff Young 3587789ae2 Update canvas after changing netclass settings.
Fixes: lp:1786937
* https://bugs.launchpad.net/kicad/+bug/1786937
2018-08-25 23:20:46 +01:00
Jeff Young 8cb389d95c Use actual parent for dialogs; don't pass nullptr.
Fixes: lp:1788962
* https://bugs.launchpad.net/kicad/+bug/1788962
2018-08-25 11:12:58 +01:00
jean-pierre charras 0f78fe5a5a Fix a minor wxWidget alert. 2018-08-25 10:38:13 +02:00
jean-pierre charras 333ba4b9a2 Eeschema: fix an assert ( "meOwner" failed in DeleteAll() ) when appending a sheet from an other project to the schematic.
It was only a overzealous (in this case) assert, with no issue.
The fix avoid calling DeleteAll() when there is nothing to delete.

Fixes: lp:1787810
https://bugs.launchpad.net/kicad/+bug/1787810
2018-08-25 10:38:13 +02:00
Jeff Young 7e2e39ce30 Handle separate parsing rules for ID_SCH and ID_PCB.
This removes the existing constructors so that all parsing must
be explicit and callers are made aware that they need to think
about illegal characters, malformed ids, etc.

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

Fixes: lp:1786819
* https://bugs.launchpad.net/kicad/+bug/1786819
2018-08-24 23:57:19 +01:00
Wayne Stambaugh b167c41d1b Pcbnew: enable scripting action menu build option by default.
Fixes lp:1783690

https://bugs.launchpad.net/kicad/+bug/1783690
2018-08-21 13:06:27 -04:00
jean-pierre charras dc022dcdae key event in draw_panel.cpp: fix incorrect behavior for the escape key (the key was handled but the evnent was skipped). This create an incorrect behavior because the event key was resend because the primary event was seen as not handled by the drawpanel. 2018-08-21 18:49:08 +02:00
jean-pierre charras e2c6422838 Better fix for accelerator menus using "Back" (previously named "BkSp") key
Use the wxWidgets official accelerator key string for WXK_BACK (this is "Back") in menuitems instead of "BkSp"
Also when reading the hotkey config file, avoid to set a hotkey to unassigned when its name is not found in list.
The default value is used.
Unassigned hotkey use <unassigned> as key name (and 0 as key code) in file.
2018-08-21 18:49:08 +02:00
Ronnie Gaensli 182b8a32df eeschema: fix dangling pin marker after adding NoConnect
Fixes: lp:1787858
* https://bugs.launchpad.net/kicad/+bug/1787858
2018-08-19 19:47:21 -07:00
jean-pierre charras 831978293f Fix ASCII code used in accelerator menus for BkSp key (Linux only)
On Linux (GTK?) the accelerator key BkSp, when used in menus must be coded as "\t\b" and not "\tBkSp".
However, On Windows, it must be "\tBkSp".
Joys of multi-platform development.
2018-08-15 21:19:41 +02:00
John Beard 64f46448ea Fix -Wcatch-value in kicad2step.cpp 2018-08-15 12:51:36 -04:00
Maciej Suminski ca1f50a023 Spice simulator: search each line of a text field for a Spice directive
Fixes: lp:1786119
* https://bugs.launchpad.net/kicad/+bug/1786119

(cherry-picked from commit d5ee3296)
2018-08-14 10:27:07 +02:00
Maciej Suminski 626f5ac45a Spice simulator: prevent double quoting library file names
Fixes: lp:1786559
* https://bugs.launchpad.net/kicad/+bug/1786559

(cherry-picked from commit f82b839d)
2018-08-14 09:47:24 +02:00
Jeff Young a45a8e8797 Warn before replacing edited footprint in footprint editor.
Fixes: lp:1786570
* https://bugs.launchpad.net/kicad/+bug/1786570
2018-08-11 20:36:51 +01:00
jean-pierre charras c7d39d22db FOOTPRINT_WIZARD_FRAME: ensure the draw panel is always visible, even if the config file is incorrect. 2018-08-10 13:44:21 +02:00
jean-pierre charras b764bb1d6d Fix a minor wxWidgets alert 2018-08-10 13:43:12 +02:00
jean-pierre charras 64eaaa4f58 Fix incorrect parent of a separator in a toolbar 2018-08-10 11:53:49 +02:00
Seth Hillbrand 0e946dad1a Eagle: Fix NULL-dereference on malformed Eagle files
Eagle files that are edited may be missing required data.  While we do
not need to handle these files, we do need to prevent segfaults in KiCad
when reading them.
2018-08-09 14:57:50 -07:00
Seth Hillbrand 1c2f06106d PCBNEW: Re-add missing SWIG zone filler
Zone filler was factored out into a separate header.  To allow python
access to zone filling, we need to include the revised signatures.
2018-08-08 12:23:32 -07:00
Seth Hillbrand edbf34c2b2 Adjust RTree default floating point to use double
This reverts the previous work-around 7d62f14dd for the RTree splitting
degeneracy that was placed prior to v5.  It appears not to have worked
for all systems.  In its place, we use doubles instead of floats to
calculate the bounding box when filling the RTree.  This keeps maximum
volume items from overlapping with the system boundary in test cases.

(cherry-picked from 539ca5aa3)
2018-08-06 17:01:59 -07:00
Jeff Young 26cbdbf103 Add Edit context menu item for EEschema graphic lines.
Fixes: lp:1779554
* https://bugs.launchpad.net/kicad/+bug/1779554

(cherry picked from commit 02b29ba)

(cherry picked from commit 7dcc8e346f)
2018-08-06 13:56:56 +01:00
Jeff Young f163d9ff2a Fix bug with duplicate columns in Edit Symbol Fields.
(cherry picked from commit 01c5bdf)
2018-08-06 13:55:59 +01:00
Jeff Young 9230189f62 Fix thread-safety issue with some global wxStrings.
These cause intermittent crashes in footprint loading.  See
comments in code.

(cherry picked from commit 5e8e2570ba)
2018-08-06 13:52:23 +01:00
Ronnie Gaensli 9d241ba812 Cancel Add dimension leaves auto panning on
Fixes: lp:178551
* https://bugs.launchpad.net/kicad/+bug/178551

(cherry picked from commit 3ca84dca)
2018-08-06 11:27:56 +02:00
jean-pierre charras 57c3e98f8c Fix a wxWidgets minor alert 2018-08-03 09:28:30 +02:00
jean-pierre charras 349d1562af fix a few wxWidgets alerts, to avoid useless bug reports when kicad is compiled in Debug mode 2018-08-02 16:58:30 +02:00
jean-pierre charras d81bcee10d CMakeLists.txt: add a option (BUILD_SMALL_DEBUG_FILES, default off) to create smaller binaries in debug mode. It forces link option -g1 instead og -g3 which allows basic debug.
This is especially useful on Mingw because binaries in debug build are very large:
_pcbnew.kiface: 1.25 Gb, small file option: 65Mb
2018-08-02 16:58:30 +02:00
Seth Hillbrand 016c02a42d modedit: Store single copy of the footprint in undo
When changing elements in the module editor, each element shares the
same parent.  Undo commits store a copy of the parent as it existed
before the change.  For footprints with many elements, this creates
large, slow undo commits as a copy of the full footprint is stored for
each element being edited.

This keeps a single copy of the footprint in the undo stack per edit.

Fixes: lp:1780526
* https://bugs.launchpad.net/kicad/+bug/1780526
2018-08-01 11:00:49 -07:00
Jeff Young 80e7a83fb0 Generalize OSX &Cancel fix to work for other languages.
Fixes: lp:1784350
* https://bugs.launchpad.net/kicad/+bug/1784350

(cherry picked from commit 98849bde96)
2018-08-01 11:50:04 +01:00
jean-pierre charras d2aa976017 Fix many wxWidgets alerts, to avoid useless bug reports when kicad is compiled in Debug mode 2018-07-31 11:41:47 +02:00
John Beard 9476b53533 Use M_PI for Pi, not constexpr calculation
Constexpr evaluation breaks Clang compilation.

Use math.h M_PI, as elsewhere.
2018-07-30 12:46:27 -04:00
jean-pierre charras 5e19ed29b8 Fix D_PAD::BuildPadShapePolygon() incorrect calculation for custom pad shapes.
Fixes: lp:1784340
https://bugs.launchpad.net/kicad/+bug/1784340
2018-07-30 16:58:20 +02:00
John Beard aa340e6b85 QA Geometry: New test suite for generic geometric tests
This is the first test for a generic test suite for geometric functions.

The tests run are for fillet corners of SHAPE_POLY_SETS.

Previously, SHAPE_POLY_SET::Fillet was tested against CPolyLine::Fillet
to ensure compatibility. However, thse two functions now have different
interfaces and are not directly comparable. Also, this depended on
CPolyLine::Fillet being correct, which was not tested.

Instead, test SHAPE_POLY_SET::Fillet using tests against geometric
constraints, independent of any other fillet implementation.
2018-07-27 14:41:24 -04:00
John Beard 9a80ebf387 QA: Rename geometry to shape_poly_set_refactor
This test is not really concerned with generic geometric code testing,
but rather the correctness of a refactoring effort.

Rename it make this clearer, and also to make way for generic geometry tests.
2018-07-27 14:41:11 -04:00
John Beard df1fa37fd8 QA: Add python test as a Ctest test rather than build target 2018-07-27 14:41:04 -04:00
John Beard 370a412f49 Enable CTest tests and add qa_geometry as a test
This allows the use of `make test` or `ctest` to run all registered
tests.

The ChamferFillet/Fillet test is disabled for now as it fails.
2018-07-27 14:40:57 -04:00
Maciej Suminski d63c1a2118 Use quoted file name when opening a PDF file
Fixes: lp:1783667
* https://bugs.launchpad.net/kicad/+bug/1783667

(cherry-picked from bbfc1eb1)
2018-07-26 12:07:46 +02:00
Maciej Suminski 35576adb73 Converted PNS Length Tuning dialog to use TransferData{From,To}Window()
Fixes: lp:1783694
* https://bugs.launchpad.net/kicad/+bug/1783694

(cherry-picked from commit dbf4bcdb)
2018-07-26 10:36:21 +02:00
Maciej Suminski 4ff426275f Fixed KIDIALOG freeze
wxDialog calls Show(false) when the dialog is about to be closed, but
KIDIALOG::Show() implementation did not forward the show parameter to
wxRichMessageDialog::Show() invocation. As the parameter was not
specified, the mentioned Show() call always used 'true' as the default
parameter, preventing the dialog from being closed.

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

(cherry-picked from commit 39d8d143)
2018-07-25 12:10:54 +02:00
John Beard 7dc9f99165 Fix -Wcatch-value in sexpr.cpp
This is fixed by catching bty const-ref, rather than by value.

Also a few trailing space deletions.
2018-07-23 14:57:52 -04:00
Maciej Suminski 30da1a3b02 pcbnew: Disabled UI update for pcbnew console menu item
UI update event handler updates toolbar button state for the scripting
console, but for the associated menu item it displays an assert saying that
the menu item that cannot be checked. To avoid that, the UI update event
handler returns early if event does not come from the toolbar.

(cherry picked from commit 45c1742a)
2018-07-22 19:52:55 +02:00
Wayne Stambaugh 3dcf04fdb8 Apply footprint editor options when dialog OK button is clicked.
Fixes lp:1781977

https://bugs.launchpad.net/kicad/+bug/1781977
2018-07-18 08:45:43 -04:00
jean-pierre charras 6fbc7bb4ce Gerbview, read Excellon files: fix a few issues.
The main issue is the fact Excellon files have no coordinate fine format definition.
Only the units are defined.
Units are floating point numbers or integer numbers.
Integer numbers can be defined as 3.3 or 2.4 numbers (mm/inches)
However some files (altium drill files for instance) use an other notation.
This fix is a workaround to accept 2.x (inch) or 3.x (mm) notations.

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

Fixes: lp:1782053
https://bugs.launchpad.net/kicad/+bug/1782053
2018-07-17 17:41:33 +02:00
jean-pierre charras 3af2026061 Revert "Perform coordinate format detection on Excellon drill files"
This reverts commit 3e033aee0c.
2018-07-17 17:41:32 +02:00
Maciej Suminski 6bd8cb9b8f eeschema: fix alias names in .dcm files
Fixes: lp:1781761
* https://bugs.launchpad.net/kicad/+bug/1781761
2018-07-17 14:27:25 +02:00
Wayne Stambaugh b23b48b9a7 Tag version 5.0.1-dev. 2018-07-13 16:33:17 -04:00
280 changed files with 5951 additions and 6232 deletions
+56 -117
View File
@@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2018 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
@@ -34,7 +35,13 @@
#include <wx/log.h>
#include <wx/stdpaths.h>
#include <boost/version.hpp>
#if BOOST_VERSION >= 106800
#include <boost/uuid/detail/sha1.hpp>
#else
#include <boost/uuid/sha1.hpp>
#endif
#include <glm/glm.hpp>
#include <glm/ext.hpp>
@@ -52,6 +59,7 @@
static wxCriticalSection lock3D_cache;
static bool isSHA1Same( const unsigned char* shaA, const unsigned char* shaB )
{
for( int i = 0; i < 20; ++i )
@@ -61,6 +69,7 @@ static bool isSHA1Same( const unsigned char* shaA, const unsigned char* shaB )
return true;
}
static bool checkTag( const char* aTag, void* aPluginMgrPtr )
{
if( NULL == aTag || NULL == aPluginMgrPtr )
@@ -71,6 +80,7 @@ static bool checkTag( const char* aTag, void* aPluginMgrPtr )
return pp->CheckTag( aTag );
}
static const wxString sha1ToWXString( const unsigned char* aSHA1Sum )
{
unsigned char uc;
@@ -151,14 +161,8 @@ void S3D_CACHE_ENTRY::SetSHA1( const unsigned char* aSHA1Sum )
{
if( NULL == aSHA1Sum )
{
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL passed for aSHA1Sum";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] NULL passed for aSHA1Sum",
__FILE__, __FUNCTION__, __LINE__ );
return;
}
@@ -186,6 +190,7 @@ S3D_CACHE::S3D_CACHE()
return;
}
S3D_CACHE::~S3D_CACHE()
{
FlushCache();
@@ -210,8 +215,8 @@ SCENEGRAPH* S3D_CACHE::load( const wxString& aModelFile, S3D_CACHE_ENTRY** aCach
if( full3Dpath.empty() )
{
// the model cannot be found; we cannot proceed
wxLogTrace( MASK_3D_CACHE, " * [3D model] could not find model '%s'\n",
aModelFile.GetData() );
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [3D model] could not find model '%s'\n",
__FILE__, __FUNCTION__, __LINE__, aModelFile );
return NULL;
}
@@ -294,15 +299,8 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY**
if( m_CacheMap.insert( std::pair< wxString, S3D_CACHE_ENTRY* >
( aFileName, ep ) ).second == false )
{
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] duplicate entry in map file; key = '";
ostr << aFileName.ToUTF8() << "'";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] duplicate entry in map file; key = '%s'",
__FILE__, __FUNCTION__, __LINE__, aFileName );
m_CacheList.pop_back();
delete ep;
@@ -325,15 +323,8 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY**
if( m_CacheMap.insert( std::pair< wxString, S3D_CACHE_ENTRY* >
( aFileName, ep ) ).second == false )
{
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] duplicate entry in map file; key = '";
ostr << aFileName.ToUTF8() << "'";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] duplicate entry in map file; key = '%s'",
__FILE__, __FUNCTION__, __LINE__, aFileName );
m_CacheList.pop_back();
delete ep;
@@ -364,28 +355,16 @@ bool S3D_CACHE::getSHA1( const wxString& aFileName, unsigned char* aSHA1Sum )
{
if( aFileName.empty() )
{
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] empty filename";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * [BUG] empty filename",
__FILE__, __FUNCTION__, __LINE__ );
return false;
}
if( NULL == aSHA1Sum )
{
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] NULL pointer passed for aMD5Sum";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
wxLogTrace( MASK_3D_CACHE, "%s\n * [BUG] NULL pointer passed for aMD5Sum",
__FILE__, __FUNCTION__, __LINE__ );
return false;
}
@@ -434,17 +413,16 @@ bool S3D_CACHE::loadCacheData( S3D_CACHE_ENTRY* aCacheItem )
if( bname.empty() )
{
#ifdef DEBUG
wxLogTrace( MASK_3D_CACHE, " * [3D model] cannot load cached model; no file hash available\n" );
#endif
wxLogTrace( MASK_3D_CACHE,
" * [3D model] cannot load cached model; no file hash available" );
return false;
}
if( m_CacheDir.empty() )
{
wxString errmsg = "cannot load cached model; config directory unknown";
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s\n", errmsg.GetData() );
wxLogTrace( MASK_3D_CACHE,
" * [3D model] cannot load cached model; config directory unknown" );
return false;
}
@@ -454,8 +432,7 @@ bool S3D_CACHE::loadCacheData( S3D_CACHE_ENTRY* aCacheItem )
if( !wxFileName::FileExists( fname ) )
{
wxString errmsg = "cannot open file";
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s '%s'\n",
errmsg.GetData(), fname.GetData() );
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s '%s'", errmsg.GetData(), fname.GetData() );
return false;
}
@@ -475,28 +452,16 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
{
if( NULL == aCacheItem )
{
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * NULL passed for aCacheItem";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * NULL passed for aCacheItem",
__FILE__, __FUNCTION__, __LINE__ );
return false;
}
if( NULL == aCacheItem->sceneData )
{
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * aCacheItem has no valid scene data";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * aCacheItem has no valid scene data",
__FILE__, __FUNCTION__, __LINE__ );
return false;
}
@@ -505,17 +470,16 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
if( bname.empty() )
{
#ifdef DEBUG
wxLogTrace( MASK_3D_CACHE, " * [3D model] cannot load cached model; no file hash available\n" );
#endif
wxLogTrace( MASK_3D_CACHE,
" * [3D model] cannot load cached model; no file hash available" );
return false;
}
if( m_CacheDir.empty() )
{
wxString errmsg = "cannot load cached model; config directory unknown";
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s\n", errmsg.GetData() );
wxLogTrace( MASK_3D_CACHE,
" * [3D model] cannot load cached model; config directory unknown" );
return false;
}
@@ -526,9 +490,8 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
{
if( !wxFileName::FileExists( fname ) )
{
wxString errmsg = _( "path exists but is not a regular file" );
wxLogTrace( MASK_3D_CACHE, " * [3D model] %s '%s'\n", errmsg.GetData(),
fname.ToUTF8() );
wxLogTrace( MASK_3D_CACHE, " * [3D model] path exists but is not a regular file '%s'",
fname );
return false;
}
@@ -559,14 +522,9 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
if( !cfgdir.DirExists() )
{
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = _( "failed to create 3D configuration directory" );
ostr << " * " << errmsg.ToUTF8() << "\n";
errmsg = _( "config directory" );
ostr << " * " << errmsg.ToUTF8() << " '";
ostr << cfgdir.GetPath().ToUTF8() << "'";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
wxLogTrace( MASK_3D_CACHE,
"%s:%s:%d\n * failed to create 3D configuration directory '%s'",
__FILE__, __FUNCTION__, __LINE__, cfgdir.GetPath() );
return false;
}
@@ -577,15 +535,10 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
// inform the file resolver of the config directory
if( !m_FNResolver->Set3DConfigDir( m_ConfigDir ) )
{
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * could not set 3D Config Directory on filename resolver\n";
ostr << " * config directory: '" << m_ConfigDir.ToUTF8() << "'";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
wxLogTrace( MASK_3D_CACHE,
"%s:%s:%d\n * could not set 3D Config Directory on filename resolver\n"
" * config directory: '%s'",
__FILE__, __FUNCTION__, __LINE__, m_ConfigDir );
}
// 3D cache data must go to a user's cache directory;
@@ -597,20 +550,20 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
// 3. MSWin: AppData\Local\kicad\3d
wxString cacheDir;
#if defined(_WIN32)
#if defined(_WIN32)
wxStandardPaths::Get().UseAppInfo( wxStandardPaths::AppInfo_None );
cacheDir = wxStandardPaths::Get().GetUserLocalDataDir();
cacheDir.append( "\\kicad\\3d" );
#elif defined(__APPLE)
#elif defined(__APPLE)
cacheDir = "${HOME}/Library/Caches/kicad/3d";
#else // assume Linux
#else // assume Linux
cacheDir = ExpandEnvVarSubstitutions( "${XDG_CACHE_HOME}" );
if( cacheDir.empty() || cacheDir == "${XDG_CACHE_HOME}" )
cacheDir = "${HOME}/.cache";
cacheDir.append( "/kicad/3d" );
#endif
#endif
cacheDir = ExpandEnvVarSubstitutions( cacheDir );
cfgdir.Assign( cacheDir, "" );
@@ -621,14 +574,8 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
if( !cfgdir.DirExists() )
{
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
wxString errmsg = "failed to create 3D cache directory";
ostr << " * " << errmsg.ToUTF8() << "\n";
errmsg = "cache directory";
ostr << " * " << errmsg.ToUTF8() << " '";
ostr << cfgdir.GetPath().ToUTF8() << "'";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * failed to create 3D cache directory '%s'",
__FILE__, __FUNCTION__, __LINE__, cfgdir.GetPath() );
return false;
}
@@ -681,11 +628,8 @@ wxString S3D_CACHE::Get3DConfigDir( bool createDefault )
if( !cfgpath.DirExists() )
{
std::ostringstream ostr;
wxString errmsg = "failed to create 3D configuration directory";
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * " << errmsg.ToUTF8();
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
wxLogTrace( MASK_3D_CACHE, "%s:%s:%d\n * failed to create 3D configuration directory '%s'",
__FILE__, __FUNCTION__, __LINE__, cfgpath.GetPath() );
return wxT( "" );
}
@@ -788,14 +732,9 @@ S3DMODEL* S3D_CACHE::GetModel( const wxString& aModelFileName )
if( !cp )
{
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] model loaded with no associated S3D_CACHE_ENTRY";
wxLogTrace( MASK_3D_CACHE, "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
wxLogTrace( MASK_3D_CACHE,
"%s:%s:%d\n * [BUG] model loaded with no associated S3D_CACHE_ENTRY",
__FILE__, __FUNCTION__, __LINE__ );
return NULL;
}
@@ -40,7 +40,7 @@
#include "../3d_rendering/3d_render_raytracing/accelerators/ccontainer2d.h"
#include "../3d_rendering/3d_render_raytracing/shapes3D/ccylinder.h"
#include "../3d_rendering/3d_render_raytracing/shapes3D/clayeritem.h"
#include <openmp_mutex.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pad.h>
@@ -418,27 +418,24 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
*aPad ) );
// Add the PAD contours
// !TODO: check the corners because it cannot add
// roundsegments that are in the same start and end position
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[0],
corners3DU[1],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[1],
corners3DU[2],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[2],
corners3DU[3],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[3],
corners3DU[0],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
// Round segments cannot have 0-length elements, so we approximate them
// as a small circle
for( int i = 1; i <= 4; i++ )
{
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
{
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
aClearanceValue.x * m_biuTo3Dunits,
*aPad ) );
}
else
{
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
corners3DU[i & 3],
aClearanceValue.x * 2.0f * m_biuTo3Dunits,
*aPad ) );
}
}
}
break;
@@ -473,27 +470,24 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
*aPad ) );
// Add the PAD contours
// !TODO: check the corners because it cannot add
// roundsegments that are in the same start and end position
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[0],
corners3DU[1],
rounding_radius * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[1],
corners3DU[2],
rounding_radius * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[2],
corners3DU[3],
rounding_radius * 2.0f * m_biuTo3Dunits,
*aPad ) );
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[3],
corners3DU[0],
rounding_radius * 2.0f * m_biuTo3Dunits,
*aPad ) );
// Round segments cannot have 0-length elements, so we approximate them
// as a small circle
for( int i = 1; i <= 4; i++ )
{
if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
{
aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
rounding_radius * m_biuTo3Dunits,
*aPad ) );
}
else
{
aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
corners3DU[i & 3],
rounding_radius * 2.0f * m_biuTo3Dunits,
*aPad ) );
}
}
}
break;
@@ -506,10 +500,6 @@ void CINFO3D_VISU::createNewPadWithClearance( const D_PAD* aPad,
if( aClearanceValue.x )
polyList.Inflate( aClearanceValue.x, 32 );
// This convert the poly in outline and holes
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
polyList.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Add the PAD polygon
Convert_shape_line_polygon_to_triangles( polyList, *aDstContainer, m_biuTo3Dunits, *aPad );
@@ -829,11 +819,8 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const DRAWSEGMENT* aDrawSeg
aDrawSegment->TransformShapeWithClearanceToPolygon( polyList, aClearanceValue,
segcountforcircle, correctionFactor );
// This convert the poly in outline and holes
// Note: This two sequencial calls are need in order to get
// the triangulation function to work properly.
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
polyList.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
if( polyList.IsEmpty() ) // Just for caution
break;
@@ -860,24 +847,14 @@ void CINFO3D_VISU::AddSolidAreasShapesToContainer( const ZONE_CONTAINER* aZoneCo
PCB_LAYER_ID aLayerId )
{
// Copy the polys list because we have to simplify it
SHAPE_POLY_SET polyList = SHAPE_POLY_SET(aZoneContainer->GetFilledPolysList());
SHAPE_POLY_SET polyList = SHAPE_POLY_SET( aZoneContainer->GetFilledPolysList(), true );
// This convert the poly in outline and holes
// Note: This two sequencial calls are need in order to get
// the triangulation function to work properly.
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
polyList.Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
if( polyList.IsEmpty() )
return;
Convert_shape_line_polygon_to_triangles( polyList,
*aDstContainer,
m_biuTo3Dunits,
*aZoneContainer );
// add filled areas outlines, which are drawn with thick lines segments
// /////////////////////////////////////////////////////////////////////////
for( int i = 0; i < polyList.OutlineCount(); ++i )
+64 -52
View File
@@ -40,7 +40,7 @@
#include "../3d_rendering/3d_render_raytracing/accelerators/ccontainer2d.h"
#include "../3d_rendering/3d_render_raytracing/shapes3D/ccylinder.h"
#include "../3d_rendering/3d_render_raytracing/shapes3D/clayeritem.h"
#include <openmp_mutex.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pad.h>
@@ -52,6 +52,9 @@
#include <trigo.h>
#include <utility>
#include <vector>
#include <thread>
#include <algorithm>
#include <atomic>
#include <profile.h>
@@ -788,36 +791,43 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// Add zones objects
// /////////////////////////////////////////////////////////////////////
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
std::atomic<size_t> nextZone( 0 );
std::atomic<size_t> threadsFinished( 0 );
size_t parallelThreadCount = std::max<size_t>( std::thread::hardware_concurrency(), 2 );
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
{
const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
if( aStatusTextReporter )
aStatusTextReporter->Report( wxString::Format( _( "Create zones of layer %s" ),
LSET::Name( curr_layer_id ) ) );
wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() );
CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id];
// ADD COPPER ZONES
for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
std::thread t = std::thread( [&]()
{
const ZONE_CONTAINER* zone = m_board->GetArea( ii );
const PCB_LAYER_ID zonelayer = zone->GetLayer();
if( zonelayer == curr_layer_id )
for( size_t areaId = nextZone.fetch_add( 1 );
areaId < static_cast<size_t>( m_board->GetAreaCount() );
areaId = nextZone.fetch_add( 1 ) )
{
AddSolidAreasShapesToContainer( zone,
layerContainer,
curr_layer_id );
const ZONE_CONTAINER* zone = m_board->GetArea( areaId );
if( zone == nullptr )
break;
auto layerContainer = m_layers_container2D.find( zone->GetLayer() );
if( layerContainer != m_layers_container2D.end() )
AddSolidAreasShapesToContainer( zone, layerContainer->second,
zone->GetLayer() );
}
}
threadsFinished++;
} );
t.detach();
}
while( threadsFinished < parallelThreadCount )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
}
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T13: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
printf( "fill zones T13: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
@@ -825,29 +835,18 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) &&
(m_render_engine == RENDER_ENGINE_OPENGL_LEGACY) )
{
// Add zones poly contourns
// /////////////////////////////////////////////////////////////////////
for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
// ADD COPPER ZONES
for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
{
const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
const ZONE_CONTAINER* zone = m_board->GetArea( ii );
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
if( zone == nullptr )
break;
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
auto layerContainer = m_layers_poly.find( zone->GetLayer() );
// ADD COPPER ZONES
for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
{
const ZONE_CONTAINER* zone = m_board->GetArea( ii );
const LAYER_NUM zonelayer = zone->GetLayer();
if( zonelayer == curr_layer_id )
{
zone->TransformSolidAreasShapesToPolygonSet( *layerPoly,
segcountforcircle,
correctionFactor );
}
}
if( layerContainer != m_layers_poly.end() )
zone->TransformSolidAreasShapesToPolygonSet( *layerContainer->second, segcountforcircle, correctionFactor );
}
}
@@ -865,22 +864,35 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) &&
(m_render_engine == RENDER_ENGINE_OPENGL_LEGACY) )
{
const int nLayers = layer_id.size();
std::atomic<size_t> nextItem( 0 );
std::atomic<size_t> threadsFinished( 0 );
#pragma omp parallel for
for( signed int lIdx = 0; lIdx < nLayers; ++lIdx )
size_t parallelThreadCount = std::min<size_t>(
std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
layer_id.size() );
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
{
const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
std::thread t = std::thread( [&nextItem, &threadsFinished, &layer_id, this]()
{
for( size_t i = nextItem.fetch_add( 1 );
i < layer_id.size();
i = nextItem.fetch_add( 1 ) )
{
auto layerPoly = m_layers_poly.find( layer_id[i] );
wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
if( layerPoly != m_layers_poly.end() )
// This will make a union of all added contours
layerPoly->second->Simplify( SHAPE_POLY_SET::PM_FAST );
}
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
threadsFinished++;
} );
wxASSERT( layerPoly != NULL );
// This will make a union of all added contourns
layerPoly->Simplify( SHAPE_POLY_SET::PM_FAST );
t.detach();
}
while( threadsFinished < parallelThreadCount )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
}
#ifdef PRINT_STATISTICS_3D_VIEWER
+1 -1
View File
@@ -1052,7 +1052,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
m_settings.CameraGet().RotateX_T1( glm::radians( -180.0f ) );
m_settings.CameraGet().RotateY_T1( glm::radians( 180.0f ) );
request_start_moving_camera(
glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
return true;
@@ -369,7 +369,8 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER *aStatusTextReporter )
// /////////////////////////////////////////////////////////////////////////
CCONTAINER2D boardContainer;
Convert_shape_line_polygon_to_triangles( m_settings.GetBoardPoly(),
SHAPE_POLY_SET tmpBoard = m_settings.GetBoardPoly();
Convert_shape_line_polygon_to_triangles( tmpBoard,
boardContainer,
m_settings.BiuTo3Dunits(),
(const BOARD_ITEM &)*m_settings.GetBoard() );
@@ -30,6 +30,9 @@
#include "clayer_triangles.h"
#include <wx/debug.h> // For the wxASSERT
#include <mutex>
#include <thread>
#include <atomic>
CLAYER_TRIANGLE_CONTAINER::CLAYER_TRIANGLE_CONTAINER( unsigned int aNrReservedTriangles,
@@ -219,8 +222,8 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const std::vector< SFVEC2F > &aCont
const SFVEC2F &v0 = aContournPoints[i + 0];
const SFVEC2F &v1 = aContournPoints[i + 1];
#pragma omp critical
{
std::lock_guard<std::mutex> lock( m_middle_layer_lock );
m_layer_middle_contourns_quads->AddQuad( SFVEC3F( v0.x, v0.y, zTop ),
SFVEC3F( v1.x, v1.y, zTop ),
SFVEC3F( v1.x, v1.y, zBot ),
@@ -305,21 +308,41 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const SHAPE_POLY_SET &aPolySet,
m_layer_middle_contourns_quads->Reserve_More( nrContournPointsToReserve * 2,
true );
#pragma omp parallel for
for( signed int i = 0; i < aPolySet.OutlineCount(); ++i )
std::atomic<int> nextItem( 0 );
std::atomic<size_t> threadsFinished( 0 );
size_t parallelThreadCount = std::min<size_t>(
std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
static_cast<size_t>( aPolySet.OutlineCount() ) );
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
{
// Add outline
const SHAPE_LINE_CHAIN& pathOutline = aPolySet.COutline( i );
AddToMiddleContourns( pathOutline, zBot, zTop, aBiuTo3Du, aInvertFaceDirection );
// Add holes for this outline
for( int h = 0; h < aPolySet.HoleCount( i ); ++h )
std::thread t = std::thread( [&]()
{
const SHAPE_LINE_CHAIN &hole = aPolySet.CHole( i, h );
AddToMiddleContourns( hole, zBot, zTop, aBiuTo3Du, aInvertFaceDirection );
}
for( int i = nextItem.fetch_add( 1 );
i < aPolySet.OutlineCount();
i = nextItem.fetch_add( 1 ) )
{
// Add outline
const SHAPE_LINE_CHAIN& pathOutline = aPolySet.COutline( i );
AddToMiddleContourns( pathOutline, zBot, zTop, aBiuTo3Du, aInvertFaceDirection );
// Add holes for this outline
for( int h = 0; h < aPolySet.HoleCount( i ); ++h )
{
const SHAPE_LINE_CHAIN &hole = aPolySet.CHole( i, h );
AddToMiddleContourns( hole, zBot, zTop, aBiuTo3Du, aInvertFaceDirection );
}
}
threadsFinished++;
} );
t.detach();
}
while( threadsFinished < parallelThreadCount )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
}
@@ -35,6 +35,7 @@
#include <geometry/shape_line_chain.h>
#include <geometry/shape_poly_set.h>
#include <vector>
#include <mutex>
typedef std::vector< SFVEC3F > SFVEC3F_VECTOR;
@@ -174,6 +175,8 @@ public:
float zTop,
bool aInvertFaceDirection );
std::mutex m_middle_layer_lock;
CLAYER_TRIANGLE_CONTAINER *m_layer_top_segment_ends;
CLAYER_TRIANGLE_CONTAINER *m_layer_top_triangles;
CLAYER_TRIANGLE_CONTAINER *m_layer_middle_contourns_quads;
@@ -29,6 +29,7 @@
#include "ccontainer2d.h"
#include <vector>
#include <mutex>
#include <boost/range/algorithm/partition.hpp>
#include <boost/range/algorithm/nth_element.hpp>
#include <wx/debug.h>
@@ -46,6 +47,7 @@ CGENERICCONTAINER2D::CGENERICCONTAINER2D( OBJECT2D_TYPE aObjType )
void CGENERICCONTAINER2D::Clear()
{
std::lock_guard<std::mutex> lock( m_lock );
m_bbox.Reset();
for( LIST_OBJECT2D::iterator ii = m_objects.begin();
@@ -32,6 +32,7 @@
#include "../shapes2D/cobject2d.h"
#include <list>
#include <mutex>
typedef std::list<COBJECT2D *> LIST_OBJECT2D;
typedef std::list<const COBJECT2D *> CONST_LIST_OBJECT2D;
@@ -52,6 +53,7 @@ public:
{
if( aObject ) // Only add if it is a valid pointer
{
std::lock_guard<std::mutex> lock( m_lock );
m_objects.push_back( aObject );
m_bbox.Union( aObject->GetBBox() );
}
@@ -70,6 +72,7 @@ public:
CONST_LIST_OBJECT2D &aOutList ) const = 0;
private:
std::mutex m_lock;
};
File diff suppressed because it is too large Load Diff
@@ -131,7 +131,7 @@ private:
unsigned long int m_stats_start_rendering_time;
/// Save the number of blocks progress of the render
long m_nrBlocksRenderProgress;
size_t m_nrBlocksRenderProgress;
CPOSTSHADER_SSAO m_postshader_ssao;
@@ -165,7 +165,7 @@ private:
std::vector< SFVEC2UI > m_blockPositions;
/// this flags if a position was already processed (cleared each new render)
std::vector< bool > m_blockPositionsWasProcessed;
std::vector< int > m_blockPositionsWasProcessed;
/// this encodes the Morton code positions (on fast preview mode)
std::vector< SFVEC2UI > m_blockPositionsFast;
@@ -35,9 +35,9 @@
#include <wx/glcanvas.h> // CALLBACK definition, needed on Windows
// alse needed on OSX to define __DARWIN__
#include <geometry/polygon_triangulation.h>
#include "../../../3d_fastmath.h"
#include <poly2tri/poly2tri.h>
CTRIANGLE2D::CTRIANGLE2D ( const SFVEC2F &aV1,
@@ -126,172 +126,28 @@ bool CTRIANGLE2D::IsPointInside( const SFVEC2F &aPoint ) const
const float c = 1.0f - a - b;
return 0.0f <= c && c <= 1.0f;
/*
return 0.0f <= a && a <= 1.0f &&
0.0f <= b && b <= 1.0f &&
0.0f <= c && c <= 1.0f;*/
}
template <class C> void FreeClear( C & cntr )
{
for( typename C::iterator it = cntr.begin();
it != cntr.end();
++it )
{
delete * it;
}
cntr.clear();
}
// Note: Please check edgeshrink.cpp in order to learn the EdgeShrink propose
#define APPLY_EDGE_SHRINK
#ifdef APPLY_EDGE_SHRINK
extern void EdgeShrink( std::vector<SFVEC2I64> &aPath );
#define POLY_SCALE_FACT 256
#define POLY_SCALE_FACT_INVERSE (1.0 / (double)(POLY_SCALE_FACT))
#endif
void Convert_shape_line_polygon_to_triangles( const SHAPE_POLY_SET &aPolyList,
void Convert_shape_line_polygon_to_triangles( SHAPE_POLY_SET &aPolyList,
CGENERICCONTAINER2D &aDstContainer,
float aBiuTo3DunitsScale ,
const BOARD_ITEM &aBoardItem )
{
unsigned int nOutlines = aPolyList.OutlineCount();
aPolyList.CacheTriangulation();
const double conver_d = (double)aBiuTo3DunitsScale;
for( unsigned int idx = 0; idx < nOutlines; ++idx )
for( unsigned int i = 0; i < aPolyList.TriangulatedPolyCount(); i++ )
{
const SHAPE_LINE_CHAIN &outlinePath = aPolyList.COutline( idx );
auto triPoly = aPolyList.TriangulatedPolygon( i );
wxASSERT( outlinePath.PointCount() >= 3 );
std::vector<SFVEC2I64> scaledOutline;
scaledOutline.resize( outlinePath.PointCount() );
// printf("\nidx: %u\n", idx);
// Apply a scale to the points
for( unsigned int i = 0;
i < (unsigned int)outlinePath.PointCount();
++i )
for( size_t i = 0; i < triPoly->GetTriangleCount(); i++ )
{
const VECTOR2I& a = outlinePath.CPoint( i );
#ifdef APPLY_EDGE_SHRINK
scaledOutline[i] = SFVEC2I64( (glm::int64)a.x * POLY_SCALE_FACT,
(glm::int64)a.y * POLY_SCALE_FACT );
#else
scaledOutline[i] = SFVEC2I64( (glm::int64)a.x,
(glm::int64)a.y );
#endif
}
#ifdef APPLY_EDGE_SHRINK
// Apply a modification to the points
EdgeShrink( scaledOutline );
#endif
// Copy to a array of pointers
std::vector<p2t::Point*> polyline;
polyline.resize( outlinePath.PointCount() );
for( unsigned int i = 0;
i < (unsigned int)scaledOutline.size();
++i )
{
const SFVEC2I64 &a = scaledOutline[i];
//printf("%lu %lu\n", a.x, a.y);
polyline[i] = new p2t::Point( (double)a.x,
(double)a.y );
}
// Start creating the structured to be triangulated
p2t::CDT* cdt = new p2t::CDT( polyline );
// Add holes for this outline
unsigned int nHoles = aPolyList.HoleCount( idx );
std::vector< std::vector<p2t::Point*> > polylineHoles;
polylineHoles.resize( nHoles );
for( unsigned int idxHole = 0; idxHole < nHoles; ++idxHole )
{
const SHAPE_LINE_CHAIN &outlineHoles = aPolyList.CHole( idx,
idxHole );
wxASSERT( outlineHoles.PointCount() >= 3 );
std::vector<SFVEC2I64> scaledHole;
scaledHole.resize( outlineHoles.PointCount() );
// Apply a scale to the points
for( unsigned int i = 0;
i < (unsigned int)outlineHoles.PointCount();
++i )
{
const VECTOR2I &h = outlineHoles.CPoint( i );
#ifdef APPLY_EDGE_SHRINK
scaledHole[i] = SFVEC2I64( (glm::int64)h.x * POLY_SCALE_FACT,
(glm::int64)h.y * POLY_SCALE_FACT );
#else
scaledHole[i] = SFVEC2I64( (glm::int64)h.x,
(glm::int64)h.y );
#endif
}
#ifdef APPLY_EDGE_SHRINK
// Apply a modification to the points
EdgeShrink( scaledHole );
#endif
// Resize and reserve space
polylineHoles[idxHole].resize( outlineHoles.PointCount() );
for( unsigned int i = 0;
i < (unsigned int)outlineHoles.PointCount();
++i )
{
const SFVEC2I64 &h = scaledHole[i];
polylineHoles[idxHole][i] = new p2t::Point( h.x, h.y );
}
cdt->AddHole( polylineHoles[idxHole] );
}
// Triangulate
cdt->Triangulate();
// Hint: if you find any crashes on the triangulation poly2tri library,
// you can use the following site to debug the points and it will mark
// the errors in the polygon:
// http://r3mi.github.io/poly2tri.js/
// Get and add triangles
std::vector<p2t::Triangle*> triangles;
triangles = cdt->GetTriangles();
#ifdef APPLY_EDGE_SHRINK
const double conver_d = (double)aBiuTo3DunitsScale *
POLY_SCALE_FACT_INVERSE;
#else
const double conver_d = (double)aBiuTo3DunitsScale;
#endif
for( unsigned int i = 0; i < triangles.size(); ++i )
{
p2t::Triangle& t = *triangles[i];
p2t::Point& a = *t.GetPoint( 0 );
p2t::Point& b = *t.GetPoint( 1 );
p2t::Point& c = *t.GetPoint( 2 );
VECTOR2I a;
VECTOR2I b;
VECTOR2I c;
triPoly->GetTriangle( i, a, b, c );
aDstContainer.Add( new CTRIANGLE2D( SFVEC2F( a.x * conver_d,
-a.y * conver_d ),
@@ -302,15 +158,5 @@ void Convert_shape_line_polygon_to_triangles( const SHAPE_POLY_SET &aPolyList,
aBoardItem ) );
}
// Delete created data
delete cdt;
// Free points
FreeClear(polyline);
for( unsigned int idxHole = 0; idxHole < nHoles; ++idxHole )
{
FreeClear( polylineHoles[idxHole] );
}
}
}
@@ -68,7 +68,7 @@ public:
};
void Convert_shape_line_polygon_to_triangles( const SHAPE_POLY_SET &aPolyList,
void Convert_shape_line_polygon_to_triangles( SHAPE_POLY_SET &aPolyList,
CGENERICCONTAINER2D &aDstContainer,
float aBiuTo3DunitsScale,
const BOARD_ITEM &aBoardItem );
@@ -1,89 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2016 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file edgeshrink.cpp
* @brief The edgeShrink function was found in the project clip2tri by the:
* Bitfighter project (http://bitfighter.org)
* https://github.com/raptor/clip2tri
* https://github.com/raptor/clip2tri/blob/f62a734d22733814b8a970ed8a68a4d94c24fa5f/clip2tri/clip2tri.cpp#L150
*/
#include <plugins/3dapi/xv3d_types.h>
#include <vector>
// clip2tri is Licenced under:
// The MIT License (MIT)
// Copyright (c) 2014 Bitfighter developers
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// Shrink large polygons by reducing each coordinate by 1 in the
// general direction of the last point as we wind around
//
// This normally wouldn't work in every case, but our upscaled-by-1000 polygons
// have little chance to create new duplicate points with this method.
//
// For information on why this was needed, see:
//
// https://github.com/greenm01/poly2tri/issues/90
//
#define S_INC 1
void EdgeShrink( std::vector<SFVEC2I64> &aPath )
{
unsigned int prev = aPath.size() - 1;
for( unsigned int i = 0; i < aPath.size(); i++ )
{
// Adjust coordinate by 1 depending on the direction
(aPath[i].x - aPath[prev].x) > 0 ? aPath[i].x -= S_INC :
aPath[i].x += S_INC;
(aPath[i].y - aPath[prev].y) > 0 ? aPath[i].y -= S_INC :
aPath[i].y += S_INC;
prev = i;
}
}
+39 -18
View File
@@ -31,6 +31,10 @@
#include "buffers_debug.h"
#include <string.h> // For memcpy
#include <atomic>
#include <thread>
#include <chrono>
#ifndef CLAMP
#define CLAMP(n, min, max) {if( n < min ) n=min; else if( n > max ) n = max;}
#endif
@@ -469,34 +473,51 @@ void CIMAGE::EfxFilter( CIMAGE *aInImg, E_FILTER aFilterType )
aInImg->m_wraping = WRAP_CLAMP;
m_wraping = WRAP_CLAMP;
#pragma omp parallel for
for( int iy = 0; iy < (int)m_height; iy++)
std::atomic<size_t> nextRow( 0 );
std::atomic<size_t> threadsFinished( 0 );
size_t parallelThreadCount = std::max<size_t>( std::thread::hardware_concurrency(), 2 );
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
{
for( int ix = 0; ix < (int)m_width; ix++ )
std::thread t = std::thread( [&]()
{
int v = 0;
for( int sy = 0; sy < 5; sy++ )
for( size_t iy = nextRow.fetch_add( 1 );
iy < m_height;
iy = nextRow.fetch_add( 1 ) )
{
for( int sx = 0; sx < 5; sx++ )
for( size_t ix = 0; ix < m_width; ix++ )
{
int factor = filter.kernel[sx][sy];
unsigned char pixelv = aInImg->Getpixel( ix + sx - 2,
iy + sy - 2 );
int v = 0;
v += pixelv * factor;
for( size_t sy = 0; sy < 5; sy++ )
{
for( size_t sx = 0; sx < 5; sx++ )
{
int factor = filter.kernel[sx][sy];
unsigned char pixelv = aInImg->Getpixel( ix + sx - 2,
iy + sy - 2 );
v += pixelv * factor;
}
}
v /= filter.div;
v += filter.offset;
CLAMP(v, 0, 255);
//TODO: This needs to write to a separate buffer
m_pixels[ix + iy * m_width] = v;
}
}
v /= filter.div;
threadsFinished++;
} );
v += filter.offset;
CLAMP(v, 0, 255);
m_pixels[ix + iy * m_width] = v;
}
t.detach();
}
while( threadsFinished < parallelThreadCount )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
}
-6
View File
@@ -40,11 +40,6 @@ set(3D-VIEWER_SRCS
${DIR_DLG}/dlg_select_3dmodel.cpp
${DIR_DLG}/panel_prev_3d_base.cpp
${DIR_DLG}/panel_prev_model.cpp
../polygon/poly2tri/common/shapes.cc
../polygon/poly2tri/sweep/advancing_front.cc
../polygon/poly2tri/sweep/cdt.cc
../polygon/poly2tri/sweep/sweep.cc
../polygon/poly2tri/sweep/sweep_context.cc
3d_canvas/cinfo3d_visu.cpp
3d_canvas/create_layer_items.cpp
3d_canvas/create_3Dgraphic_brd_items.cpp
@@ -79,7 +74,6 @@ set(3D-VIEWER_SRCS
${DIR_RAY_2D}/cring2d.cpp
${DIR_RAY_2D}/croundsegment2d.cpp
${DIR_RAY_2D}/ctriangle2d.cpp
${DIR_RAY_2D}/edgeshrink.cpp
${DIR_RAY_3D}/cbbox.cpp
${DIR_RAY_3D}/cbbox_ray.cpp
${DIR_RAY_3D}/ccylinder.cpp
-81
View File
@@ -1,81 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2016 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file openmp_mutex.h
* @brief a mutex for openmp got from the website:
* http://bisqwit.iki.fi/story/howto/openmp/
* by Joel Yliluoma <bisqwit@iki.fi>
*/
#ifndef _OPENMP_MUTEX_H
#define _OPENMP_MUTEX_H
#ifdef _OPENMP
# include <omp.h>
struct MutexType
{
MutexType() { omp_init_lock( &lock ); }
~MutexType() { omp_destroy_lock( &lock ); }
void Lock() { omp_set_lock( &lock ); }
void Unlock() { omp_unset_lock( &lock ); }
MutexType( const MutexType& ) { omp_init_lock( &lock ); }
MutexType& operator= ( const MutexType& ) { return *this; }
public:
omp_lock_t lock;
};
#else
/// A dummy mutex that doesn't actually exclude anything,
/// but as there is no parallelism either, no worries.
struct MutexType
{
void Lock() {}
void Unlock() {}
};
#endif
/// An exception-safe scoped lock-keeper.
struct ScopedLock
{
explicit ScopedLock( MutexType& m ) : mut( m ), locked( true ) { mut.Lock(); }
~ScopedLock() { Unlock(); }
void Unlock() { if( !locked ) return; locked = false; mut.Unlock(); }
void LockAgain() { if( locked ) return; mut.Lock(); locked = true; }
private:
MutexType& mut;
bool locked;
private: // prevent copying the scoped lock.
void operator=(const ScopedLock&);
ScopedLock(const ScopedLock&);
};
#endif // _OPENMP_MUTEX_H
+25 -25
View File
@@ -30,8 +30,6 @@ if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW) # CMake 3.0
endif()
project( kicad )
# Default to CMAKE_BUILD_TYPE = Release unless overridden on command line
# http://www.cmake.org/pipermail/cmake/2008-September/023808.html
if( DEFINED CMAKE_BUILD_TYPE )
@@ -40,11 +38,20 @@ else()
set( CMAKE_BUILD_TYPE Release CACHE STRING "Set to either \"Release\" or \"Debug\"" )
endif()
project( kicad )
include( GNUInstallDirs )
# Path to local CMake modules.
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
# On Windows, binaries created by link option -g3 are very large (more than 1Gb for pcbnew,
# and more than 3Gb for the full kicad suite)
# This option create binaries using link option -g1 that create much smaller files, but
# there are less info in debug (but the file names and line numbers are available)
option( BUILD_SMALL_DEBUG_FILES "In debug build: create smaller binaries." OFF )
#
# KiCad build options should be added below.
#
@@ -72,8 +79,8 @@ option( KICAD_SCRIPTING_WXPYTHON
ON )
option( KICAD_SCRIPTING_ACTION_MENU
"Build a tools menu with registred python plugins: actions plugins (default OFF)."
)
"Build a tools menu with registered python plugins: actions plugins (default ON)."
ON )
option( KICAD_USE_OCE
"Build tools and plugins related to OpenCascade Community Edition (default ON)"
@@ -274,8 +281,18 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}" )
set( CMAKE_C_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG -Wno-deprecated-declarations" )
# Link flags in Debug: -g1 and -ggdb1 or -g1 and -ggdb3 can be used.
# Level 1 produces minimal information, enough for making basic backtraces.
# This includes descriptions of functions and external variables, and line number tables,
# but no information about local variables.
# Level 3 includes full information, but binaries are much larger.
if( BUILD_SMALL_DEBUG_FILES )
set( CMAKE_C_FLAGS_DEBUG "-g1 -ggdb1 -DDEBUG" )
set( CMAKE_CXX_FLAGS_DEBUG "-g1 -ggdb1 -DDEBUG -Wno-deprecated-declarations" )
else()
set( CMAKE_C_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG -Wno-deprecated-declarations" )
endif()
if( MINGW )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
@@ -526,24 +543,6 @@ include( ExternalProject )
#================================================
include( CheckFindPackageResult )
#
# Find OpenMP support, optional
#
find_package( OpenMP )
if( OPENMP_FOUND )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
add_definitions( -DUSE_OPENMP )
# MinGW does not include the OpenMP link library and FindOpenMP.cmake does not
# set it either. Not sure this is the most elegant solution but it works.
if( MINGW )
set( OPENMP_LIBRARIES gomp )
endif()
endif()
#
# Find wxWidgets library, required
#
@@ -579,7 +578,7 @@ endif()
#
# Find OpenGL library, required
#
set( OpenGL_GL_PREFERENCE "GLVND" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
find_package( OpenGL REQUIRED )
#
@@ -912,6 +911,7 @@ if( UNIX AND NOT APPLE )
endif()
#include( CTest )
enable_testing()
if( UNIX AND NOT APPLE )
+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.0.0" )
set( KICAD_VERSION "5.0.1" )
+3
View File
@@ -72,4 +72,7 @@
#define KIFACE_SUFFIX "@KIFACE_SUFFIX@"
#define KIFACE_PREFIX "@KIFACE_PREFIX@"
/// Allows scripts install directory to be referenced by the program code.
#define PYTHON_DEST "@PYTHON_DEST@"
#endif // CONFIG_H_
+5 -5
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -119,12 +119,12 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
brightSizer->Add( m_buttonLoad, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonExport = new wxButton( m_panelRight, wxID_ANY, _("Export"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonExport->SetToolTip( _("Create a library file for Eeschema\nThis library contains only one component: logo") );
brightSizer->Add( m_buttonExport, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
brightSizer->Add( m_buttonExport, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxString m_radioBoxFormatChoices[] = { _("Eeschema (.lib file)"), _("Pcbnew (.kicad_mod file)"), _("Postscript (.ps file)"), _("Logo for title block (.kicad_wks file)") };
int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString );
@@ -142,7 +142,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
m_sliderThreshold = new wxSlider( sbSizer2->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
sbSizer2->Add( m_sliderThreshold, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizer2->Add( m_sliderThreshold, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_checkNegative = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Negative"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_checkNegative, 0, wxBOTTOM|wxTOP, 10 );
@@ -153,7 +153,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
wxString m_radio_PCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") };
int m_radio_PCBLayerNChoices = sizeof( m_radio_PCBLayerChoices ) / sizeof( wxString );
m_radio_PCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline:"), wxDefaultPosition, wxDefaultSize, m_radio_PCBLayerNChoices, m_radio_PCBLayerChoices, 1, wxRA_SPECIFY_COLS );
m_radio_PCBLayer->SetSelection( 3 );
m_radio_PCBLayer->SetSelection( 0 );
m_radio_PCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe 2 invisible fields reference and value are always placed on the silk screen layer.") );
brightSizer->Add( m_radio_PCBLayer, 0, wxALL|wxEXPAND, 5 );
+4 -4
View File
@@ -1813,7 +1813,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -1901,7 +1901,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -2175,7 +2175,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxSlider" expanded="1">
<property name="BottomDockable">1</property>
@@ -2421,7 +2421,7 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">3</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+2 -2
View File
@@ -305,8 +305,7 @@ set( BMAPS_MID
label2glabel
label2text
label
lang_catalan
lang_chinese
lang_ca
lang_bg
lang_cs
lang_def
@@ -327,6 +326,7 @@ set( BMAPS_MID
lang_sk
lang_sl
lang_lt
lang_zh
language
layers_manager
leave_sheet
@@ -25,6 +25,6 @@ static const unsigned char png[] = {
0x2b, 0xeb, 0x17, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE lang_chinese_xpm[1] = {{ png, sizeof( png ), "lang_chinese_xpm" }};
const BITMAP_OPAQUE lang_zh_xpm[1] = {{ png, sizeof( png ), "lang_zh_xpm" }};
//EOF

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -13,7 +13,7 @@
version="1.1"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="lang_chinese.svg">
sodipodi:docname="lang_zh.svg">
<metadata
id="metadata21">
<rdf:RDF>

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

+1
View File
@@ -19,6 +19,7 @@ include_directories(
${INC_AFTER}
${OCE_INCLUDE_DIRS}
${OCC_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
)
+3 -3
View File
@@ -66,9 +66,9 @@ LOCALE_IO::LOCALE_IO()
if( m_c_count++ == 0 )
{
// Store the user locale name, to restore this locale later, in dtor
m_user_locale = setlocale( LC_ALL, 0 );
m_user_locale = setlocale( LC_NUMERIC, nullptr );
// Switch the locale to C locale, to read/write files with fp numbers
setlocale( LC_ALL, "C" );
setlocale( LC_NUMERIC, "C" );
}
}
@@ -79,7 +79,7 @@ LOCALE_IO::~LOCALE_IO()
if( --m_c_count == 0 )
{
// revert to the user locale
setlocale( LC_ALL, m_user_locale.c_str() );
setlocale( LC_NUMERIC, m_user_locale.c_str() );
}
}
+10 -6
View File
@@ -72,13 +72,17 @@ void KIDIALOG::ForceShowAgain()
bool KIDIALOG::Show( bool aShow )
{
// Check if this dialog should be shown to the user
auto it = doNotShowAgainDlgs.find( m_hash );
// We should check the do-not-show-again setting only when the dialog is displayed
if( aShow )
{
// Check if this dialog should be shown to the user
auto it = doNotShowAgainDlgs.find( m_hash );
if( it != doNotShowAgainDlgs.end() )
return it->second;
if( it != doNotShowAgainDlgs.end() )
return it->second;
}
bool ret = wxRichMessageDialog::Show();
bool ret = wxRichMessageDialog::Show( aShow );
// Has the user asked not to show the dialog again
if( IsCheckBoxChecked() )
@@ -233,7 +237,7 @@ void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxSt
bool IsOK( wxWindow* aParent, const wxString& aMessage )
{
wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
wxYES_NO | wxCENTRE | wxICON_QUESTION );
wxYES_NO | wxCENTRE | wxICON_QUESTION | wxSTAY_ON_TOP );
return dlg.ShowModal() == wxID_YES;
}
+5
View File
@@ -369,6 +369,11 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
wxEmptyString,
"Bulgarian (BG)",
aInfo.CreateKiBitmap( lang_bg_xpm ) ) );
aInfo.AddTranslator( new CONTRIBUTOR( "Liu Guang",
wxEmptyString,
wxEmptyString,
"Simplified Chinese (zh_CN)",
aInfo.CreateKiBitmap( lang_zh_xpm ) ) );
// Maintainer who helper in translations, but not in a specific translation
#define OTHERS_IN_TRANSLATION _( "Others" )
+7 -2
View File
@@ -255,13 +255,18 @@ static void fixOSXCancelButtonIssue( wxWindow *aWindow )
// copying the text if a button with wxID_CANCEL is used in a
// wxStdDialogButtonSizer created by wxFormBuilder: the label is &Cancel, and
// this accelerator key has priority over the standard copy accelerator.
// Note: problem also exists in other languages; for instance cmd+a closes
// dialogs in German because the button is &Abbrechen.
wxButton* button = dynamic_cast<wxButton*>( wxWindow::FindWindowById( wxID_CANCEL, aWindow ) );
if( button )
{
static const wxString placeholder = wxT( "{amp}" );
wxString buttonLabel = button->GetLabel();
buttonLabel.Replace( wxT( "&C" ), wxT( "C" ) );
buttonLabel.Replace( wxT( "&c" ), wxT( "c" ) );
buttonLabel.Replace( wxT( "&&" ), placeholder );
buttonLabel.Replace( wxT( "&" ), wxEmptyString );
buttonLabel.Replace( placeholder, wxT( "&" ) );
button->SetLabel( buttonLabel );
}
}
+3 -3
View File
@@ -193,7 +193,7 @@ bool DIALOG_ENV_VAR_CONFIG::GetPathAtIndex( unsigned int aIndex, wxString& aEnvV
void DIALOG_ENV_VAR_CONFIG::OnAddButton( wxCommandEvent& event )
{
DIALOG_ENV_VAR_SINGLE dlg( nullptr, wxEmptyString, wxEmptyString );
DIALOG_ENV_VAR_SINGLE dlg( this, wxEmptyString, wxEmptyString );
if( dlg.ShowModal() == wxID_OK )
{
@@ -230,7 +230,7 @@ void DIALOG_ENV_VAR_CONFIG::EditSelectedEntry()
if( GetPathAtIndex( m_pathIndex, envName, envPath ) )
{
auto dlg = new DIALOG_ENV_VAR_SINGLE( nullptr, envName, envPath );
auto dlg = new DIALOG_ENV_VAR_SINGLE( this, envName, envPath );
if( IsEnvVarImmutable( envName ) )
{
@@ -432,7 +432,7 @@ void DIALOG_ENV_VAR_SINGLE::OnSelectPath( wxCommandEvent& event )
wxString title = _( "Select Path for Environment Variable" );
wxString path; // Currently the first opened path is not initialized
wxDirDialog dlg( nullptr, title, path, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
wxDirDialog dlg( this, title, path, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
if( dlg.ShowModal() == wxID_OK )
m_envVarPath->SetValue( dlg.GetPath() );
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -43,15 +43,14 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
b_buttonsSizer->Add( m_sdbSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
b_buttonsSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
m_mainSizer->Add( b_buttonsSizer, 0, wxALIGN_RIGHT|wxEXPAND, 5 );
m_mainSizer->Add( b_buttonsSizer, 0, wxEXPAND, 5 );
this->SetSizer( m_mainSizer );
this->Layout();
m_mainSizer->Fit( this );
// Connect Events
m_resetButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::ResetClicked ), NULL, this );
@@ -14,6 +14,7 @@
<property name="file">dialog_hotkeys_editor_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_hotkeys_editor_base</property>
<property name="namespace"></property>
@@ -44,7 +45,7 @@
<property name="minimum_size"></property>
<property name="name">HOTKEYS_EDITOR_DIALOG_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">513,445</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Hotkeys Editor</property>
@@ -88,7 +89,7 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_mainSizer</property>
<property name="orient">wxVERTICAL</property>
@@ -256,11 +257,11 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxEXPAND</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">b_buttonsSizer</property>
<property name="orient">wxHORIZONTAL</property>
@@ -453,7 +454,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="0">
<property name="Apply">0</property>
+2 -2
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -50,7 +50,7 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public DIALOG_SHIM
public:
HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 513,445 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~HOTKEYS_EDITOR_DIALOG_BASE();
};
+5 -2
View File
@@ -1395,6 +1395,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnKeyEvent %s", dump( event ) );
localkey = event.GetKeyCode();
bool keyWasHandled = false;
switch( localkey )
{
@@ -1408,6 +1409,8 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
EndMouseCapture();
else
EndMouseCapture( ID_NO_TOOL_SELECTED, m_defaultCursor, wxEmptyString );
keyWasHandled = true; // The key is captured: the key event must not be skipped
break;
}
@@ -1446,8 +1449,8 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
GetParent()->SetMousePosition( pos );
if( !GetParent()->GeneralControl( &DC, pos, localkey ) )
event.Skip();
if( !GetParent()->GeneralControl( &DC, pos, localkey ) && !keyWasHandled )
event.Skip(); // Skip this event only when the key was not handled
}
+6 -2
View File
@@ -147,6 +147,12 @@ void EDA_DRAW_PANEL_GAL::SetFocus()
void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
{
m_viewControls->UpdateScrollbars();
// Drawing to a zero-width or zero-height GAL is fraught with peril.
if( GetClientRect().IsEmpty() )
return;
m_pendingRefresh = false;
if( m_drawing )
@@ -161,8 +167,6 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_drawing = true;
KIGFX::RENDER_SETTINGS* settings = static_cast<KIGFX::RENDER_SETTINGS*>( m_painter->GetSettings() );
m_viewControls->UpdateScrollbars();
try
{
m_view->UpdateItems();
+8 -9
View File
@@ -56,17 +56,16 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
if( aFootprintName.IsEmpty() )
return NULL;
LIB_ID fpid;
wxCHECK_MSG( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) < 0, NULL,
wxString::Format( wxT( "\"%s\" is not a valid LIB_ID." ), aFootprintName ) );
wxString libNickname = fpid.GetLibNickname();
wxString footprintName = fpid.GetLibItemName();
for( auto& fp : m_list )
{
LIB_ID fpid;
wxCHECK_MSG( fpid.Parse( aFootprintName ) < 0, NULL,
wxString::Format(
wxT( "\"%s\" is not a valid LIB_ID." ), GetChars( aFootprintName ) ) );
wxString libNickname = fpid.GetLibNickname();
wxString footprintName = fpid.GetLibItemName();
if( libNickname == fp->GetNickname() && footprintName == fp->GetFootprintName() )
return &*fp;
}
+56
View File
@@ -33,6 +33,7 @@
#include <gal/cairo/cairo_compositor.h>
#include <gal/definitions.h>
#include <geometry/shape_poly_set.h>
#include <bitmap_base.h>
#include <limits>
@@ -347,6 +348,61 @@ void CAIRO_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControl
}
void CAIRO_GAL::DrawBitmap( const BITMAP_BASE& aBitmap )
{
int ppi = aBitmap.GetPPI();
double worldIU_per_mm = 1/(worldUnitLength/2.54)/1000;
double pix_size_iu = worldIU_per_mm * ( 25.4 / ppi );
int w = aBitmap.GetSizePixels().x;
int h = aBitmap.GetSizePixels().y;
cairo_save( currentContext );
// Set the pixel scaling factor:
cairo_scale( currentContext, pix_size_iu, pix_size_iu );
// The position of the bitmap is the bitmap center.
// move the draw origin to the top left bitmap corner:
cairo_translate( currentContext, -w/2, -h/2 );
cairo_new_path( currentContext );
cairo_surface_t *image;
image = cairo_image_surface_create( CAIRO_FORMAT_RGB24, w, h );
cairo_surface_flush( image );
unsigned char* pix_buffer = cairo_image_surface_get_data( image );
// The pixel buffer of the initial bitmap:
auto bm_pix_buffer = (( BITMAP_BASE&)aBitmap).GetImageData();
// Copy the source bitmap to the cairo bitmap buffer.
// In cairo bitmap buffer, a RGB24 bitmap is a RGB pixel packed into a uint_32
// 24 low bits only are used.
for( int row = 0; row < h; row++ )
{
for( int col = 0; col < w; col++ )
{
// Build the RGB24 pixel:
uint32_t pixel = bm_pix_buffer->GetRed( col, row ) << 16;
pixel += bm_pix_buffer->GetGreen( col, row ) << 8;
pixel += bm_pix_buffer->GetBlue( col, row );
// Write the pixel to the cairo image buffer:
uint32_t* pix_ptr = (uint32_t*) pix_buffer;
*pix_ptr = pixel;
pix_buffer += 4;
}
}
cairo_surface_mark_dirty( image );
cairo_set_source_surface( currentContext, image, 0, 0 );
cairo_paint( currentContext );
cairo_surface_destroy( image );
isElementAdded = true;
cairo_restore( currentContext );
}
void CAIRO_GAL::ResizeScreen( int aWidth, int aHeight )
{
screenSize = VECTOR2I( aWidth, aHeight );
+159 -7
View File
@@ -32,6 +32,7 @@
#include <gl_context_mgr.h>
#include <geometry/shape_poly_set.h>
#include <text_utils.h>
#include <bitmap_base.h>
#include <macros.h>
@@ -63,6 +64,101 @@ GLuint OPENGL_GAL::fontTexture = 0;
bool OPENGL_GAL::isBitmapFontLoaded = false;
SHADER* OPENGL_GAL::shader = NULL;
namespace KIGFX {
class GL_BITMAP_CACHE
{
public:
GL_BITMAP_CACHE()
{
}
~GL_BITMAP_CACHE();
GLuint RequestBitmap( const BITMAP_BASE* aBitmap );
private:
struct CACHED_BITMAP
{
GLuint id;
int w, h;
};
GLuint cacheBitmap( const BITMAP_BASE* aBitmap );
std::map<const BITMAP_BASE*, CACHED_BITMAP> m_bitmaps;
};
};
GL_BITMAP_CACHE::~GL_BITMAP_CACHE()
{
for ( auto b = m_bitmaps.begin(); b != m_bitmaps.end(); ++b )
{
glDeleteTextures( 1, &b->second.id );
}
}
GLuint GL_BITMAP_CACHE::RequestBitmap( const BITMAP_BASE* aBitmap )
{
auto it = m_bitmaps.find( aBitmap) ;
if ( it != m_bitmaps.end() )
{
return it->second.id;
}
else
{
return cacheBitmap( aBitmap );
}
}
GLuint GL_BITMAP_CACHE::cacheBitmap( const BITMAP_BASE* aBitmap )
{
CACHED_BITMAP bmp;
bmp.w = aBitmap->GetSizePixels().x;
bmp.h = aBitmap->GetSizePixels().y;
// There are draw issues (incorrect rendering) with some w values.
// It happens when the w value is not a multiple of 4
// so we use only a sub image with a modified width
bmp.w -= bmp.w % 4;
GLuint textureID;
glGenTextures(1, &textureID);
uint8_t *buf = new uint8_t [ bmp.w * bmp.h * 3];
auto imgData = const_cast<BITMAP_BASE*>( aBitmap )->GetImageData();
for( int y = 0; y < bmp.h; y++ )
{
for( int x = 0; x < bmp.w; x++ )
{
uint8_t *p = buf + ( bmp.w * y + x ) * 3;
p[0] = imgData->GetRed( x, y );
p[1] = imgData->GetGreen( x, y );
p[2] = imgData->GetBlue( x, y );
}
}
glBindTexture( GL_TEXTURE_2D, textureID );
glTexImage2D( GL_TEXTURE_2D, 0,GL_RGB, bmp.w, bmp.h, 0, GL_RGB, GL_UNSIGNED_BYTE, buf );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
delete [] buf;
bmp.id = textureID;
m_bitmaps[ aBitmap ] = bmp;
return textureID;
}
OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
wxEvtHandler* aMouseListener, wxEvtHandler* aPaintListener,
@@ -102,6 +198,8 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
++instanceCounter;
bitmapCache.reset( new GL_BITMAP_CACHE );
compositor = new OPENGL_COMPOSITOR;
compositor->SetAntialiasingMode( options.gl_antialiasing_mode );
@@ -222,7 +320,7 @@ bool OPENGL_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
void OPENGL_GAL::BeginDrawing()
{
if( !IsShownOnScreen() )
if( !IsShownOnScreen() || GetClientRect().IsEmpty() )
return;
#ifdef __WXDEBUG__
@@ -393,7 +491,7 @@ void OPENGL_GAL::EndDrawing()
void OPENGL_GAL::BeginUpdate()
{
if( !IsShownOnScreen() )
if( !IsShownOnScreen() || GetClientRect().IsEmpty() )
return;
if( !isInitialized )
@@ -809,10 +907,10 @@ void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet )
{
auto triPoly = aPolySet.TriangulatedPolygon( j );
for( int i = 0; i < triPoly->GetTriangleCount(); i++ )
for( size_t i = 0; i < triPoly->GetTriangleCount(); i++ )
{
VECTOR2I a, b, c;
triPoly->GetTriangle( i ,a,b,c);
triPoly->GetTriangle( i, a, b, c );
currentManager->Vertex( a.x, a.y, layerDepth );
currentManager->Vertex( b.x, b.y, layerDepth );
currentManager->Vertex( c.x, c.y, layerDepth );
@@ -899,6 +997,55 @@ void OPENGL_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aContro
}
void OPENGL_GAL::DrawBitmap( const BITMAP_BASE& aBitmap )
{
int ppi = aBitmap.GetPPI();
double worldIU_per_mm = 1.0 / ( worldUnitLength / 2.54 )/ 1000;
double pix_size_iu = worldIU_per_mm * ( 25.4 / ppi );
double w = aBitmap.GetSizePixels().x * pix_size_iu;
double h = aBitmap.GetSizePixels().y * pix_size_iu;
auto xform = currentManager->GetTransformation();
glm::vec4 v0 = xform * glm::vec4( -w/2, -h/2, 0.0, 0.0 );
glm::vec4 v1 = xform * glm::vec4( w/2, h/2, 0.0, 0.0 );
glm::vec4 trans = xform[3];
auto id = bitmapCache->RequestBitmap( &aBitmap );
auto oldTarget = GetTarget();
glPushMatrix();
glTranslated( trans.x, trans.y, trans.z );
SetTarget( TARGET_NONCACHED );
glEnable(GL_TEXTURE_2D);
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, id );
glBegin( GL_QUADS );
glColor4f(1.0, 1.0, 1.0, 1.0);
glTexCoord2f(0.0, 0.0);
glVertex3f( v0.x, v0.y, layerDepth );
glColor4f(1.0, 1.0, 1.0, 1.0);
glTexCoord2f(1.0, 0.0);
glVertex3f( v1.x, v0.y, layerDepth );
glColor4f(1.0, 1.0, 1.0, 1.0);
glTexCoord2f(1.0, 1.0);
glVertex3f( v1.x, v1.y, layerDepth );
glColor4f(1.0, 1.0, 1.0, 1.0);
glTexCoord2f(0.0, 1.0);
glVertex3f( v0.x, v1.y, layerDepth );
glEnd();
SetTarget( oldTarget );
glBindTexture( GL_TEXTURE_2D, 0 );
glPopMatrix();
}
void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition,
double aRotationAngle )
{
@@ -1288,19 +1435,22 @@ void OPENGL_GAL::EndGroup()
void OPENGL_GAL::DrawGroup( int aGroupNumber )
{
cachedManager->DrawItem( *groups[aGroupNumber] );
if( groups[aGroupNumber] )
cachedManager->DrawItem( *groups[aGroupNumber] );
}
void OPENGL_GAL::ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor )
{
cachedManager->ChangeItemColor( *groups[aGroupNumber], aNewColor );
if( groups[aGroupNumber] )
cachedManager->ChangeItemColor( *groups[aGroupNumber], aNewColor );
}
void OPENGL_GAL::ChangeGroupDepth( int aGroupNumber, int aDepth )
{
cachedManager->ChangeItemDepth( *groups[aGroupNumber], aDepth );
if( groups[aGroupNumber] )
cachedManager->ChangeItemDepth( *groups[aGroupNumber], aDepth );
}
@@ -1313,6 +1463,8 @@ void OPENGL_GAL::DeleteGroup( int aGroupNumber )
void OPENGL_GAL::ClearCache()
{
bitmapCache.reset( new GL_BITMAP_CACHE );
groups.clear();
if( isInitialized )
+19
View File
@@ -27,6 +27,25 @@
#include <common.h>
#include <geometry/shape_line_chain.h>
#include <geometry/shape_circle.h>
#include "clipper.hpp"
ClipperLib::Path SHAPE_LINE_CHAIN::convertToClipper( bool aRequiredOrientation ) const
{
ClipperLib::Path c_path;
for( int i = 0; i < PointCount(); i++ )
{
const VECTOR2I& vertex = CPoint( i );
c_path.push_back( ClipperLib::IntPoint( vertex.x, vertex.y ) );
}
if( Orientation( c_path ) != aRequiredOrientation )
ReversePath( c_path );
return c_path;
}
bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance ) const
{
+33 -242
View File
@@ -42,8 +42,7 @@
#include <geometry/shape.h>
#include <geometry/shape_line_chain.h>
#include <geometry/shape_poly_set.h>
#include "poly2tri/poly2tri.h"
#include <geometry/polygon_triangulation.h>
using namespace ClipperLib;
@@ -53,9 +52,18 @@ SHAPE_POLY_SET::SHAPE_POLY_SET() :
}
SHAPE_POLY_SET::SHAPE_POLY_SET( const SHAPE_POLY_SET& aOther ) :
SHAPE_POLY_SET::SHAPE_POLY_SET( const SHAPE_POLY_SET& aOther, bool aDeepCopy ) :
SHAPE( SH_POLY_SET ), m_polys( aOther.m_polys )
{
if( aOther.IsTriangulationUpToDate() )
{
for( unsigned i = 0; i < aOther.TriangulatedPolyCount(); i++ )
m_triangulatedPolys.push_back(
std::make_unique<TRIANGULATED_POLYGON>( *aOther.TriangulatedPolygon( i ) ) );
m_hash = aOther.GetHash();
m_triangulationValid = true;
}
}
@@ -456,62 +464,10 @@ int SHAPE_POLY_SET::AddHole( const SHAPE_LINE_CHAIN& aHole, int aOutline )
}
const Path SHAPE_POLY_SET::convertToClipper( const SHAPE_LINE_CHAIN& aPath,
bool aRequiredOrientation )
{
Path c_path;
for( int i = 0; i < aPath.PointCount(); i++ )
{
const VECTOR2I& vertex = aPath.CPoint( i );
c_path.push_back( IntPoint( vertex.x, vertex.y ) );
}
if( Orientation( c_path ) != aRequiredOrientation )
ReversePath( c_path );
return c_path;
}
const SHAPE_LINE_CHAIN SHAPE_POLY_SET::convertFromClipper( const Path& aPath )
{
SHAPE_LINE_CHAIN lc;
for( unsigned int i = 0; i < aPath.size(); i++ )
lc.Append( aPath[i].X, aPath[i].Y );
lc.SetClosed( true );
return lc;
}
void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType, const SHAPE_POLY_SET& aOtherShape,
POLYGON_MODE aFastMode )
{
Clipper c;
if( aFastMode == PM_STRICTLY_SIMPLE )
c.StrictlySimple( true );
for( const POLYGON& poly : m_polys )
{
for( unsigned int i = 0; i < poly.size(); i++ )
c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptSubject, true );
}
for( const POLYGON& poly : aOtherShape.m_polys )
{
for( unsigned int i = 0; i < poly.size(); i++ )
c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptClip, true );
}
PolyTree solution;
c.Execute( aType, solution, pftNonZero, pftNonZero );
importTree( &solution );
booleanOp( aType, *this, aOtherShape, aFastMode );
}
@@ -522,19 +478,18 @@ void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType,
{
Clipper c;
if( aFastMode == PM_STRICTLY_SIMPLE )
c.StrictlySimple( true );
c.StrictlySimple( aFastMode == PM_STRICTLY_SIMPLE );
for( const POLYGON& poly : aShape.m_polys )
for( auto poly : aShape.m_polys )
{
for( unsigned int i = 0; i < poly.size(); i++ )
c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptSubject, true );
for( size_t i = 0 ; i < poly.size(); i++ )
c.AddPath( poly[i].convertToClipper( i == 0 ), ptSubject, true );
}
for( const POLYGON& poly : aOtherShape.m_polys )
for( auto poly : aOtherShape.m_polys )
{
for( unsigned int i = 0; i < poly.size(); i++ )
c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), ptClip, true );
for( size_t i = 0; i < poly.size(); i++ )
c.AddPath( poly[i].convertToClipper( i == 0 ), ptClip, true );
}
PolyTree solution;
@@ -599,9 +554,8 @@ void SHAPE_POLY_SET::Inflate( int aFactor, int aCircleSegmentsCount )
for( const POLYGON& poly : m_polys )
{
for( unsigned int i = 0; i < poly.size(); i++ )
c.AddPath( convertToClipper( poly[i], i > 0 ? false : true ), jtRound,
etClosedPolygon );
for( size_t i = 0; i < poly.size(); i++ )
c.AddPath( poly[i].convertToClipper( i == 0 ), jtRound, etClosedPolygon );
}
PolyTree solution;
@@ -644,10 +598,10 @@ void SHAPE_POLY_SET::importTree( PolyTree* tree )
{
POLYGON paths;
paths.reserve( n->Childs.size() + 1 );
paths.push_back( convertFromClipper( n->Contour ) );
paths.push_back( n->Contour );
for( unsigned int i = 0; i < n->Childs.size(); i++ )
paths.push_back( convertFromClipper( n->Childs[i]->Contour ) );
paths.push_back( n->Childs[i]->Contour );
m_polys.push_back( paths );
}
@@ -1862,164 +1816,6 @@ SHAPE_POLY_SET &SHAPE_POLY_SET::operator=( const SHAPE_POLY_SET& aOther )
return *this;
}
class SHAPE_POLY_SET::TRIANGULATION_CONTEXT
{
public:
TRIANGULATION_CONTEXT( TRIANGULATED_POLYGON* aResultPoly ) :
m_triPoly( aResultPoly )
{
}
void AddOutline( const SHAPE_LINE_CHAIN& outl, bool aIsHole = false )
{
m_points.reserve( outl.PointCount() );
m_points.clear();
for( int i = 0; i < outl.PointCount(); i++ )
{
m_points.push_back( addPoint( outl.CPoint( i ) ) );
}
if ( aIsHole )
m_cdt->AddHole( m_points );
else
m_cdt.reset( new p2t::CDT( m_points ) );
}
void Triangulate()
{
m_cdt->Triangulate();
m_triPoly->AllocateTriangles( m_cdt->GetTriangles().size() );
int i = 0;
for( auto tri : m_cdt->GetTriangles() )
{
TRIANGULATED_POLYGON::TRI t;
t.a = tri->GetPoint( 0 )->id;
t.b = tri->GetPoint( 1 )->id;
t.c = tri->GetPoint( 2 )->id;
m_triPoly->SetTriangle(i, t);
i++;
}
for( auto p : m_uniquePoints )
delete p;
}
private:
class comparePoints
{
public:
bool operator()( p2t::Point* a, p2t::Point* b ) const
{
if (a->x < b->x)
return true;
if( a->x == b->x )
return ( a->y > b->y );
return false;
}
};
p2t::Point* addPoint( const VECTOR2I& aP )
{
p2t::Point check( aP.x, aP.y );
auto it = m_uniquePoints.find( &check );
if( it != m_uniquePoints.end() )
{
return *it;
}
else
{
auto lastId = m_triPoly->GetVertexCount();
auto p = new p2t::Point( aP.x, aP.y, lastId );
m_triPoly->AddVertex( aP );
m_uniquePoints.insert ( p );
return p;
}
}
typedef std::set<p2t::Point*, comparePoints> P2T_SET;
typedef std::vector<p2t::Point*> P2T_VEC;
P2T_VEC m_points;
P2T_SET m_uniquePoints;
TRIANGULATED_POLYGON *m_triPoly;
std::unique_ptr<p2t::CDT> m_cdt;
};
SHAPE_POLY_SET::TRIANGULATED_POLYGON::~TRIANGULATED_POLYGON()
{
Clear();
}
void SHAPE_POLY_SET::TRIANGULATED_POLYGON::Clear()
{
if( m_vertices )
delete[] m_vertices;
if( m_triangles )
delete[] m_triangles;
}
void SHAPE_POLY_SET::TRIANGULATED_POLYGON::AllocateVertices( int aSize )
{
m_vertices = new VECTOR2I[aSize];
}
void SHAPE_POLY_SET::TRIANGULATED_POLYGON::AllocateTriangles( int aSize )
{
m_triangles = new TRI[aSize];
m_triangleCount = aSize;
}
static int totalVertexCount( const SHAPE_POLY_SET::POLYGON& aPoly )
{
int cnt = 0;
for( const auto& outl : aPoly )
{
cnt += outl.PointCount();
}
return cnt;
}
void SHAPE_POLY_SET::triangulateSingle( const POLYGON& aPoly,
SHAPE_POLY_SET::TRIANGULATED_POLYGON& aResult )
{
if( aPoly.size() == 0 )
return;
TRIANGULATION_CONTEXT ctx ( &aResult );
aResult.AllocateVertices( totalVertexCount( aPoly ) );
ctx.AddOutline( aPoly[0], false );
for( unsigned i = 1; i < aPoly.size(); i++ )
{
ctx.AddOutline( aPoly[i], true ); // add holes
}
ctx.Triangulate();
}
MD5_HASH SHAPE_POLY_SET::GetHash() const
{
if( !m_hash.IsValid() )
@@ -2067,22 +1863,17 @@ void SHAPE_POLY_SET::CacheTriangulation()
SHAPE_POLY_SET tmpSet = *this;
if( !tmpSet.HasHoles() )
tmpSet.Unfracture( PM_FAST );
if( tmpSet.HasHoles() )
tmpSet.Fracture( PM_FAST );
m_triangulatedPolys.clear();
if( tmpSet.HasTouchingHoles() )
{
// temporary workaround for overlapping hole vertices that poly2tri doesn't handle
m_triangulationValid = false;
return;
}
for( int i = 0; i < tmpSet.OutlineCount(); i++ )
{
m_triangulatedPolys.push_back( std::make_unique<TRIANGULATED_POLYGON>() );
triangulateSingle( tmpSet.Polygon( i ), *m_triangulatedPolys.back() );
PolygonTriangulation tess( *m_triangulatedPolys.back() );
tess.TesselatePolygon( tmpSet.Polygon( i ).front() );
}
m_triangulationValid = true;
@@ -2134,20 +1925,20 @@ bool SHAPE_POLY_SET::HasTouchingHoles() const
bool SHAPE_POLY_SET::hasTouchingHoles( const POLYGON& aPoly ) const
{
std::vector< VECTOR2I > pts;
std::set< long long > ptHashes;
for( const auto& lc : aPoly )
{
for( int i = 0; i < lc.PointCount(); i++ )
for( const VECTOR2I& pt : lc.CPoints() )
{
const auto p = lc.CPoint( i );
const long long ptHash = (long long) pt.x << 32 | pt.y;
if( std::find( pts.begin(), pts.end(), p ) != pts.end() )
if( ptHashes.count( ptHash ) > 0 )
{
return true;
}
pts.push_back( p );
ptHashes.insert( ptHash );
}
}
+1 -1
View File
@@ -358,7 +358,7 @@ bool OpenPDF( const wxString& file )
}
else
{
if( wxLaunchDefaultApplication( file ) )
if( wxLaunchDefaultApplication( filename ) )
return true;
// If launching the system default PDF viewer fails, fall through with empty command
+15 -11
View File
@@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, j-p.charras at wanadoo.fr
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2010-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2018 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
@@ -94,6 +94,7 @@ struct hotkey_name_descr
* "Space","Ctrl+Space","Alt+Space" or
* "Alt+A","Ctrl+F1", ...
*/
#define KEY_NON_FOUND -1
static struct hotkey_name_descr hotkeyNameList[] =
{
{ wxT( "F1" ), WXK_F1 },
@@ -112,7 +113,7 @@ static struct hotkey_name_descr hotkeyNameList[] =
{ wxT( "Esc" ), WXK_ESCAPE },
{ wxT( "Del" ), WXK_DELETE },
{ wxT( "Tab" ), WXK_TAB },
{ wxT( "BkSp" ), WXK_BACK },
{ wxT( "Back" ), WXK_BACK },
{ wxT( "Ins" ), WXK_INSERT },
{ wxT( "Home" ), WXK_HOME },
@@ -129,8 +130,10 @@ static struct hotkey_name_descr hotkeyNameList[] =
{ wxT( "Space" ), WXK_SPACE },
{ wxT( "<unassigned>" ), 0 },
// Do not change this line: end of list
{ wxT( "" ), 0 }
{ wxT( "" ), KEY_NON_FOUND }
};
// name of modifier keys.
@@ -169,9 +172,6 @@ wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
bool found = false;
// Assume keycode of 0 is "unassigned"
if( aKeycode == 0 )
return wxT( "<unassigned>");
if( (aKeycode & GR_KB_CTRL) != 0 )
modifier << MODIFIER_CTRL;
@@ -192,7 +192,7 @@ wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
{
for( ii = 0; ; ii++ )
{
if( hotkeyNameList[ii].m_KeyCode == 0 ) // End of list
if( hotkeyNameList[ii].m_KeyCode == KEY_NON_FOUND ) // End of list
{
keyname = wxT( "<unknown>" );
break;
@@ -377,7 +377,7 @@ wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
*/
int KeyCodeFromKeyName( const wxString& keyname )
{
int ii, keycode = 0;
int ii, keycode = KEY_NON_FOUND;
// Search for modifiers: Ctrl+ Alt+ and Shift+
// Note: on Mac OSX, the Cmd key is equiv here to Ctrl
@@ -425,7 +425,7 @@ int KeyCodeFromKeyName( const wxString& keyname )
return keycode;
}
for( ii = 0; hotkeyNameList[ii].m_KeyCode != 0; ii++ )
for( ii = 0; hotkeyNameList[ii].m_KeyCode != KEY_NON_FOUND; ii++ )
{
if( key.CmpNoCase( hotkeyNameList[ii].m_Name ) == 0 )
{
@@ -734,7 +734,11 @@ void ParseHotkeyConfig( const wxString& data,
if( hk_decr->m_InfoMsg == fctname )
{
hk_decr->m_KeyCode = KeyCodeFromKeyName( keyname );
int keycode = KeyCodeFromKeyName( keyname );
if( keycode != KEY_NON_FOUND ) // means the key name is found in list or unassigned
hk_decr->m_KeyCode = keycode;
break;
}
}
+28 -47
View File
@@ -119,7 +119,7 @@ void LIB_ID::clear()
}
int LIB_ID::Parse( const UTF8& aId )
int LIB_ID::Parse( const UTF8& aId, LIB_ID_TYPE aType, bool aFix )
{
clear();
@@ -127,7 +127,7 @@ int LIB_ID::Parse( const UTF8& aId )
const char* rev = EndsWithRev( buffer, buffer+aId.length(), '/' );
size_t revNdx;
size_t partNdx;
int offset;
int offset = -1;
//=====<revision>=========================================
// in a LIB_ID like discret:R3/rev4
@@ -150,9 +150,7 @@ int LIB_ID::Parse( const UTF8& aId )
offset = SetLibNickname( aId.substr( 0, partNdx ) );
if( offset > -1 )
{
return offset;
}
++partNdx; // skip ':'
}
@@ -165,48 +163,24 @@ int LIB_ID::Parse( const UTF8& aId )
if( partNdx >= revNdx )
return partNdx; // Error: no library item name.
UTF8 fpname = aId.substr( partNdx, revNdx-partNdx );
// Be sure the item name is valid.
// Some chars can be found in legacy files converted files from other EDA tools.
std::string fpname = aId.substr( partNdx, revNdx-partNdx );
ReplaceIllegalFileNameChars( &fpname, '_' );
SetLibItemName( UTF8( fpname ) );
if( aFix )
fpname = FixIllegalChars( fpname, aType, false );
else
offset = HasIllegalChars( fpname, aType );
if( offset > -1 )
return offset;
SetLibItemName( fpname );
return -1;
}
LIB_ID::LIB_ID( const UTF8& aId )
{
int offset = Parse( aId );
if( offset != -1 )
{
THROW_PARSE_ERROR( _( "Illegal character found in LIB_ID string" ),
wxString::FromUTF8( aId.c_str() ),
aId.c_str(),
0,
offset );
}
}
LIB_ID::LIB_ID( const wxString& aId )
{
UTF8 id = aId;
int offset = Parse( id );
if( offset != -1 )
{
THROW_PARSE_ERROR( _( "Illegal character found in LIB_ID string" ),
aId,
id.c_str(),
0,
offset );
}
}
LIB_ID::LIB_ID( const wxString& aLibName, const wxString& aLibItemName,
const wxString& aRevision ) :
nickname( aLibName ),
@@ -359,15 +333,19 @@ int LIB_ID::compare( const LIB_ID& aLibId ) const
}
bool LIB_ID::HasIllegalChars( const UTF8& aLibItemName, LIB_ID_TYPE aType )
int LIB_ID::HasIllegalChars( const UTF8& aLibItemName, LIB_ID_TYPE aType )
{
int offset = 0;
for( auto ch : aLibItemName )
{
if( !isLegalChar( ch, aType ) )
return true;
return offset;
else
++offset;
}
return false;
return -1;
}
@@ -390,20 +368,23 @@ UTF8 LIB_ID::FixIllegalChars( const UTF8& aLibItemName, LIB_ID_TYPE aType, bool
bool LIB_ID::isLegalChar( unsigned aUniChar, LIB_ID_TYPE aType )
{
bool const colon_allowed = ( aType == ID_ALIAS );
bool const space_allowed = ( aType != ID_SCH );
bool const space_allowed = ( aType == ID_PCB );
bool const illegal_filename_chars_allowed = ( aType == ID_SCH );
if( aUniChar < ' ' )
return false;
switch( aUniChar )
{
case ':':
case '/':
case '\\':
return false;
case ':':
return colon_allowed;
case '\\':
case '<':
case '>':
case '"':
return illegal_filename_chars_allowed;
case ' ':
return space_allowed;
+1 -9
View File
@@ -53,15 +53,7 @@ ORIGIN_VIEWITEM* ORIGIN_VIEWITEM::Clone() const
const BOX2I ORIGIN_VIEWITEM::ViewBBox() const
{
BOX2I bbox;
// The origin item doesn't have a fixed size. It is constant on the screen but
// changes the effective BBox size based on the zoom level.
// But we can't simply set it to the maximum size as this causes a splitting degeneracy
// when compiling for Debian i386. By modestly adjusting the bbox, we avoid the degeneracy
// while keeping the origin visible at all zoom levels
bbox.SetSize( VECTOR2I( INT_MAX - 2, INT_MAX - 2 ) );
bbox.SetOrigin( VECTOR2I( INT_MIN / 2 + 1, INT_MIN / 2 + 1 ) );
bbox.SetMaximum();
return bbox;
}
+2 -2
View File
@@ -237,7 +237,7 @@ static LANGUAGE_DESCR s_Languages[] =
{
wxLANGUAGE_CHINESE_SIMPLIFIED,
ID_LANGUAGE_CHINESE_SIMPLIFIED,
lang_chinese_xpm,
lang_zh_xpm,
_( "Chinese simplified" )
},
@@ -831,7 +831,7 @@ bool PGM_BASE::SetLanguage( bool first_time )
if( result != dtst )
// string to double encode/decode does not work! Bug detected:
// Disable floating point localization:
setlocale( LC_ALL, "C" );
setlocale( LC_NUMERIC, "C" );
if( !m_locale->IsLoaded( dictionaryName ) )
m_locale->AddCatalog( dictionaryName );
+7
View File
@@ -135,6 +135,13 @@ typedef long time_t;
#include <geometry/shape.h>
%include <geometry/shape.h>
// Contains VECTOR2I
%include math.i
%ignore SHAPE_LINE_CHAIN::convertFromClipper;
#include <geometry/shape_line_chain.h>
%include <geometry/shape_line_chain.h>
#include <geometry/shape_poly_set.h>
%include <geometry/shape_poly_set.h>
+34
View File
@@ -0,0 +1,34 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2017 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file math.i
* @brief wrappers for math helper classes
*/
%ignore VECTOR2<int>::ECOORD_MAX;
%ignore VECTOR2<int>::ECOORD_MIN;
#include <math/vector2d.h>
%include <math/vector2d.h>
%template(VECTOR2I) VECTOR2<int>;
+26
View File
@@ -399,6 +399,32 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
key += 'A' - 1;
}
#ifdef __APPLE__
if( mods & MD_ALT )
{
// OSX maps a bunch of commonly used extended-ASCII characters onto the keyboard
// using the ALT key. Since we use ALT for some of our hotkeys, we need to map back
// to the underlying keys. The kVK_ANSI_* values come from Apple and are said to be
// hardware independant.
switch( ke->GetRawKeyCode() )
{
case /* kVK_ANSI_1 */ 0x12: key = '1'; break;
case /* kVK_ANSI_2 */ 0x13: key = '2'; break;
case /* kVK_ANSI_3 */ 0x14: key = '3'; break;
case /* kVK_ANSI_4 */ 0x15: key = '4'; break;
case /* kVK_ANSI_6 */ 0x16: key = '6'; break;
case /* kVK_ANSI_5 */ 0x17: key = '5'; break;
case /* kVK_ANSI_Equal */ 0x18: key = '='; break;
case /* kVK_ANSI_9 */ 0x19: key = '9'; break;
case /* kVK_ANSI_7 */ 0x1A: key = '7'; break;
case /* kVK_ANSI_Minus */ 0x1B: key = '-'; break;
case /* kVK_ANSI_8 */ 0x1C: key = '8'; break;
case /* kVK_ANSI_0 */ 0x1D: key = '0'; break;
default: ;
}
}
#endif
if( key == WXK_ESCAPE ) // ESC is the special key for canceling tools
evt = TOOL_EVENT( TC_COMMAND, TA_CANCEL_TOOL );
else
+24 -6
View File
@@ -41,7 +41,7 @@
using namespace KIGFX;
VIEW_GROUP::VIEW_GROUP( VIEW* aView ) :
m_layer( LAYER_GP_OVERLAY )
m_layer( LAYER_SELECT_OVERLAY )
{
}
@@ -100,10 +100,10 @@ const BOX2I VIEW_GROUP::ViewBBox() const
void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
{
auto gal = aView->GetGAL();
PAINTER* painter = aView->GetPainter();
const auto drawList = updateDrawList();
KIGFX::GAL* gal = aView->GetGAL();
PAINTER* painter = aView->GetPainter();
bool isSelection = m_layer == LAYER_SELECT_OVERLAY;
const auto drawList = updateDrawList();
std::unordered_map<int, std::vector<VIEW_ITEM*>> layer_item_map;
@@ -140,7 +140,25 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
for( int i = 0; i < layers_count; i++ )
{
if( aView->IsLayerVisible( layers[i] ) )
int layer = layers[i];
bool draw = aView->IsLayerVisible( layer );
if( isSelection )
{
switch( layer )
{
case LAYER_PADS_TH:
case LAYER_PADS_PLATEDHOLES:
case LAYER_PAD_FR:
case LAYER_PAD_BK:
draw = true;
break;
default:
break;
}
}
if( draw )
{
gal->AdvanceDepth();
+36 -11
View File
@@ -253,6 +253,18 @@ WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::GetSelHKClientData()
}
WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::getExpectedHkClientData( wxTreeListItem aItem )
{
const auto hkdata = GetHKClientData( aItem );
// This probably means a hotkey-only action is being attempted on
// a row that is not a hotkey (like a section heading)
wxASSERT_MSG( hkdata != nullptr, "No hotkey data found for list item" );
return hkdata;
}
void WIDGET_HOTKEY_LIST::UpdateFromClientData()
{
for( wxTreeListItem i = GetFirstItem(); i.IsOk(); i = GetNextItem( i ) )
@@ -285,13 +297,10 @@ void WIDGET_HOTKEY_LIST::LoadSection( EDA_HOTKEY_CONFIG* aSection )
void WIDGET_HOTKEY_LIST::EditItem( wxTreeListItem aItem )
{
WIDGET_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( aItem );
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem );
if( !hkdata )
{
// Activated item was not a hotkey row
return;
}
wxString name = GetItemText( aItem, 0 );
wxString current_key = GetItemText( aItem, 1 );
@@ -299,7 +308,7 @@ void WIDGET_HOTKEY_LIST::EditItem( wxTreeListItem aItem )
wxKeyEvent key_event = HK_PROMPT_DIALOG::PromptForKey( GetParent(), name, current_key );
long key = MapKeypressToKeycode( key_event );
if( hkdata && key )
if( key )
{
// See if this key code is handled in hotkeys names list
bool exists;
@@ -327,7 +336,11 @@ void WIDGET_HOTKEY_LIST::EditItem( wxTreeListItem aItem )
void WIDGET_HOTKEY_LIST::ResetItem( wxTreeListItem aItem )
{
WIDGET_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( aItem );
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem );
if( !hkdata )
return;
EDA_HOTKEY* hk = &hkdata->GetHotkey();
for( size_t sec_index = 0; sec_index < m_sections.size(); ++sec_index )
@@ -356,9 +369,14 @@ void WIDGET_HOTKEY_LIST::ResetItem( wxTreeListItem aItem )
void WIDGET_HOTKEY_LIST::ResetItemToDefault( wxTreeListItem aItem )
{
WIDGET_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( aItem );
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem );
if( !hkdata )
return;
EDA_HOTKEY* hk = &hkdata->GetHotkey();
hk->ResetKeyCodeToDefault();
UpdateFromClientData();
}
@@ -376,10 +394,17 @@ void WIDGET_HOTKEY_LIST::OnContextMenu( wxTreeListEvent& aEvent )
wxMenu menu;
menu.Append( ID_EDIT, _( "Edit..." ) );
menu.Append( ID_RESET, _( "Undo Changes" ) );
menu.Append( ID_DEFAULT, _( "Restore Default" ) );
menu.Append( wxID_SEPARATOR );
WIDGET_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( m_context_menu_item );
// Some actions only apply if the row is hotkey data
if( hkdata )
{
menu.Append( ID_EDIT, _( "Edit..." ) );
menu.Append( ID_RESET, _( "Undo Changes" ) );
menu.Append( ID_DEFAULT, _( "Restore Default" ) );
menu.Append( wxID_SEPARATOR );
}
menu.Append( ID_RESET_ALL, _( "Undo All Changes" ) );
menu.Append( ID_DEFAULT_ALL, _( "Restore All to Default" ) );
+28 -28
View File
@@ -68,40 +68,40 @@ static wxString FormatWildcardExt( const wxString& aWildcard )
}
const wxString SchematicSymbolFileExtension( "sym" );
const wxString SchematicLibraryFileExtension( "lib" );
const wxString SchematicBackupFileExtension( "bak" );
const std::string SchematicSymbolFileExtension( "sym" );
const std::string SchematicLibraryFileExtension( "lib" );
const std::string SchematicBackupFileExtension( "bak" );
const wxString VrmlFileExtension( "wrl" );
const std::string VrmlFileExtension( "wrl" );
const wxString ProjectFileExtension( "pro" );
const wxString SchematicFileExtension( "sch" );
const wxString NetlistFileExtension( "net" );
const wxString ComponentFileExtension( "cmp" );
const wxString GerberFileExtension( "gbr" );
const wxString GerberJobFileExtension( "gbrjob" );
const wxString HtmlFileExtension( wxT( "html" ) );
const std::string ProjectFileExtension( "pro" );
const std::string SchematicFileExtension( "sch" );
const std::string NetlistFileExtension( "net" );
const std::string ComponentFileExtension( "cmp" );
const std::string GerberFileExtension( "gbr" );
const std::string GerberJobFileExtension( "gbrjob" );
const std::string HtmlFileExtension( "html" );
const wxString LegacyPcbFileExtension( "brd" );
const wxString KiCadPcbFileExtension( "kicad_pcb" );
const wxString PageLayoutDescrFileExtension( "kicad_wks" );
const std::string LegacyPcbFileExtension( "brd" );
const std::string KiCadPcbFileExtension( "kicad_pcb" );
const std::string PageLayoutDescrFileExtension( "kicad_wks" );
const wxString PdfFileExtension( "pdf" );
const wxString MacrosFileExtension( "mcr" );
const wxString DrillFileExtension( "drl" );
const wxString SVGFileExtension( "svg" );
const wxString ReportFileExtension( "rpt" );
const wxString FootprintPlaceFileExtension( "pos" );
const wxString KiCadLib3DShapesPathExtension( "3dshapes" ); ///< 3D shapes default libpath
const std::string PdfFileExtension( "pdf" );
const std::string MacrosFileExtension( "mcr" );
const std::string DrillFileExtension( "drl" );
const std::string SVGFileExtension( "svg" );
const std::string ReportFileExtension( "rpt" );
const std::string FootprintPlaceFileExtension( "pos" );
const std::string KiCadLib3DShapesPathExtension( "3dshapes" ); ///< 3D shapes default libpath
const wxString KiCadFootprintLibPathExtension( "pretty" ); ///< KICAD PLUGIN libpath
const wxString LegacyFootprintLibPathExtension( "mod" );
const wxString EagleFootprintLibPathExtension( "lbr" );
const std::string KiCadFootprintLibPathExtension( "pretty" ); ///< KICAD PLUGIN libpath
const std::string LegacyFootprintLibPathExtension( "mod" );
const std::string EagleFootprintLibPathExtension( "lbr" );
const wxString KiCadFootprintFileExtension( "kicad_mod" );
const wxString GedaPcbFootprintLibFileExtension( "fp" );
const wxString SpecctraDsnFileExtension( "dsn" );
const wxString IpcD356FileExtension( "d356" );
const std::string KiCadFootprintFileExtension( "kicad_mod" );
const std::string GedaPcbFootprintLibFileExtension( "fp" );
const std::string SpecctraDsnFileExtension( "dsn" );
const std::string IpcD356FileExtension( "d356" );
const wxString AllFilesWildcard( _( "All files (*)|*" ) );
+13
View File
@@ -29,6 +29,7 @@
#include <worksheet_viewitem.h>
#include <worksheet_shape_builder.h>
#include <worksheet_dataitem.h>
#include <gal/graphics_abstraction_layer.h>
#include <painter.h>
#include <layers_id_colors_and_visibility.h>
@@ -119,6 +120,7 @@ void WORKSHEET_VIEWITEM::ViewDraw( int aLayer, VIEW* aView ) const
break;
case WS_DRAW_ITEM_BASE::wsg_bitmap:
draw( static_cast<const WS_DRAW_ITEM_BITMAP*>( item ), gal );
break;
}
@@ -198,6 +200,17 @@ void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_TEXT* aItem, GAL* aGal ) const
}
void WORKSHEET_VIEWITEM::draw( const WS_DRAW_ITEM_BITMAP* aItem, GAL* aGal ) const
{
aGal->Save();
VECTOR2D position = aItem->GetPosition();
aGal->Translate( position );
WORKSHEET_DATAITEM_BITMAP* parent = static_cast<WORKSHEET_DATAITEM_BITMAP*>( aItem->GetParent() );
aGal->DrawBitmap( *parent->m_ImageBitmap );
aGal->Restore();
}
void WORKSHEET_VIEWITEM::drawBorder( GAL* aGal ) const
{
VECTOR2D origin = VECTOR2D( 0.0, 0.0 );
-1
View File
@@ -149,7 +149,6 @@ target_link_libraries( cvpcb_kiface
gal
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}
${OPENMP_LIBRARIES} # used by 3d viewer
)
if( BUILD_GITHUB_PLUGIN )
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -34,16 +34,16 @@ DIALOG_CONFIG_EQUFILES_BASE::DIALOG_CONFIG_EQUFILES_BASE( wxWindow* parent, wxWi
bSizerButtons = new wxBoxSizer( wxVERTICAL );
m_buttonAddEqu = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_ADD_EQU, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonAddEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerButtons->Add( m_buttonAddEqu, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonRemoveEqu = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_REMOVE_EQU, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonRemoveEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerButtons->Add( m_buttonRemoveEqu, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonMoveUp = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_EQU_UP, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonMoveUp, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerButtons->Add( m_buttonMoveUp, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonMoveDown = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_EQU_DOWN, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonMoveDown, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerButtons->Add( m_buttonMoveDown, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonEdit = new wxButton( sbEquivChoiceSizer->GetStaticBox(), wxID_ANY, _("Edit File"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonEdit, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
@@ -14,6 +14,7 @@
<property name="file">dialog_config_equfiles_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_cvpcb_config_equfile_base</property>
<property name="namespace"></property>
@@ -216,7 +217,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -304,7 +305,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -392,7 +393,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -480,7 +481,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+5 -1
View File
@@ -87,6 +87,10 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRA
SetBoard( new BOARD() );
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
// Don't show the default board solder mask clearance. Only the
// footprint or pad clearance setting should be shown if it is not 0.
GetBoard()->GetDesignSettings().m_SolderMaskMargin = 0;
LoadSettings( config() );
// Initialize grid id to a default value if not found in config or incorrect:
@@ -430,7 +434,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
{
LIB_ID fpid;
if( fpid.Parse( aFootprintName ) >= 0 )
if( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) >= 0 )
{
DisplayInfoMessage( this, wxString::Format( _( "Footprint ID \"%s\" is not valid." ),
GetChars( aFootprintName ) ) );
+2 -3
View File
@@ -99,9 +99,8 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName, int aIndex )
if( !aFootprintName.IsEmpty() )
{
wxCHECK_RET( fpid.Parse( aFootprintName ) < 0,
wxString::Format( _( "\"%s\" is not a valid LIB_ID." ),
GetChars( aFootprintName ) ) );
wxCHECK_RET( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) < 0,
wxString::Format( _( "\"%s\" is not a valid LIB_ID." ), aFootprintName ) );
}
component->SetFPID( fpid );
+18 -7
View File
@@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2018 KiCad Developers, see change_log.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
@@ -104,10 +104,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
{
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
if( !m_canvas->IsMouseCaptured() )
{
DisplayError( this, wxT( "HandleBlockPLace() : m_mouseCaptureCallback = NULL" ) );
}
wxCHECK_RET( m_canvas->IsMouseCaptured(), "No block mouse capture callback is set" );
if( block->GetCount() == 0 )
{
@@ -478,7 +475,12 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
destFn.MakeAbsolute( Prj().GetProjectPath() );
// Make sure any sheets in the block to be pasted will not cause recursion in
// the destination sheet.
// the destination sheet. Moreover new sheets create new sheetpaths, and component
// alternante references must be created and cleared
bool hasSheetPasted = false;
// Keep trace of existing sheet paths. Paste block can modify this list
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
for( i = 0; i < m_blockItems.GetCount(); i++ )
{
item = (SCH_ITEM*) m_blockItems.GetItem( i );
@@ -512,6 +514,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
sheet->SetTimeStamp( timeStamp );
hasSheetPasted = true;
}
}
@@ -550,6 +553,14 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
MoveItemsInList( picklist, GetScreen()->m_BlockLocate.GetMoveVector() );
if( hasSheetPasted )
{
// We clear annotation of new sheet paths.
// Annotation of new components added in current sheet is already cleared.
SCH_SCREENS screensList( g_RootSheet );
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
}
// Clear flags for all items.
GetScreen()->ClearDrawingState();
+24 -3
View File
@@ -332,6 +332,27 @@ void SCH_EDIT_FRAME::EndSegment()
// Correct and remove segments that need to be merged.
SchematicCleanUp( true );
for( auto item = GetScreen()->GetDrawItems(); item; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T )
continue;
std::vector< wxPoint > pts;
item->GetConnectionPoints( pts );
if( pts.size() > 2 )
continue;
// Do not trim wires that connect directly to an endpoint
pts.erase( std::remove_if( pts.begin(), pts.end(), [ &segment ]( const wxPoint& aPt )
{ return segment->IsEndPoint( aPt ); } ), pts.end() );
for( auto i = pts.begin(); i != pts.end(); i++ )
for( auto j = i + 1; j != pts.end(); j++ )
TrimWire( *i, *j, true );
}
for( auto i : new_ends )
{
if( screen->IsJunctionNeeded( i, true ) )
@@ -486,10 +507,9 @@ bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd, bool
{
next_item = item->Next();
// Don't remove wires that are already deleted, are currently being
// dragged or are just created
// Don't remove wires that are already deleted or are currently being dragged
if( item->GetFlags() &
( STRUCT_DELETED | IS_DRAGGED | IS_NEW | IS_MOVED | SKIP_STRUCT ) )
( STRUCT_DELETED | IS_DRAGGED | IS_MOVED | SKIP_STRUCT ) )
continue;
if( item->Type() != SCH_LINE_T || item->GetLayer() != LAYER_WIRE )
@@ -777,6 +797,7 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( const wxPoint& aPosition )
SetRepeatItem( no_connect );
GetScreen()->Append( no_connect );
SchematicCleanUp();
GetScreen()->TestDanglingEnds();
OnModify();
m_canvas->Refresh();
SaveCopyInUndoList( no_connect, UR_NEW );
+2 -3
View File
@@ -119,7 +119,7 @@ PART_LIB* LIB_ALIAS::GetLib()
void LIB_ALIAS::SetName( const wxString& aName )
{
name = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_ALIAS );
name = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_SCH );
}
@@ -287,8 +287,7 @@ void LIB_PART::SetName( const wxString& aName )
else
m_aliases[0]->SetName( aName );
// LIB_ALIAS validates the name, reuse it instead of validating the name again
wxString validatedName( m_aliases[0]->GetName() );
wxString validatedName = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_SCH );
m_libId.SetLibItemName( validatedName, false );
LIB_FIELD& valueField = GetValueField();
+2 -2
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -159,7 +159,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
bButtonsSizer->Add( m_btnClose, 0, wxALL|wxEXPAND, 5 );
bSizerDldOptions->Add( bButtonsSizer, 0, wxALIGN_RIGHT, 5 );
bSizerDldOptions->Add( bButtonsSizer, 0, 0, 5 );
bupperSizer->Add( bSizerDldOptions, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
+1 -1
View File
@@ -1418,7 +1418,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size">160,-1</property>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+1 -1
View File
@@ -301,7 +301,7 @@ void DIALOG_CHOOSE_COMPONENT::ShowFootprint( wxString const& aName )
{
LIB_ID lib_id;
if( lib_id.Parse( aName ) == -1 && lib_id.IsValid() )
if( lib_id.Parse( aName, LIB_ID::ID_PCB ) == -1 && lib_id.IsValid() )
{
m_fp_view_ctrl->ClearStatus();
m_fp_view_ctrl->CacheFootprint( lib_id );
@@ -258,7 +258,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName( wxCommandEvent& event )
wxString msg;
wxString partname = chipnameTextCtrl->GetValue();
if( id.Parse( partname ) != -1 || !id.IsValid() )
id.Parse( partname, LIB_ID::ID_SCH );
if( !id.IsValid() )
{
msg.Printf( _( "\"%s\" is not a valid library symbol identifier." ), partname );
DisplayError( this, msg );
@@ -363,7 +365,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
tmp.Replace( wxT( " " ), wxT( "_" ) );
id.Parse( tmp );
id.Parse( tmp, LIB_ID::ID_SCH );
// Save current flags which could be modified by next change settings
STATUS_FLAGS flags = m_cmp->GetFlags();
@@ -358,7 +358,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::validateLibIds()
// a new lib id is found. validate this new value
LIB_ID id;
id.Parse( new_libid );
id.Parse( new_libid, LIB_ID::ID_SCH );
if( !id.IsValid() )
{
@@ -430,7 +430,8 @@ void DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton( wxCommandEvent& event )
wxString orphanLibid = m_grid->GetCellValue( m_OrphansRowIndexes[ii], COL_CURR_LIBID );
int grid_row_idx = m_OrphansRowIndexes[ii]; //row index in m_grid for the current item
LIB_ID curr_libid( orphanLibid );
LIB_ID curr_libid;
curr_libid.Parse( orphanLibid, LIB_ID::ID_SCH, true );
wxString symbName = curr_libid.GetLibItemName();
// number of full LIB_ID candidates (because we search for a symbol name
// inside all avaiable libraries, perhaps the same symbol name can be found
@@ -438,7 +439,7 @@ void DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton( wxCommandEvent& event )
int libIdCandidateCount = 0;
candidateSymbNames.Clear();
// now try to fin a candidate
// now try to find a candidate
for( auto &lib : libs )
{
aliasNames.Clear();
@@ -555,7 +556,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
// a new lib id is found and was already validated.
// set this new value
LIB_ID id;
id.Parse( new_libid );
id.Parse( new_libid, LIB_ID::ID_SCH, true );
for( CMP_CANDIDATE& cmp : m_components )
{
@@ -592,7 +593,7 @@ void DIALOG_EDIT_COMPONENTS_LIBID::revertChanges()
continue;
LIB_ID id;
id.Parse( cmp.m_InitialLibId );
id.Parse( cmp.m_InitialLibId, LIB_ID::ID_SCH, true );
if( cmp.m_Component->GetLibId() != id )
{
+2 -1
View File
@@ -174,13 +174,14 @@ void DIALOG_LABEL_EDITOR::InitDialog()
{
m_textLabel = m_textLabelMultiLine;
m_textLabelSingleLine->Show( false );
m_textControlSizer->AddGrowableRow( 0 );
m_staticTextLabel->Show( false );
multiLine = true;
}
else
{
m_textLabel = m_textLabelSingleLine;
m_textLabelMultiLine->Show( false );
m_staticTextText->Show( false );
wxTextValidator* validator = (wxTextValidator*) m_textLabel->GetValidator();
// Add invalid label characters to this list.
+15 -14
View File
@@ -16,32 +16,33 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 );
m_textControlSizer = new wxFlexGridSizer( 3, 2, 3, 3 );
m_textControlSizer->AddGrowableCol( 1 );
m_textControlSizer->AddGrowableRow( 1 );
m_textControlSizer->SetFlexibleDirection( wxBOTH );
m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
m_staticText1->SetToolTip( _("Enter the text to be used within the schematic") );
m_staticTextLabel = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLabel->Wrap( -1 );
m_staticTextLabel->SetToolTip( _("Enter the text to be used within the schematic") );
m_textControlSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
wxBoxSizer* bSizeText;
bSizeText = new wxBoxSizer( wxVERTICAL );
m_textControlSizer->Add( m_staticTextLabel, 0, wxRIGHT, 3 );
m_textLabelSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxTE_RICH );
m_textLabelSingleLine->SetValidator( wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, &m_labelText ) );
bSizeText->Add( m_textLabelSingleLine, 0, wxEXPAND|wxLEFT, 3 );
m_textControlSizer->Add( m_textLabelSingleLine, 0, wxEXPAND|wxLEFT, 3 );
m_staticTextText = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextText->Wrap( -1 );
m_staticTextText->SetToolTip( _("Enter the text to be used within the schematic") );
m_textControlSizer->Add( m_staticTextText, 0, wxRIGHT, 5 );
m_textLabelMultiLine = new wxTextCtrl( this, wxID_VALUEMULTI, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_textLabelMultiLine->SetMinSize( wxSize( -1,60 ) );
bSizeText->Add( m_textLabelMultiLine, 1, wxEXPAND|wxLEFT, 3 );
m_textControlSizer->Add( bSizeText, 1, wxEXPAND, 3 );
m_textControlSizer->Add( m_textLabelMultiLine, 1, wxEXPAND|wxLEFT, 3 );
m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeTitle->Wrap( -1 );
@@ -51,7 +52,7 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizeCtrlSizer->Add( m_TextSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 3 );
bSizeCtrlSizer->Add( m_TextSize, 0, wxLEFT|wxRIGHT|wxEXPAND, 3 );
m_staticSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticSizeUnits->Wrap( -1 );
+266 -194
View File
@@ -102,17 +102,17 @@
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="growablerows">1</property>
<property name="hgap">3</property>
<property name="minimum_size"></property>
<property name="name">m_textControlSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="rows">2</property>
<property name="rows">3</property>
<property name="vgap">3</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="flag">wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -142,7 +142,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Text:</property>
<property name="label">Text:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -150,7 +150,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText1</property>
<property name="name">m_staticTextLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@@ -195,195 +195,267 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" 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_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_VALUESINGLE</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textLabelSingleLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></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">wxTE_PROCESS_ENTER|wxTE_RICH</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type">wxString</property>
<property name="validator_style">wxFILTER_EXCLUDE_CHAR_LIST</property>
<property name="validator_type">wxTextValidator</property>
<property name="validator_variable">m_labelText</property>
<property name="value"></property>
<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="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="OnText"></event>
<event name="OnTextEnter">OnEnterKey</event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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_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_ANY</property>
<property name="label">Text:</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>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextText</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></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">Enter the text to be used within the schematic</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<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>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size">-1,-1</property>
<property name="name">bSizeText</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" 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_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_VALUESINGLE</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textLabelSingleLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></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">wxTE_PROCESS_ENTER|wxTE_RICH</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type">wxString</property>
<property name="validator_style">wxFILTER_EXCLUDE_CHAR_LIST</property>
<property name="validator_type">wxTextValidator</property>
<property name="validator_variable">m_labelText</property>
<property name="value"></property>
<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="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="OnText"></event>
<event name="OnTextEnter">OnEnterKey</event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" 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_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_VALUEMULTI</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,60</property>
<property name="moveable">1</property>
<property name="name">m_textLabelMultiLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></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">wxTE_MULTILINE</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="value"></property>
<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="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="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="wxTextCtrl" 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_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_VALUEMULTI</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,60</property>
<property name="moveable">1</property>
<property name="name">m_textLabelMultiLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></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">wxTE_MULTILINE</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="value"></property>
<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="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="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -480,7 +552,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="flag">wxLEFT|wxRIGHT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
+2 -1
View File
@@ -43,8 +43,9 @@ class DIALOG_LABEL_EDITOR_BASE : public DIALOG_SHIM
};
wxFlexGridSizer* m_textControlSizer;
wxStaticText* m_staticText1;
wxStaticText* m_staticTextLabel;
wxTextCtrl* m_textLabelSingleLine;
wxStaticText* m_staticTextText;
wxTextCtrl* m_textLabelMultiLine;
wxStaticText* m_SizeTitle;
wxTextCtrl* m_TextSize;
@@ -699,8 +699,10 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames()
for( auto fieldName : userFieldNames )
AddField( fieldName, true, false );
// Add any templateFieldNames which aren't already present in the userFieldNames
for( auto templateFieldName : m_parent->GetTemplateFieldNames() )
AddField( templateFieldName.m_Name, false, false );
if( userFieldNames.count( templateFieldName.m_Name ) == 0 )
AddField( templateFieldName.m_Name, false, false );
}
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -81,10 +81,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
sbSizerPinSharing = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Sharing:") ), wxVERTICAL );
m_checkApplyToAllParts = new wxCheckBox( sbSizerPinSharing->GetStaticBox(), wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPinSharing->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
sbSizerPinSharing->Add( m_checkApplyToAllParts, 0, wxALL, 3 );
m_checkApplyToAllConversions = new wxCheckBox( sbSizerPinSharing->GetStaticBox(), wxID_ANY, _("Common to all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPinSharing->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
sbSizerPinSharing->Add( m_checkApplyToAllConversions, 0, wxALL, 3 );
boarderSizer->Add( sbSizerPinSharing, 0, wxEXPAND|wxALL, 5 );
@@ -172,7 +172,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
bRightSizer->Add( fgSizerTextsSizes, 0, wxALL|wxEXPAND, 5 );
m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL|wxBORDER_SUNKEN );
m_panelShowPin->SetMinSize( wxSize( 150,150 ) );
bRightSizer->Add( m_panelShowPin, 1, wxEXPAND | wxALL, 5 );
+243 -5
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="14" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@@ -55,13 +55,20 @@
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneActivated"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnClose">OnCloseDialog</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@@ -76,17 +83,23 @@
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMaximize"></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="OnMove"></event>
<event name="OnMoveEnd"></event>
<event name="OnMoveStart"></event>
<event name="OnMoving"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnShow"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
@@ -161,6 +174,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pin &amp;name:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -186,7 +200,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -273,7 +294,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -335,6 +363,7 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTPADNAME</property>
<property name="label">Pin n&amp;umber:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -360,7 +389,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -447,7 +483,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -509,6 +552,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Orientation:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -534,7 +578,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -622,7 +673,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCombobox">OnPropertiesChange</event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
@@ -685,6 +743,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Electrical type:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -710,7 +769,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -798,7 +864,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCombobox">OnPropertiesChange</event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
@@ -861,6 +934,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Graphic &amp;Style:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -886,7 +960,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -974,7 +1055,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCombobox">OnPropertiesChange</event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
@@ -1030,7 +1118,7 @@
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -1090,7 +1178,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCheckBox">OnPropertiesChange</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@@ -1118,7 +1213,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@@ -1178,7 +1273,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCheckBox">OnPropertiesChange</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@@ -1281,7 +1383,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnCheckBox">OnPropertiesChange</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@@ -1371,6 +1480,7 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTNAMESIZE</property>
<property name="label">N&amp;ame text size:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1396,7 +1506,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1483,7 +1600,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1545,6 +1669,7 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICNAMETEXTSIZEUNITS</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1570,7 +1695,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1628,6 +1760,7 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTPADNAMESIZE</property>
<property name="label">Number te&amp;xt size:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1653,7 +1786,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1740,7 +1880,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1802,6 +1949,7 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICNUMBERTEXTSIZEUNITS</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1827,7 +1975,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1885,6 +2040,7 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTPINLEN</property>
<property name="label">&amp;Length:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1910,7 +2066,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -1997,7 +2160,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2059,6 +2229,7 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICLENGTHUNITS</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2084,7 +2255,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2142,6 +2320,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pin Pos X:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2167,7 +2346,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2254,7 +2440,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2316,6 +2509,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2341,7 +2535,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2399,6 +2600,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Pin Pos Y:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2424,7 +2626,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2511,7 +2720,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2573,6 +2789,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2598,7 +2815,14 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2679,8 +2903,15 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER|wxTAB_TRAVERSAL</property>
<property name="window_style">wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL|wxBORDER_SUNKEN</property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -2765,7 +2996,14 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnAux1DClick"></event>
<event name="OnAux1Down"></event>
<event name="OnAux1Up"></event>
<event name="OnAux2DClick"></event>
<event name="OnAux2Down"></event>
<event name="OnAux2Up"></event>
<event name="OnChar"></event>
<event name="OnCharHook"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -84,7 +84,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
sOptionsSizer->Add( m_CommonUnit, 0, wxALL, 5 );
m_CommonConvert = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_CommonConvert, 0, wxALIGN_RIGHT|wxBOTTOM|wxEXPAND|wxLEFT, 5 );
sOptionsSizer->Add( m_CommonConvert, 0, wxBOTTOM|wxLEFT, 5 );
m_Invisible = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Invisible"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_Invisible, 0, wxALIGN_LEFT|wxBOTTOM|wxLEFT, 5 );
@@ -123,7 +123,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
bMainSizer->Add( m_sdbSizerButtons, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
bMainSizer->Add( m_sdbSizerButtons, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_RIGHT, 5 );
this->SetSizer( bMainSizer );
@@ -947,7 +947,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxBOTTOM|wxEXPAND|wxLEFT</property>
<property name="flag">wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@@ -1399,7 +1399,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_RIGHT</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="0">
<property name="Apply">0</property>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+5 -2
View File
@@ -194,9 +194,12 @@ void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem )
// save old image in undo list if not already in edit
// or the image to be edited is part of a block
if( aItem->GetFlags() == 0 ||
GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aItem->GetFlags() & mask ) == 0
|| GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{
SaveCopyInUndoList( aItem, UR_CHANGED );
}
dlg.TransfertToImage( aItem->GetImage() );
OnModify();
+4 -2
View File
@@ -54,7 +54,8 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
wxT( "Invalid schematic field parent item." ) );
// Save old component in undo list if not already in edit, or moving.
if( aField->GetFlags() == 0 )
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aField->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( component, UR_CHANGED );
// Don't use GetText() here. If the field is the reference designator and it's parent
@@ -100,7 +101,8 @@ void SCH_EDIT_FRAME::RotateField( SCH_FIELD* aField )
SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
// Save old component in undo list if not already in edit, or moving.
if( aField->GetFlags() == 0 )
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aField->GetFlags() & mask ) == 0 )
SaveCopyInUndoList( component, UR_CHANGED );
if( aField->GetTextAngle() == TEXT_ANGLE_HORIZ )
+6 -2
View File
@@ -147,9 +147,12 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, bool aSaveUnderNewName,
wxRemoveFile( autoSaveFileName.GetFullPath() );
}
// Update the screen and frame info.
// Update the screen and frame info and reset the lock file.
if( aSaveUnderNewName )
{
aScreen->SetFileName( schematicFileName.GetFullPath() );
LockFile( schematicFileName.GetFullPath() );
}
aScreen->ClrSave();
aScreen->ClrModify();
@@ -844,7 +847,8 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
if( !fpField->GetText().IsEmpty() )
{
LIB_ID fpId( fpField->GetText() );
LIB_ID fpId;
fpId.Parse( fpField->GetText(), LIB_ID::ID_SCH, true );
fpId.SetLibNickname( newfilename.GetName() );
fpField->SetText( fpId.Format() );
}
+1 -1
View File
@@ -85,7 +85,7 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibBrowse
{
LIB_ID id;
if( id.Parse( symbol ) == -1 )
if( id.Parse( symbol, LIB_ID::ID_SCH ) == -1 )
sel.LibId = id;
sel.Unit = viewlibFrame->GetUnit();
+3 -1
View File
@@ -594,7 +594,9 @@ void LIB_EDIT_FRAME::OnUpdateSaveAll( wxUpdateUIEvent& event )
break;
}
event.SetText( modified > 1 ? _( "Save All &Libraries..." ) : _( "Save All &Libraries" ) );
wxString text = modified > 1 ? _( "Save All &Libraries..." ) : _( "Save All &Libraries" );
event.SetText( AddHotkeyName( text, g_Libedit_Hokeys_Descr, HK_SAVE_ALL_LIBS ) );
event.Enable( modified > 0 );
}
@@ -379,6 +379,7 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
const SCH_SHEET_LIST& sheetList = g_RootSheet;
m_directives.clear();
bool controlBlock = false;
for( unsigned i = 0; i < sheetList.size(); i++ )
{
@@ -392,29 +393,63 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
if( text.IsEmpty() )
continue;
if( text.GetChar( 0 ) == '.' )
// Analyze each line of a text field
wxStringTokenizer tokenizer( text, "\r\n" );
while( tokenizer.HasMoreTokens() )
{
wxStringTokenizer tokenizer( text, "\r\n" );
wxString line( tokenizer.GetNextToken() );
while( tokenizer.HasMoreTokens() )
// Convert to lower-case and remove preceding
// and trailing white-space characters
line.MakeLower().Trim( true ).Trim( false );
// 'Include' directive stores the library file name, so it
// can be later resolved using a list of paths
if( line.StartsWith( ".inc" ) )
{
wxString directive( tokenizer.GetNextToken() );
wxString lib = line.AfterFirst( ' ' );
if( directive.StartsWith( ".inc" ) )
{
wxString lib = directive.AfterFirst( ' ' );
if( lib.IsEmpty() )
continue;
if( !lib.IsEmpty() )
m_libraries.insert( lib );
}
else if( directive.StartsWith( ".title " ) )
// Strip quotes if present
if( ( lib.StartsWith( "\"" ) && lib.EndsWith( "\"" ) )
|| ( lib.StartsWith( "'" ) && lib.EndsWith( "'" ) ) )
{
m_title = directive.AfterFirst( ' ' );
}
else
{
m_directives.push_back( directive );
lib = lib.Mid( 1, lib.Length() - 2 );
}
m_libraries.insert( lib );
}
// Store the title to be sure it appears
// in the first line of output
else if( line.StartsWith( ".title " ) )
{
m_title = line.AfterFirst( ' ' );
}
// Handle .control .. .endc blocks
else if( line.IsSameAs( ".control" ) && ( !controlBlock ) )
{
controlBlock = true;
}
else if( line.IsSameAs( ".endc" ) && controlBlock )
{
controlBlock = false;
m_directives.push_back( line );
}
// Usual one-line directives
else if( line.StartsWith( '.' ) )
{
m_directives.push_back( line );
}
if( controlBlock )
{
m_directives.push_back( line );
}
}
}
+2
View File
@@ -287,6 +287,8 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_SCH_PLACE_COMPONENT:
if( (item == NULL) || (item->GetFlags() == 0) )
{
// ERC dialog interferes with moving items so we close it before starting
CloseErc();
GetScreen()->SetCurItem( Load_Component( aDC, NULL,
s_CmpNameList, true ) );
m_canvas->SetAutoPanRequest( true );
+2
View File
@@ -278,6 +278,8 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ),
KiBitmap( checked_ok_xpm ) );
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ),
KiBitmap( edit_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ),
KiBitmap( delete_xpm ) );
break;
+14
View File
@@ -239,6 +239,11 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
if( aItemsList.GetCount() == 0 )
return;
// Keep trace of existing sheet paths. Duplicate block can modify this list
bool hasSheetCopied = false;
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
newitem = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
@@ -270,6 +275,7 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
sheet->SetTimeStamp( timeStamp );
hasSheetCopied = true;
break;
}
@@ -285,6 +291,14 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
}
MoveItemsInList( aItemsList, aMoveVector );
if( hasSheetCopied )
{
// We clear annotation of new sheet paths.
// Annotation of new components added in current sheet is already cleared.
SCH_SCREENS screensList( g_RootSheet );
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
}
}
+17 -10
View File
@@ -258,10 +258,15 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
// Test whether there is a conflict or if the symbol can only be found in the cache
// and the symbol name does not have any illegal characters.
if( ( ( cache_match && lib_match
&& !cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
|| (!cache_match && lib_match ) ) && !LIB_ID::HasIllegalChars( part_name, LIB_ID::ID_SCH ) )
continue;
if( LIB_ID::HasIllegalChars( part_name, LIB_ID::ID_SCH ) == -1 )
{
if( cache_match && lib_match &&
!cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
continue;
if( !cache_match && lib_match )
continue;
}
// Check if the symbol has already been rescued.
wxString new_name = LIB_ID::FixIllegalChars( part_name, LIB_ID::ID_SCH );
@@ -333,7 +338,7 @@ RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::RESCUE_SYMBOL_LIB_TABLE_CANDIDATE(
LIB_PART* aLibCandidate ) : RESCUE_CANDIDATE()
{
m_requested_id = aRequestedId;
m_requested_name = aRequestedId.GetLibItemName();
m_requested_name = aRequestedId.Format();
m_new_id = aNewId;
m_lib_candidate = aLibCandidate;
m_cache_candidate = aCacheCandidate;
@@ -379,12 +384,14 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
continue;
// Test whether there is a conflict or if the symbol can only be found in the cache.
if( ( ( cache_match && lib_match
&& !cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
|| (!cache_match && lib_match ) )
&& !LIB_ID::HasIllegalChars( part_id.GetLibItemName(), LIB_ID::ID_SCH ) )
if( LIB_ID::HasIllegalChars( part_id.GetLibItemName(), LIB_ID::ID_SCH ) == -1 )
{
continue;
if( cache_match && lib_match &&
!cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
continue;
if( !cache_match && lib_match )
continue;
}
// Fix illegal LIB_ID name characters.
+27
View File
@@ -1111,6 +1111,33 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
}
bool SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing( const wxString& aSheetPathName )
{
// a empty sheet path is illegal:
wxCHECK( !aSheetPathName.IsEmpty(), false );
wxString reference_path;
// The full component reference path is aSheetPathName + the component time stamp itself
// full_AR_path is the alternate reference path to search
wxString full_AR_path = aSheetPathName + wxString::Format( "%8.8X", GetTimeStamp() );
for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
{
// Break hierarchical reference in path, ref and multi selection:
reference_path = m_PathsAndReferences[ii].BeforeFirst( ' ' );
// if aSheetPath is found, nothing to do:
if( reference_path.Cmp( full_AR_path ) == 0 )
return false;
}
// This entry does not exist: add it, with a (temporary?) reference (last ref used for display)
AddHierarchicalReference( full_AR_path, m_Fields[REFERENCE].GetText(), m_unit );
return true;
}
void SCH_COMPONENT::SetOrientation( int aOrientation )
{
TRANSFORM temp = TRANSFORM();
+13
View File
@@ -299,6 +299,19 @@ public:
*/
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
/**
* Add aSheetPath in m_PathsAndReferences alternate references list,
* if this entry does not exist
* Do nothing if already exists.
* In component lists shared by more than one sheet path, an entry for each
* sheet path must exist to manage references
* @param aSheetPathName is the candidate sheet path name
* this sheet path is the sheet path of the sheet containing the component,
* not the full component sheet path
* @return false if the alternate reference was existing, true if added.
*/
bool AddSheetPathReferenceEntryIfMissing( const wxString& aSheetPathName );
/**
* Change the time stamp to \a aNewTimeStamp and updates the reference path.
*
+27 -16
View File
@@ -469,9 +469,10 @@ void SCH_EAGLE_PLUGIN::loadDrawing( wxXmlNode* aDrawingNode )
// wxXmlNode* grid = drawingChildren["grid"]
wxXmlNode* layers = drawingChildren["layers"];
auto layers = drawingChildren["layers"];
loadLayerDefs( layers );
if( layers )
loadLayerDefs( layers );
// wxXmlNode* library = drawingChildren["library"]
@@ -479,7 +480,9 @@ void SCH_EAGLE_PLUGIN::loadDrawing( wxXmlNode* aDrawingNode )
// Load schematic
loadSchematic( drawingChildren["schematic"] );
auto schematic = drawingChildren["schematic"];
if( schematic )
loadSchematic( schematic );
}
@@ -488,7 +491,8 @@ void SCH_EAGLE_PLUGIN::countNets( wxXmlNode* aSchematicNode )
// Map all children into a readable dictionary
NODE_MAP schematicChildren = MapChildren( aSchematicNode );
// Loop through all the sheets
wxXmlNode* sheetNode = schematicChildren["sheets"]->GetChildren();
wxXmlNode* sheetNode = getChildrenNodes( schematicChildren, "sheets" );
while( sheetNode )
{
@@ -519,8 +523,12 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
{
// Map all children into a readable dictionary
NODE_MAP schematicChildren = MapChildren( aSchematicNode );
auto partNode = getChildrenNodes( schematicChildren, "parts" );
auto libraryNode = getChildrenNodes( schematicChildren, "libraries" );
auto sheetNode = getChildrenNodes( schematicChildren, "sheets" );
wxXmlNode* partNode = schematicChildren["parts"]->GetChildren();
if( !partNode || !libraryNode || !sheetNode )
return;
while( partNode )
{
@@ -529,10 +537,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
partNode = partNode->GetNext();
}
// Loop through all the libraries
wxXmlNode* libraryNode = schematicChildren["libraries"]->GetChildren();
while( libraryNode )
{
// Read the library name
@@ -553,9 +558,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
countNets( aSchematicNode );
// Loop through all the sheets
wxXmlNode* sheetNode = schematicChildren["sheets"]->GetChildren();
int sheet_count = countChildren( schematicChildren["sheets"], "sheet" );
int sheet_count = countChildren( sheetNode->GetParent(), "sheet" );
// If eagle schematic has multiple sheets then create corresponding subsheets on the root sheet
if( sheet_count > 1 )
@@ -1064,7 +1067,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
wxString gatename = epart->deviceset + epart->device + einstance.gate;
wxString symbolname = wxString( epart->deviceset + epart->device );
symbolname.Replace( "*", "" );
wxString kisymbolname = LIB_ID::FixIllegalChars( symbolname, LIB_ID::ID_SCH );
wxString kisymbolname = fixSymbolName( symbolname );
int unit = m_eagleLibs[libraryname].GateUnit[gatename];
@@ -1228,7 +1231,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
NODE_MAP libraryChildren = MapChildren( aLibraryNode );
// Loop through the symbols and load each of them
wxXmlNode* symbolNode = libraryChildren["symbols"]->GetChildren();
wxXmlNode* symbolNode = getChildrenNodes( libraryChildren, "symbols" );
while( symbolNode )
{
@@ -1238,7 +1241,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
}
// Loop through the devicesets and load each of them
wxXmlNode* devicesetNode = libraryChildren["devicesets"]->GetChildren();
wxXmlNode* devicesetNode = getChildrenNodes( libraryChildren, "devicesets" );
while( devicesetNode )
{
@@ -1260,7 +1263,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
wxString symbolName = edeviceset.name + edevice.name;
symbolName.Replace( "*", "" );
wxASSERT( !symbolName.IsEmpty() );
symbolName = LIB_ID::FixIllegalChars( symbolName, LIB_ID::ID_SCH );
symbolName = fixSymbolName( symbolName );
if( edevice.package )
aEagleLibrary->package[symbolName] = edevice.package.Get();
@@ -1304,7 +1307,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
if( gates_count == 1 && ispower )
kpart->SetPower();
wxString name = LIB_ID::FixIllegalChars( kpart->GetName(), LIB_ID::ID_SCH );
wxString name = fixSymbolName( kpart->GetName() );
kpart->SetName( name );
m_pi->SaveSymbol( getLibFileName().GetFullPath(), new LIB_PART( *kpart.get() ),
m_properties.get() );
@@ -2576,3 +2579,11 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_COMPONENT* aComponent,
}
}
}
wxString SCH_EAGLE_PLUGIN::fixSymbolName( const wxString& aName )
{
wxString ret = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_SCH );
return ret;
}
+9
View File
@@ -250,6 +250,15 @@ private:
* @param aUpdateSet decides whether the missing units data should be updated.
*/
void addImplicitConnections( SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen, bool aUpdateSet );
/**
* Fixes invalid characters in Eagle symbol names. It changes invalid characters
* to underscores.
*
* @param aName is the symbol name to be fixed.
* @return Fixed symbol name.
*/
static wxString fixSymbolName( const wxString& aName );
};
#endif // _SCH_EAGLE_PLUGIN_H_
+29 -3
View File
@@ -171,7 +171,7 @@ PART_LIBS* PROJECT::SchLibs()
catch( const PARSE_ERROR& pe )
{
wxString lib_list = UTF8( pe.inputLine );
wxWindow* parent = 0; // Pgm().App().GetTopWindow();
wxWindow* parent = Pgm().App().GetTopWindow();
// parent of this dialog cannot be NULL since that breaks the Kiway() chain.
HTML_MESSAGE_BOX dlg( parent, _( "Not Found" ) );
@@ -186,7 +186,9 @@ PART_LIBS* PROJECT::SchLibs()
}
catch( const IO_ERROR& ioe )
{
DisplayError( NULL, ioe.What() );
wxWindow* parent = Pgm().App().GetTopWindow();
DisplayError( parent, ioe.What() );
}
}
@@ -846,6 +848,16 @@ void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
}
void SCH_EDIT_FRAME::CloseErc()
{
// Find the ERC dialog if it's open and close it
wxWindow* erc = FindWindowById( ID_DIALOG_ERC, this );
if( erc )
erc->Close( false );
}
void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
{
doUpdatePcb( "" );
@@ -1392,13 +1404,19 @@ void SCH_EDIT_FRAME::addCurrentItemToList( bool aRedraw )
if( item->IsNew() )
{
// When a new sheet is added to the hierarchy, a clear annotation can be needed
// for all new sheet paths added by the new sheet (if this sheet is loaded from
// and existing sheet or a existing file, it can also contain subsheets)
bool doClearAnnotation = false;
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
if( item->Type() == SCH_SHEET_T )
{
// Fix the size and position of the new sheet using the last values set by
// the m_mouseCaptureCallback function.
m_canvas->SetMouseCapture( NULL, NULL );
if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet ) )
if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet, &doClearAnnotation ) )
{
screen->SetCurItem( NULL );
delete item;
@@ -1436,6 +1454,14 @@ void SCH_EDIT_FRAME::addCurrentItemToList( bool aRedraw )
wxLogMessage( wxT( "addCurrentItemToList: expected type = SCH_SHEET_PIN_T, actual type = %d" ),
item->Type() );
}
if( doClearAnnotation )
{
// Clear annotation of new sheet paths: the new sheet and its sub-sheets
// If needed the missing alternate references of components will be created
SCH_SCREENS screensList( g_RootSheet );
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
}
}
else
{
+13 -1
View File
@@ -922,6 +922,11 @@ private:
void OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent );
void OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent );
/**
* Close the ERC dialog if it is open.
*/
void CloseErc();
/**
* Set the main window title bar text.
*
@@ -1106,8 +1111,15 @@ public:
* the current associated screen file name is changed and saved to disk.
*
* Note: the screen is not refresh. The caller is responsible to do that
*
* @param aSheet is the sheet to edit
* @param aHierarchy is the current hierarchy containing aSheet
* @param aClearAnnotationNewItems is a reference to a bool to know if the items managed by
* this sheet need to have their annotation cleared i.e. when an existing item list is used.
* it can happens when the edited sheet used an existying file, or becomes a new instance
* of a already existing sheet.
*/
bool EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy );
bool EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, bool* aClearAnnotationNewItems );
wxPoint GetLastSheetPinPosition() const { return m_lastSheetPinPosition; }
+11 -7
View File
@@ -1363,13 +1363,17 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( FILE_LINE_READER& aReader )
int thickness = 0;
// The following tokens do not exist in version 1 schematic files.
// The following tokens do not exist in version 1 schematic files,
// and not always in version 2 for HLabels and GLabels
if( m_version > 1 )
{
if( strCompare( "Italic", line, &line ) )
text->SetItalic( true );
else if( !strCompare( "~", line, &line ) )
SCH_PARSE_ERROR( _( "expected 'Italics' or '~'" ), aReader, line );
if( m_version > 2 || *line >= ' ' )
{
if( strCompare( "Italic", line, &line ) )
text->SetItalic( true );
else if( !strCompare( "~", line, &line ) )
SCH_PARSE_ERROR( _( "expected 'Italics' or '~'" ), aReader, line );
}
// The thickness token does not exist in older versions of the schematic file format
// so calling parseInt will be made only if the EOL is not reached.
@@ -1428,7 +1432,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( FILE_LINE_READER& aReader )
// parsing the symbol name with LIB_ID::Parse() would break symbol library links
// that contained '/' and ':' characters.
if( m_version > 3 )
libId.Parse( libName );
libId.Parse( libName, LIB_ID::ID_SCH, true );
else
libId.SetLibItemName( libName, false );
@@ -2417,7 +2421,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDocs()
SCH_PARSE_ERROR( "$CMP command expected", reader, line );
parseUnquotedString( aliasName, reader, line, &line ); // Alias name.
LIB_ID::FixIllegalChars( aliasName, LIB_ID::ID_ALIAS );
aliasName = LIB_ID::FixIllegalChars( aliasName, LIB_ID::ID_SCH );
LIB_ALIAS_MAP::iterator it = m_aliases.find( aliasName );
if( it == m_aliases.end() )
+107 -5
View File
@@ -117,7 +117,13 @@ SCH_SCREEN::SCH_SCREEN( KIWAY* aKiway ) :
SCH_SCREEN::~SCH_SCREEN()
{
ClearUndoRedoList();
FreeDrawList();
// Now delete items in draw list. We do that only if the list is not empty,
// because if the list was appended to another list (see SCH_SCREEN::Append( SCH_SCREEN* aScreen )
// it is empty but as no longer the ownership (m_drawList.meOwner == false) of items, and calling
// FreeDrawList() with m_drawList.meOwner == false will generate a debug alert in debug mode
if( GetDrawItems() )
FreeDrawList();
}
@@ -529,21 +535,33 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
* their SCH_SCREEN::Draw() draws nothing
*/
std::vector< SCH_ITEM* > junctions;
std::vector< SCH_ITEM* > middlez;
// Ensure links are up to date, even if a library was reloaded for some reason:
UpdateSymbolLinks();
// BITMAPs are drawn first, junctions are drawn last
// All other items are drawn in the order they were placed in the schematic
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
if( item->IsMoving() || item->IsResized() )
continue;
// TODO: clean this draw routine with a well-defined drawing order (maybe 5.1?)
if( item->Type() == SCH_JUNCTION_T )
junctions.push_back( item );
else
// uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox()
// if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) )
else if( item->Type() == SCH_BITMAP_T )
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
else
middlez.push_back( item );
}
for( auto item : middlez )
{
// uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox()
// if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) )
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), aDrawMode, aColor );
}
for( auto item : junctions )
@@ -716,6 +734,23 @@ void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
}
void SCH_SCREEN::EnsureAlternateReferencesExist()
{
if( GetClientSheetPathsCount() <= 1 ) // No need for alternate reference
return;
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T )
continue;
// Add (when not existing) all sheet path entries
for( unsigned int ii = 0; ii < m_clientSheetPathList.GetCount(); ii++ )
((SCH_COMPONENT*)item)->AddSheetPathReferenceEntryIfMissing( m_clientSheetPathList[ii] );
}
}
void SCH_SCREEN::GetHierarchicalItems( EDA_ITEMS& aItems )
{
SCH_ITEM* item = m_drawList.begin();
@@ -887,7 +922,8 @@ int SCH_SCREEN::UpdatePickList()
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
// An item is picked if its bounding box intersects the reference area.
if( item->HitTest( area ) )
if( item->HitTest( area ) &&
( !m_BlockLocate.IsDragging() || item->IsType( SCH_COLLECTOR::DraggableItems ) ) )
{
picker.SetItem( item );
m_BlockLocate.PushItem( picker );
@@ -1329,6 +1365,47 @@ void SCH_SCREENS::ClearAnnotation()
m_screens[i]->ClearAnnotation( NULL );
}
void SCH_SCREENS::ClearAnnotationOfNewSheetPaths( SCH_SHEET_LIST& aInitialSheetPathList )
{
// Clear the annotation for the components inside new sheetpaths
// not already in aInitialSheetList
SCH_SCREENS screensList( g_RootSheet ); // The list of screens, shared by sheet paths
screensList.BuildClientSheetPathList(); // build the shared by sheet paths, by screen
// Search for new sheet paths, not existing in aInitialSheetPathList
// and existing in sheetpathList
SCH_SHEET_LIST sheetpathList( g_RootSheet );
for( SCH_SHEET_PATH& sheetpath: sheetpathList )
{
bool path_exists = false;
for( const SCH_SHEET_PATH& existing_sheetpath: aInitialSheetPathList )
{
if( existing_sheetpath.Path() == sheetpath.Path() )
{
path_exists = true;
break;
}
}
if( !path_exists )
{
// A new sheet path is found: clear the annotation corresponding to this new path:
SCH_SCREEN* curr_screen = sheetpath.LastScreen();
// Clear annotation and create the AR for this path, if not exists,
// when the screen is shared by sheet paths.
// Otherwise ClearAnnotation do nothing, because the F1 field is used as
// reference default value and takes the latest displayed value
curr_screen->EnsureAlternateReferencesExist();
curr_screen->ClearAnnotation( &sheetpath );
}
}
}
int SCH_SCREENS::ReplaceDuplicateTimeStamps()
{
EDA_ITEMS items;
@@ -1537,3 +1614,28 @@ int SCH_SCREENS::ChangeSymbolLibNickname( const wxString& aFrom, const wxString&
return cnt;
}
void SCH_SCREENS::BuildClientSheetPathList()
{
SCH_SHEET_LIST sheetList( g_RootSheet );
for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
curr_screen->GetClientSheetPaths().Clear();
for( SCH_SHEET_PATH& sheetpath: sheetList )
{
SCH_SCREEN* used_screen = sheetpath.LastScreen();
// SEarch for the used_screen in list and add this unique sheet path:
for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
{
if( used_screen == curr_screen )
{
curr_screen->GetClientSheetPaths().Add( sheetpath.Path() );
break;
}
}
}
}

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