Compare commits

...

191 Commits

Author SHA1 Message Date
jean-pierre charras 9f35e384c1 Pcbnew: fix a few plot issues (from master branch) 2017-08-01 12:39:06 +02:00
Chris Pavlina 6b1b6d4ff7 Add several missing libraries 2017-07-31 12:50:45 -04:00
jean-pierre charras be070d95be Fix issues in plot functions, when used from python scripts. 2017-07-25 10:12:08 +02:00
jean-pierre charras 17f7921311 kicad: create zip archive: test for write file error (crashes when the folder was not writable) 2017-07-24 18:07:29 +02:00
Wayne Stambaugh 631f6d53d3 Tag stable release 4.0.7 2017-07-14 15:17:29 -04:00
Wayne Stambaugh aba04c6ec5 Remove leading/trailing white space error message from field validator.
The illegal white space testing for reference and value (library editor
only) fields are adequate to ensure the user cannot enter invalid white
space characters.  Leading and/or trailing white space should not be an
issue for field storage in the schematic file as they are quoted.  Rather
than silently removing the leading and/or trailing white space which is
frowned upon, let the user fix it.

Fixes lp:1659526

https://bugs.launchpad.net/kicad/+bug/1659526
2017-07-14 13:43:27 -04:00
Maciej Suminski 133cb01f79 Fix crash when dragging a track
Fixes: lp:1657226
* https://bugs.launchpad.net/kicad/+bug/1657226
2017-07-13 10:54:12 +02:00
jean-pierre charras 464175e995 Fix possible crash and issues when a incorrect fp lib table is loaded:
correct lines are loaded, and pcbnew is no longer aborted.
2017-07-12 20:27:18 +02:00
jean-pierre charras c0fab4b350 Cvpcb: fix incorrect automatic assignments when using .equ files and the automatic association.
Fix from master branch.
2017-06-10 20:12:02 +02:00
jean-pierre charras 17c8198c05 Better error messages when throwing an io error or parse error.
Only the name of the .cpp file throwing the error instead of its full path is printed, like in master branch.
2017-06-04 11:15:45 +02:00
Cirilo Bernardo 683da9acd1 Fix default line widths for non-mm units in DXF import 2017-05-29 09:51:28 +02:00
jean-pierre charras 5a67fc99d3 Fixes: pl-editor doesn't save text thickness when it is not the default value (from master) 2017-05-29 08:00:38 +02:00
jean-pierre charras a7223a95b9 Fix style of gost page layouts in accordance with GOST (from master) 2017-05-29 07:57:16 +02:00
jean-pierre charras 58f90b3adb Eeschema bom scripts: move python scripts to eeschema/plugins/python_scripts and xsl scripts to subdir xsl_scripts.
Python scripts are now installed (previously: were ignored by the make install command)
Better comments in python scripts.
2017-05-15 16:40:21 +02:00
Eldar Khayrullin a374f46b5e Pcbnew: add option to plot DXF editable text
Add option to plot DXF oneline ASCII text as editable text (in non-outline mode)

Fixes: lp:1423515
* https://bugs.launchpad.net/kicad/+bug/1423515
2017-05-08 08:24:22 -04:00
Eldar Khayrullin bfacf02360 Pcbnew: add option to plot DXF lines in outline mode
Add option to plot dialog to plot DXF layers *.Cu, *.Adhes, *.Paste, and
*.Mask in outline mode or line mode.

Fixes lp:1643330

https://bugs.launchpad.net/kicad/+bug/1643330
2017-05-08 08:24:10 -04:00
Wayne Stambaugh 4e8a35cb84 Don't apply last line width to text thickness in symbol library editor.
The symbol library header was setting the text thickness using the
last line thickness setting which is incorrect so use the default
thickness when creating new text objects.

Fixes lp:1635344

https://bugs.launchpad.net/kicad/+bug/1635344
2017-05-04 16:31:02 -04:00
Wayne Stambaugh 6a9f38ecc4 Pcbnew: continue loading footprints after first failure.
The footprint library cache handler would throw an exception on the
first error it encountered preventing all subsequent footprint files
from being parsed even if there was nothing wrong with them.  This
commit queues errors until all of the footprint files in the folder
have been parsed.

Fixes lp:1416736

https://bugs.launchpad.net/kicad/+bug/1416736
2017-05-04 16:25:14 -04:00
jean-pierre charras 593136aca3 Remove some useless or incorrect wxASSERT in plot functions.
Fixes: lp:1685188 Crash on export SVG file with mirrored option
https://bugs.launchpad.net/kicad/+bug/1685188
2017-04-26 09:10:05 +02:00
jean-pierre charras 1754b42ba3 Dialog copper zones: fix a tooltip error 2017-04-22 10:17:59 +02:00
jean-pierre charras 3ae069ed4f Fixes: lp:1684998 (append a board in GAL mode can crashes Pcbnew)
https://bugs.launchpad.net/kicad/+bug/1684998

The crash is due to the fact updating nets and netclasses was made too late, after use.
2017-04-22 09:09:31 +02:00
Wayne Stambaugh fc527f3cc1 Fix zone properties dialog level setting tooltip.
Fix a spelling error and improve the clarity of the zone priority level
tooltip information.

Fixes lp:1681024

https://bugs.launchpad.net/kicad/+bug/1681024
2017-04-10 14:31:11 -04:00
hauptmech 7a5e632455 Prevent segfault when aOutline has no vertices.
When attempting to read a pcad file exported from Altium, kicad was
segfaulting because it was trying to access an empty array. This patch
fixes that.

The reason the array was empty was the the board outline in the pcad
file was composed of only arcs and the plugin only processes lines in
the board outline. Adding this functionality is for another patch I
suppose.

Signed-off-by: Clemens Koller <cko@embeon.de>
2017-04-03 10:46:57 -04:00
Chris Pavlina 82d7a4e61e Highlight the first choice in rescue dialog
Fixes: lp:1455970
* https://bugs.launchpad.net/kicad/+bug/1455970
2017-03-27 09:20:28 -04:00
Wayne Stambaugh 63569551a4 Fix broken links and add correct links to about dialog.
Fixes lp:1670582

https://bugs.launchpad.net/kicad/+bug/1670582
2017-03-08 08:28:15 -05:00
jean-pierre charras 3b7aa48d16 Pcbnew: fix bug: files written when layers have numeric name (like +24)cannot be read
Remove a printf clearly for debug, certainly a very old bug.
2017-02-27 08:12:07 +01:00
Wayne Stambaugh 249b0a0ce5 Reset KiCad version for 4.0.7 stable release development. 2017-02-26 11:30:35 -05:00
Wayne Stambaugh 3c6959b7de Tag stable release 4.0.6 2017-02-17 15:11:08 -05:00
Oliver e5307ca1fb Fix for bug where rotating / editing a selected item would remove it from screen
- Added test to see if there was a currently-editing item

Fixes: lp:1661866

https://bugs.launchpad.net/kicad/+bug/1661866
2017-02-07 09:30:11 -05:00
Wayne Stambaugh d1f8dbb9de Fix rotate bug in symbol library editor.
The rotate hotkey was rotating individual items when a block was selected
which is invalid behavior.  Add check for block mode and disable rotating
items when block mode is active.

Fixes: lp:1660875

https://bugs.launchpad.net/kicad/+bug/1660875
2017-02-01 15:10:07 -05:00
Chris Pavlina 99d7a35797 Reorder eeschema toolbar slightly
- Put the output generation steps (annotation through pcbnew) in the
  correct order as expected by the user running through them.

- Add a Plot button to match pcbnew
2017-01-31 16:08:57 -05:00
jean-pierre charras 0145a03f79 In SetActiveLayer(): fix a potential bug, as a GAL method was called in Legacy mode.
This is a fix from commit b66cb871e6 in master branch.
2017-01-31 11:11:03 +01:00
jean-pierre charras df191606ab Fix a potential incompatibility (due to an old bug) with files which could be created by some recent pcbnew versions
It is unusual to fix an incompatibility with later versions, but it is due to a bug existing in this version,
and this is especially important for footprint files.
2017-01-28 09:00:54 +01:00
Wayne Stambaugh 556be7b431 Do not use default board solder mask clearance in footprint editor.
The footprint editor was displaying the default solder mask clearance
defined by the temporary BOARD object created a start up.  Change the
temporary BOARD default solder mask to 0 so the pad or footprint solder
mask clearance setting is displayed when editing the footprint.

fixes lp:1653980

https://bugs.launchpad.net/kicad/+bug/1653980
2017-01-27 07:52:12 -05:00
Simon Richter e15ba3bf32 Add missing include directory
The common library uses CURL.
2017-01-27 07:38:23 -05:00
jean-pierre charras c23c52834c cleanup a comment 2017-01-24 17:53:33 +01:00
jean-pierre charras 981fddc649 Try to replace avhttp by Curl 2017-01-24 17:44:06 +01:00
jean-pierre charras 5127a6bd09 Fix an issue (from a patch of the master branch): slashes are not translated from \ in windows to / on unix
(see https://bugs.launchpad.net/kicad/+bug/16585)
2017-01-24 17:41:03 +01:00
Wayne Stambaugh 136ba26896 Reset KiCad version for 4.0.6 stable release development. 2017-01-24 10:26:54 -05:00
Wayne Stambaugh 575b22d018 Stable 4.0.5 release.
Set version string to "4.0.5" in KiCadVersion.cmake
Add .gitignore from master branch.
2016-12-02 10:49:09 -05:00
jean-pierre charras 5f01ca8f88 Fixes: lp:1645430 (CSV BOM generation using bom2csv.xsl script with custom entries has wrong format)
https://bugs.launchpad.net/kicad/+bug/1645430
2016-12-02 09:31:04 -05:00
Maciej Suminski 5a3c944b2a Fix crashes when BOARD members are changed and PNS is active
PNS has its own data model with pointers to the BOARD members. If the
tool is active and pointers become stale, pcbnew crashes.

Currently there is a workaround that deactivates the current tool when a
dialog opens. This is the way it is done in the legacy canvas as well.

Fixes: lp:1553804
* https://bugs.launchpad.net/kicad/+bug/1553804
2016-12-01 15:11:26 +01:00
Wayne Stambaugh 50a4b5553a Version string improvements.
Define empty string variable KICAD_BRANCH_NAME that can be used as an
optional version string element.  When git is used to build the version
string, this variable is set to the git branch name.  It can also be
defined at configuration time as an optional string appended to the
$KICAD_VERSION variable.

Define empty string variable KICAD_VERSION_EXTRA that can be set by
the user at configuration.

The variables KICAD_BRANCH_NAME and KICAD_VERSION_EXTRA are only
appended to KICAD_VERSION if they are set.  Otherwise, only KICAD_VERSION
is uses as the version string.

Update the developer building from source document to reflect the changes.
2016-11-28 09:15:04 -05:00
Chris Pavlina 4cb084cd63 Bring back KICAD_REPO_NAME 2016-11-24 13:03:35 -05:00
Chris Pavlina a458342cfc Fix KICAD_BUILD_VERSION build option 2016-11-24 13:03:34 -05:00
jean-pierre charras 8023c7a794 Pcbnew: fix outdated environment vars settings for Kicad python on Windows (from master branch):
On Windows, previously, Pcbnew try to set env vars PYTHONPATH, if <kicad>/bin/python27_us folder is found.
Now, if python.exe is found in kicad bin folder (therefore if our python executable and libs are
installed in Kicad), PYTHONPATH and PYTHONHOME are set to an empty string.
( the default python path work fine with our standard python install )
2016-11-14 08:35:12 +01:00
jean-pierre charras 65fe561a4b Fix from master branch: lp:1635723 (pcbnew: allows sometimes to draw tracks in non copper layers in Gal Mode) 2016-11-13 19:03:52 +01:00
Jean-Noel Avila 18f77b894e Fix off-by-one in saving bitmaps 2016-11-09 09:53:47 +01:00
jean-pierre charras 94a3390544 * Pcbnew: in fill zones calculations, make polygons strictly simple before fracturing them. 2016-11-06 19:50:38 +01:00
jean-pierre charras cec3e300a8 fix incorrect indentation which generates compil warnings 2016-11-06 19:42:10 +01:00
jean-pierre charras a262445047 Fixes: lp:1638499 (footprint editor, footprint transform: incorrect mirror for pads (noticeable only for pads with offset)
https://bugs.launchpad.net/kicad/+bug/1638499
2016-11-05 15:53:01 -04:00
Henner Zeller 0fbdec4c08 Pcbnew: prevent reversal of pad loading order when loading board.
When opening a board file and storing it again, the pads in all
embedded modules get reversed.  This is generally not really nice
if the PCB is managed by version control as it creates churn and
could make merges hard.
2016-10-17 10:17:37 -04:00
Wayne Stambaugh de52ae6c70 Allow the contents of KiCadVersion.cmake to override git version.
When the version string in KiCadVersion.cmake is set to something other
than the default "no-vcs-found", it ignores the git version even if a
.git folder exists in the source folder.
2016-10-14 14:41:36 -04:00
Wayne Stambaugh 9ca6405bcb Minor version string generation improvements.
Remove the KICAD_REPO_NAME option from the main cmake file and the
generated config.h file since it is no longer used.

Set the default branch name to "undefined" in CreateGitVersionHeader.cmake
instead of the KICAD_REPO_NAME option.

Remove generating KICAD_FULL_VERSION from CreateGitVersionHeader.cmake
and add it to WriteVersionHeader.cmake so that the default settings and
the new KiCadVersion.cmake definitions can be used to generate the full
version string as well.

Check to see if the branch name is set and only use the version to
generate the full version string.  This allows the use of the KiCad
version cmake file to create a version only string like "4.0.4" with
no trailing branch name.

Change build_version.cpp to use the full version string rather than
concatenating the version and branch strings.
2016-10-14 08:09:13 -04:00
Wayne Stambaugh 1dc747c0ae Improve version string generation for stable release source archives.
Add KiCadVersion.cmake to set the build version and branch name.

Update WriteVersionHeader.cmake to include KiCadVersion.cmake to set
the defaults in case no .git directory is found.
2016-10-12 21:05:48 -04:00
Chris Pavlina 183835ee67 cmake: rewrite version header when branch changes
Before, only KICAD_BUILD_VERSION, which includes the hash but not the
branch, was compared when deciding whether to regenerate
kicad_build_version.h. This header also contains the branch name though,
so we should compare both to address the case of two branches pointing
at the same commit.
2016-10-12 20:57:10 -04:00
Chris Pavlina 6dbe262b53 Update version string formatting after git migration
It is no longer necessary (or sensible) to include a simulated bzr
revision number, and we can reliably get a branch name now. Therefore,
the new version strings look like:

(2016-08-26 revision 67230ac)-master
 |                   |        |
 |                   |        branch name, "HEAD" if not on a branch,
 |                   |          or "unknown" if no .git present
 |                   |
 |                   abbreviated commit hash, or no-git if no .git
 |                     present
 |
 date of commit, or date of build if no .git present

Signed-off-by: Chris Pavlina <pavlina.chris@gmail.com>
2016-10-12 20:32:38 -04:00
Wayne Stambaugh e074c798bf CvPcb: remove broken footprint documentation feature.
At one point, all of the footprints provided by the KiCad footprint
libraries were merged into a single pdf file. The link to open this
file was provided on the toolbar. Since the footprint libraries have
been split out into individual repositories, this file is no longer
created so the toolbar button and the underlying code to open this
file were removed.

Improve a few CvPcb menu strings.

Fixes lp:702785

https://bugs.launchpad.net/ubuntu/+source/kicad/+bug/702785
2016-10-11 20:14:06 -04:00
Maciej Suminski bd1aae9071 Fixed a crash when a negative (although invalid) net code occurs in legacy plugin 2016-10-11 21:24:37 +02:00
Wayne Stambaugh 6382db4ebf Pcbnew: fix epic footprint editor DXF import fail.
The unfortunate combination of using static_cast to promote board items
to module items then using the assignment operator without any thought as
to what would happen in MODULE::Add() caused the board objects to not be
added to the module.  This is expected because board items cannot be in
modules.  Did this ever work or did someone have a colossal brain cramp?
If it did work, who ever changed it did not test it because in debug
builds, you would have gotten and assertion on every object imported.  On
release builds nothing is imported silently.

Add module object types to the DXF importer and code to choose which type
of object to import.

Remove offending static casts and assignment operator and pass the correct
object directly to the MODULE::Add() function when importing DXF in the
footprint editor.

The usual coding policy fixes.
2016-10-07 22:06:09 -04:00
Wayne Stambaugh 8151ec387c Pcbnew: fix drill file naming issue.
On windows when the project path include a remote volume name (\\NAME),
the volume name does not get cleared by calling wxFileName.SetDir( "" ).
This caused the volume name to be prepended to the file name when
calling wxFileName::GetFullPath().  Use wxFileName::GetFullName()
which resolves the issue.

Fixes lp:1606240

https://bugs.launchpad.net/kicad/+bug/1606240
2016-10-07 15:05:32 -04:00
jean-pierre charras 6e1d45c79e Gerbview: Fix a compil issue I created when copying a fix from the master branch 2016-10-07 19:23:45 +02:00
jean-pierre charras 1d05076761 Eeschema: remove a line which uses a non existing enum value. 2016-10-04 10:26:58 +02:00
jean-pierre charras 89e7d89223 Fix from master branch (lp:1630105 Gerbview print dialog does not display graphic layers list on some windows managers like Unity) 2016-10-04 10:25:35 +02:00
Maciej Suminski 115d70e060 Fixed a crash when drawing a single point polyline 2016-09-29 09:55:42 -04:00
Wayne Stambaugh 1a89a0601a Eeschema: fix assertion on delete node hot key while busy.
Performing a delete node hot key operation while Eeschema is busy performing
another operation causes an assertion in the delete node command event
handler in debug builds.  It also causes the operation in progress to be
cleared if the assertion is ignored or in release builds.

Fix a similar issue when the leave current sheet hot key is called while
busing performing another operation which causes rather interesting behavior
in the sheet that was exited.

Fixes lp:1627434

https://bugs.launchpad.net/kicad/+bug/1627434
2016-09-28 19:26:35 -04:00
Wayne Stambaugh ca0aa6c971 Pcbnew: fix several auto save file issues.
* When Pcbnew is launched in the stand alone mode with no board file command
  line option, the project path is set to the current working directory.  The
  user may not have write access to the current working directory which would
  cause the auto save to generate an error.  If the user does not have write
  access to the current working directory, set the path to a platform specific
  temporary path that the user has write permission.

* When Pcbnew is launched in the stand alone mode with no board file command
  line option, the default BOARD object has no file name.  Set the file name
  to "noname.kicad_pcb" to fix incorrect auto save file name and set the path
  to the user's platform specific document folder.

* Delete orphaned auto save files when closing without saving due to broken
  auto save file generation logic which prepended the file name with "$" rather
  than "_autosave-".

* Fixes: lp:1596382
2016-09-27 20:55:24 -04:00
jp charras 5b4542231e KiCad: fix crash when attempting to view ERC log with text editor.
Fixes lp:1619436

https://bugs.launchpad.net/kicad/+bug/1619436
2016-09-27 15:03:26 -04:00
jean-pierre charras fa85cb3a8b Do not allow spaces in component name (value field) in component library editor, in dialogs (Edit field, Create component).
In component libraries, a space in name breaks the library, and is not allowed.
2016-08-19 21:49:48 -04:00
Chris Pavlina 853984120c FUTURE_FORMAT_ERROR: don't nest errors unnecessarily. 2016-08-17 15:13:28 -04:00
Wayne Stambaugh be62a1ade6 Eeschema: fix broken component reference field in hierarchies. (fixes lp:1572812) 2016-08-10 09:44:19 -04:00
Simon Wells 3b4cdd96ab Hide OpenGL scrollbars on OS X to fix freeze. (fixes lp:1553428) 2016-08-09 15:07:17 -04:00
Jean-Pierre Charras f776b7c3fb Pcbnew: fix a minor bug where the DRC report file is always created. (fixes lp:1593389)
* Prevent DRC file from being created regardless the option selected in the check box.
* The browse file dialog now open the current project folder by default.
2016-08-09 10:49:36 -04:00
Maciej Sumiski 9d233b4cdb Pcbnew: fixed a crash when dragging a line was interrupted. (fixes lp:1606332)
* Crash was caused by removing an element from m_activeTools list, causing other
  iterators to be invalidated when dragging line in GAL mode.
2016-08-09 09:54:57 -04:00
Tomasz Wlostowski 19c54933c1 Polygon: fixed polygon filleting glitch for colinear outline segments. (fixes lp:1527827) 2016-08-05 15:07:42 -04:00
Jean-Pierre Charras 7aca6174d6 Fix window positioning bug when context menu is open. (fixes lp:1606378)
* When a context menu was open and a left mouse click event in the window title
  bar occurred, the window would shift from the title bar click position to the
  context menu select position.  This only seemed to effect windows.
2016-08-05 10:46:36 -04:00
Michael Steinberg 5f98fc0591 Fix dangling board reference crash in GAL. (fixes lp:1584489) 2016-08-05 08:49:12 -04:00
Thomas Pointhuber bcdcaa724d Remove front silkscreen default setting for PTH and NPTH pads. 2016-08-03 14:23:14 -04:00
Michael Steinberg 32f24289bd Fix segfault on BOARDs without tracks. 2016-08-03 08:40:07 -04:00
Jean-Pierre Charras 021320be1b Fix: footprint libraries wizard fails with personal GitHub accounts (now uses https://api.github.com/users/xxx instead of https://api.github.com/orgs/xxx to retrieve the list of .pretty footprint libraries) 2016-07-20 15:56:19 -04:00
Jean-Pierre Charras e309ca10d1 More OSX dialog fixes. 2016-07-18 19:33:12 -04:00
Jean-Pierre Charras a65b7963d1 Eeschema: incorrect dialog size fixes and OSX copy text fix. 2016-07-18 09:59:50 -04:00
Jean-Pierre Charras 26c5485be9 Pcbnew: OSX dialog fixes. 2016-07-15 16:51:28 -04:00
Maciej Sumiski 48d2ac15d5 Fix a GAL crash bug caused by invalid iterator (thanks to Michael Steinberg).
* TOOL_MANAGER::finishTool() caused iterator to become invalid when an
  element was removed from the m_activeTools deque.
2016-07-09 12:33:37 -04:00
jean-pierre charras 2ab90d6d20 Pcbnew: fix potential issue (crash) when loading board files with a missing net section (like created by Gerbview) due to an initialization made to late. 2016-07-05 11:20:38 -04:00
Bernhard Stegmaier 81cc0b4c42 OSX: back port touchpad support from development branch. 2016-07-05 05:44:14 -04:00
Bernhard Stegmaier 95b84f4a8d Fix 3d-viewer regressions introduced by touchpad-panning for non-touchpad-panning (merge of rev. 6593 from development branch). 2016-07-04 21:58:46 +02:00
Bernhard Stegmaier 6c25b29e9f Fix touchpad scrolling on OSX (merge of rev. 6606 from development branch). 2016-07-04 21:47:33 +02:00
Bernhard Stegmaier 1f6789e692 Add support for optional touchpad panning (merge of rev. 6586 from development branch). 2016-07-04 21:43:55 +02:00
Bernhard Stegmaier e4307a86cc OSX: legacy canvas rendering speed improvements.
* Enables USE_WX_GRAPHICS_CONTEXT for OSX by default. This shouldn't be a
  major change because it seems to get used on OSX behind the scenes anyway.
  As a side effect, this might improve behavior with anti-aliasing because
  KiCad shifts drawing by (0.5, 0.5) into the middle of the virtual pixels so
  things may be less blurry. It will still build without enabling
  USE_WX_GRAPHICS_CONTEXT, but the optimizations obviously won¡¯t be used.
* The optimizations currently only are effective when USE_WX_GRAPHICS_CONTEXT
  is enabled and OSX. They might be also good for other platforms using
  USE_WX_GRAPHICS_CONTEXT because it aggregates some drawing primitives using
  paths wxGraphicsContext provides.
* It adds some #ifdefs for disabling the wxGraphicsContext stuff when
  USE_WX_GRAPHICS_CONTEXT isn't enabled. If you hate #ifdefs, this also
  could be dropped but then it will always check if wxGraphicsContext can be
  applied.
2016-06-30 16:51:24 -04:00
jean-pierre charras ce181e6e0a PolyLine.cpp: NormalizeAreaOutlines now removes null segments.
* CPolyLine::Chamfer (and CPolyLine::Fillet) : removes null segments before calculating modified outlines.
  It fixes some incorrect outlines after chamfer or fillet due to null segments creating overflow during calculations.
* CPolyLine::Chamfer : code cleaning (avoid useless double to integer and integer to double conversions).
2016-06-26 20:28:52 -04:00
jean-pierre charras 4212d99c3d Gerbview: Read excellon files: fix incorrect handling of G85 command. (fixes lp:1485420) 2016-06-21 11:56:13 -04:00
jean-pierre charras 535f3ae006 Fix a (minor) issue in Kicad manager: when the schematic editor or the board editor are run from the project tree frame to edit files of the current project, editors are opened on the background. 2016-06-21 11:26:59 -04:00
jean-pierre charras 90ed0183c8 Fix an issue in LOCALE_IO class, used to switch to/back locale "C" when reading/writing files: the back to locale was broken, and created issues in countries using the ',' as fp separator, especially when the non default language was used.
It was reported in many bugs.
2016-06-21 10:48:42 -04:00
Dan Cross 2bb695b767 Fix broken swig import script when using swig 3.0.10. 2016-06-20 16:53:32 -04:00
jean-pierre charras c980e6999a Fix script fix_swig_imports.py to work with swig version 3.0.9. 2016-06-20 16:50:39 -04:00
Wayne Stambaugh 1e7ba6c644 KiCad: fix segfault bug when switching from remote to local project.
* Deleting the wxFileSystemWatcher when switching from a remote project to
  a local project caused KiCad to segfault. Switching from a local project
  to a remote project did not cause KiCad to crash. The fix was to clear all
  of the file system watcher paths instead of deleting and creating a new file
  system watcher object between project changes. The object still crashes on
  exit when deleted in the main window dtor. Allocating the file system
  watcher object on the stack instead of on the heap did not make any difference.
2016-06-20 16:48:43 -04:00
jean-pierre charras 53f6bf29c7 Fix bug: DRC report to File crashes Pcbnew, if the file cannot be created (for instance if the CWD is not writable, or if the path does not exist)
Fix also an other issue: if the file path is not entered, the file is now created in the current project directory.
2016-06-15 15:00:41 -04:00
jean-pierre charras 8e4098f3f1 Cvpcb: fix a focus issue (on OSX), when using arrow keys to scroll the footprint list box, if the footprint and 3D viewers are opened. 2016-05-27 16:51:23 -04:00
Simon Wells 7179a71cdc Multiple monitor loses window when single monitor 2016-05-27 16:46:24 -04:00
Alexander Lunev 606978297d pcad2kicadpcb: fixed an issue with an uppercase fileUnits parameter. 2016-05-27 16:40:37 -04:00
Simon Wells 648b7d53b5 Fix mirrored graphics when moving SCH_BITMAP on OS X 2016-05-27 16:27:11 -04:00
Dick Hollenbeck 93c5e5e4aa Eeschema: updated footprint field after picking from footprint viewer in the eeschema LIB_PART or component text field properties editors. 2016-05-27 16:24:36 -04:00
jean-pierre charras 7940f0773c Try to fix a compil issue on OSX (no viable conversion from 'const wxString' to 'const wxChar *', in colors.cpp). 2016-05-27 16:22:11 -04:00
Dick Hollenbeck 226d56433c Remove support for in processing setting of ld library path. 2016-05-27 15:31:09 -04:00
Dick Hollenbeck 5cf68726d6 Eeschema: make footprint and datasheet initially invisible, when creating a component. 2016-05-27 15:26:10 -04:00
jean-pierre charras 3c233ae08e Make color names translatable in color selection dialog. 2016-05-27 15:23:00 -04:00
Maciej Suminski 9810236314 Mark locked tracks with 'L' letter in status field. 2016-05-27 14:56:09 -04:00
Collin Anderson 7dbf84a9bd Fix beep on hotkey press in OS X 2016-05-27 14:53:10 -04:00
Maciej Suminski b73a71c696 Added 'Reset Grid Origin' hot key (GAL). 2016-05-27 14:51:32 -04:00
Wayne Stambaugh e4e635d3b5 Component library editor field properties dialog improvements.
* Remove fixed dialog size setting to allow sizers to do thier job.
* General spacing and layout improvements.
2016-05-27 14:47:59 -04:00
Chris Pavlina 2ffdc0d03d Fix file version support build error on some platforms. 2016-05-27 14:38:51 -04:00
Chris Pavlina 91f34a9478 Add support for PCB and footprint format versioning
Currently, kicad_pcb files have a (version ...) tag, but it is ignored. This
commit does the following:

1. Parse the version. If it's later than the last supported version, present an
alternative error message suggesting an upgrade if the file does not load
correctly. The version will be interpreted as an integer YYYYMMDD to suggest
a KiCad release date.

2. Accept a (version ...) tag also in kicad_mod files, but do not write them
yet. If no version tag is present in these files, assume the version to be that
of the current format version at the time of this commit.

This is meant to be merged to the 4.x stable series, and preps for KiCad 5
which will start emitting version tags also in footprints - users with what
will then be 'old stable' will not get a parse error when we introduce this for
footprints, and we can safely increment the format version later.
2016-05-27 14:36:53 -04:00
Matthew Petroff 67ab1be495 Correct multiple UI spelling errors. 2016-05-03 12:44:32 -04:00
Martin d`Allens fdc4d2a8a9 Fix typos in dialogs. 2016-05-03 11:32:49 -04:00
Wayne Stambaugh 72f19ded75 Fix value field editing bug in component library editor. (fixes lp:1576363)
* Allow editing value field for power components in the component library editor.
2016-04-29 12:05:08 -04:00
jean-pierre charras 3c8bed9c92 Fix issues in dialog drc: because it is not modal, DRC parameters and unit selection can be modified outside the dialog, still opened. Now, the new parameters are taken in account.
Fixa also a corner case which crashes Pcbnew: if the dialog is opened, and the board was changed (reloaded, cleared), pcbnew crashed because many pointers stored in dialog become invalid. Now the dialog is just closed.
2016-04-15 14:49:33 -04:00
jean-pierre charras 6a33549b68 Gerber files: ensure the "level polarity dark" is set in each file (this is the default, but ensuring that is better and can avoid issues when panneling files) 2016-04-15 14:24:25 -04:00
Wayne Stambaugh ab99c58ead Fix quasi-modal dialog mode in DIALOG_SHIM class.
* Add event handler to check all button clicks for default command event
  IDs and handle them appropriately by either calling EndQuasiModal() or
  passing the event up the event handler chain to allow the default dialog
  handlers to perform their magic.
* Add event handler to handle the close window event properly.
* Add scope brackets so the wxBusyCursor will stop being displayed when
  the footprint library loading is complete in CvPcb.
2016-04-12 18:22:01 -04:00
Wayne Stambaugh c8daccbe0e CvPcb: remove footprint library load failure limit. (fixes lp:1553756)
* Remove the artificial footprint library read error limit to prevent
  potentially readable libraries from being loaded after the error limit
  is reached.
* Change error message dialog to an HTML dialog so that potentially large
  error messages can be displayed with scrolling and the ability to copy
  and paste the error message for bug reporting purposes.
* Add busy cursor when loading the footprint libraries so the user has some
  idea that something is happening while the footprint libraries are being
  loaded.
2016-04-11 14:15:26 -04:00
Wayne Stambaugh b6dedd9f5b Eeschema: fix wxFileDialog assertion when importing component. (fixes lp:1558486)
* wxFileDialog ctor was setting the file name using the most recently used
  path which was incorrect. Set the file path parameter to the most recently
  used path and the file name parameter to an empty string.
* Remove last used import path and use the application wide most recently
  path instead.
* Remove last used export path and use the application wide most recently
  path instead.
2016-04-11 13:58:52 -04:00
Wayne Stambaugh fd054f566e Eeschema: fix build error due to field auto place code merged along with bug fix. 2016-04-07 15:30:12 -04:00
Wayne Stambaugh 4a665f492e Undo cached container commit. 2016-04-07 15:18:19 -04:00
jean-pierre charras a0d41f75ff OpenGL mode: Disable frequent (and not very usefull) memory deallocation/reallocation to avoid "out of memory" issue due to heap fragmentation (noticeable only with large boards).
Note: there is still this issue when switching back legacy mode and to Opengl mode because the heap is still freed and reallocated.
2016-04-07 14:56:16 -04:00
Wayne Stambaugh 5f72cca19a Eeschema: fix field edit dialog power component warning bug.
* Prevent power component warning from being shown when edit normal component
  fields.
* Make text edit dialog size itself instead of using a fixed size.
* Improve the alignment and spacing in the text edit dialog.
* Fix field name typo in field validator (thanks Jean-Pierre Charras for
  catching this).
2016-04-07 14:43:55 -04:00
Wayne Stambaugh 8191327fc2 Eeschema: fix illegal field characters causing corrupt schematic files on Linux. (fixes lp:1529358)
* Refactor edit one field dialogs to use validators and transfer data to and
  from window functions.
* Add code to DIALOG_SHIM to handle validation and transfer functions since
  the base dialog class code is not called by EndQuasiModal().
* Add custom validator class for filtering field text control characters.
* Add new field validator to edit schematic component dialog field text
  control.
* Add new field validator to edit fields in library editor dialog field
  text control.
* Make a few LIB_PART member functions const.
2016-04-07 14:32:53 -04:00
Chris Pavlina a19a52398a Fix graphics rendering on RTL systems (lp:1559545)
* wxWidgets mirrors graphics by default on RTL systems so it is necessary to
  individually set graphics canvases to LTR mode to avoid this.
2016-03-23 14:38:00 -04:00
Baranovskiy Konstantin f3d173fe64 Pcbnew: prevent zone tool from switching to no tool when deleting zone corner. 2016-03-22 13:49:38 -04:00
Chris Pavlina 3076e98b29 Eeschema: fix printf format string in find status message. 2016-03-22 11:39:55 -04:00
jean-pierre charras 1d55823fef Page layout reader fixes.
* Fix a minor issue in parseGraphic method to ensure correct parenthesis balance.
* Update a old (incorrect) .kicad_wks file in demo.
* page_layout_writer.cpp: remove a few useless spaces in output files.
2016-03-22 11:35:16 -04:00
Mark Roszko 62475d0464 PL Editor: fix page layout default description missing parenthesis before the keyword "end" in a few lines. 2016-03-22 11:32:03 -04:00
Cirilo Bernardo 1060d4ac6e Fix and improve IDF tools
The attached patch makes the following changes to the IDF
tool 'dxf2idf':

1. DXF units are now correctly scaled to mm
2. Polylines are now supported
3. LWPolylines are now supported
2016-03-22 11:29:59 -04:00
Cirilo Bernardo 44038c47c6 Various fixes to DXF import
* Correctly implement scaling based on DXF $INSUNITS - at least where
  INSUNITS is sensible. I ignore units like miles, gigameters, AU,
  lightyear, parsec ...
* Correctly implements LWPolylines, adding an ARC segment rather than a
  line segment when bulge != 0. A number of users have been complaining
  about getting the wrong board shape (chamfered corners rather than
  rounded corners) on DXF Import, now they shouldn't complain.
2016-03-21 10:22:04 -04:00
Carl Poirier fef0759155 Eeschema: fix minor issue creating extra whitespace in .lib. 2016-03-21 10:18:28 -04:00
Jon Neal 16dbe11868 Change misspelled dxf conversion constant from member variable to static const like other conversion constants. 2016-03-21 10:15:56 -04:00
Chris Pavlina 68725bc20c pcbnew: don't pick up selection after unsuccessful Duplicate
Following rev 6627 (git 2777182), if a non-duplicatable item was the object of
a Duplicate action, the original item would be picked up, potentially
misleading the user into thinking something was actually duplicated.
2016-03-21 10:11:56 -04:00
dwilches 963b4d5ed6 Fix Preferred Editor dialog (lp: 1558353)
The functions involved in the problem were PGM_BASE::GetEditorName and
EDA_BASE_FRAME::OnSelectPreferredEditor:

1) OnSelectPreferredEditor showed a dialog to allow the user selecting the
editor, but before that called GetEditorName to get the name of the current
editor (to show as a default in the choose file dialog).

2) The problem was when there was no editor, GetEditorName showed its own
dialog.

3) So the user was seeing first the dialog from (2) and then the dialog from
(1).

4) As GetEditorName is used in many other places the solution I did was to add
to it an optional parameter that tells it what to do if no editor is set. To
avoid modifying other code that relies on the current behaviour, this parameter
has a default value that causes to show the dialog. But now when
OnSelectPreferredEditor calls it, it passes the parameter that causes it to
return an empty string if no editor was set.

5) Also, I found a second bug while doing it which allowed in the first dialog
to select an unexistent file (the dialog was missing the wxFD_FILE_MUST_EXIST
flag).

6) Lastly, to avoid having duplicated code (the one that showed the same dialog
and that configured the wildcard was in two methods) I created a single
function that now both functions call: PGM_BASE::AskUserForPreferredEditor.
This way we also will have consistency in the behaviour of both dialogs and
there is a single place where it needs to be modified.
2016-03-18 08:11:19 -04:00
jean-pierre charras 6657981553 Pcbnew: loading file with footprint on an inner layer causes an assertion. (fixes lp:1556424) 2016-03-14 09:20:51 -04:00
Eldar Khayrullin 286f6a426b Pcbnew: fix exception when importing pcad pcb with zero size pads (fixes lp: 1551353)
* Zero size pads are now just ignored.
2016-03-14 09:13:53 -04:00
jean-pierre charras cc058033cc Fix incorrect (too small) bounding box EDA_TEXT, noticeable when chars like j or { are used in zone fill functions.
I tried to merge some constants used both in legacy mode and gal mode (which were, before this patch, separate constants).
There is still a serious work to avoid different calculation code for the same text in draw and plot functions.
Work in progress to merge these calculation functions.
2016-03-11 16:30:32 -05:00
jean-pierre charras 18f07d8efb Pcbnew: create array dialog fixes. (fixes lp:1549231)
* No initial copied object changed (this was a serious bug to modify these
  objects. Previous version modified references and other texts using a
  broken algorithm).
* Only new pads are numbered (therefore renumbering is used only in footprint
  editor)
* Remove not working feature in circular array: now only use number for
  pads (other options using alphabetical letters are removed: did not work
  correctly).
* A more clear option is used to choose if the pads are numbered from a chosen
  value or from the first available value.
* Adding a warning message if a parameter is incorrect.
2016-03-09 09:15:42 -05:00
jean-pierre charras 6d3e1b9391 Fix environment variable initialization issue on Linux. (fixes lp:1550620)
* Linux environment variables are not initialized properly if the value
  contains any non ASCII7 characters and if the locale is not set.  Set
  the locale before reading the environment variable configuration.
2016-03-01 08:53:19 -05:00
Tomasz Wlostowski 79fe4a0acb More accurate pushout force calculation for circle-segment collisions. (fixes lp:1551579) 2016-03-01 08:44:02 -05:00
Wayne Stambaugh 5c4fbbec43 Pcbnew: prevent delete hot key from deleting locked footprints. (fixes lp:1538805) 2016-02-29 18:44:09 -05:00
Eldar Khayrullin 7d0299f153 Pcbnew: fix issues in PCAD import of P-CAD ASCII files. (fixes lp:1547822) 2016-02-24 13:03:56 -05:00
jean-pierre charras e9570fddd6 Remove CK1202_V1.pcb sample file, actually not used in Kicad, due to its unclear copyright. The http link to this sample file is in files.txt. 2016-02-23 10:38:51 -05:00
jean-pierre charras 34217c0199 Pcbnew: fix a crash when trying to export a footprint in a non writable directory, or if a non writable old file was existing. (Linux only. On Windows, the wxWidgets file dialog dectects this issue) 2016-02-23 09:16:50 -05:00
Nick Winters ab0e3d0ce2 OSX: fix bug caused by wxBitmap drawing 0 width or heigth bitmap. (fixes lp:1529159) 2016-02-23 09:05:52 -05:00
Wayne Stambaugh c8b2971d1c Fix bug in component library editor. (fixes lp:1547299)
* Use temporary storage of new pins to prevent corruption of the library part draw items
  list when adding alternater body style pins to existing component which caused segfault.
2016-02-19 17:13:32 -05:00
jean-pierre charras 9b0bd7ca1f Pcbnew: minor bug fixes.
* Use case insensitive comparison to choose import plugin from the file extension.  The
  file extension is not always lower case especially on Windows.
* onleftclick.cpp: fix false warning message in the legacy canvas which happens afte
   switching from the GAL canvas when a board item is still selected.
2016-02-19 09:52:18 -05:00
jean-pierre charras fd009f924a Eeschema: fix bug where global bus labels were being ignored. (fixes lp:1545708) 2016-02-18 11:35:56 -05:00
Dick Hollenbeck 48e2addd69 Pcbnew: fix bug opening P-CAD ASCII files. (fixes lp:1545668) 2016-02-18 11:33:11 -05:00
Bernhard Stegmaier a773ecc735 Disable FPS limiter for OSX (GAL). 2016-02-18 11:29:12 -05:00
jean-pierre charras dcd81e23f4 Fix incorrect assertion failure in specctra export when a footprint contains segments on edge.cut layer (fixes lp:1545546) 2016-02-18 11:06:40 -05:00
Rohan Agrawal bff0068065 Merge lp:~rohbotics/kicad/bug_1424003 into lp:kicad 2016-02-13 15:23:08 -05:00
unknown d0932944fc Fix long text values truncated in position file and serious cleanup of gen_modules_placefile.cpp code. (fixes lp:1412628) 2016-02-13 15:20:59 -05:00
Tomasz Wlostowski 5c3a56bdcc Fixed segfault in selection tool. (fixes lp:1542856) 2016-02-13 15:15:15 -05:00
jean-pierre charras e9bfcc28c3 Fix HPGL plot divide by zero bug. 2016-02-11 19:12:06 -05:00
Maciej Suminski 3cdac44ac2 GAL::DrawPolygon() and GAL::DrawPolyline() variants that work with VECTOR2D array. 2016-02-11 19:05:24 -05:00
jean-pierre charras 2cebaa2d79 3D Viewer: fix no solder mask unless there is something on the layer. (fixes lp:542935) 2016-02-10 20:47:34 -05:00
jean-pierre charras 609b996abe Pcbnew: zone keepout incorrectly created if previously a corner-smoothed copper zone was created. (fixes lp:1540967) 2016-02-10 20:21:26 -05:00
Simon Richter ea0c187e09 Executable icon resource build configuration fixes.
* The resource setting for bitmap2component is too late in the CMakeLists.txt,
  and is being ignored. Bitmap2component does not have an icon resource on
  Windows. Moving the entire section resolves the issue.
* The other programs only have the mingw special case listed, not the generic
  declaration for the resource file so added them.
2016-02-10 20:14:35 -05:00
jean-pierre charras bf6cd8445a Page layout editor: custom text size not saved when X or Y size value is not default. (fixes lp:1538603) 2016-02-10 20:12:16 -05:00
Chris Pavlina c50763bd5b libedit: fix iterator off end of vector (fixes lp:1537946) 2016-02-09 19:04:36 -05:00
Andrew Zonenberg 1aa6932b12 Pcbnew DRC: allow technical->copper pad overlap
* This permits things like mask "pads" over copper pads for custom mask openings.
2016-02-09 18:59:56 -05:00
Maciej Suminski 342ec2be0e Highlight a net when crossprobing with eeschema and highlight net tool is enabled. 2016-02-09 18:57:46 -05:00
Martin d'Allens d451800d0a Eeschema: Set modified flag after "Append Schematic Sheet" 2016-02-09 18:56:10 -05:00
jean-pierre charras 48435c5cb3 Fix bug in "User Custom" size selection in"Page Settings" in non English languages. (fixes lp:1536427) 2016-02-09 18:41:47 -05:00
Maciej Suminski 8999ae9fb2 Make DRC markers not editable with the standard tools (GAL). 2016-02-09 18:38:26 -05:00
Maciej Suminski 8184ba1cf3 Draw arrows for DRC markers (GAL). 2016-02-09 18:36:43 -05:00
Simon Wells 228ed4ea41 GAL: Update grid color when changed by user 2016-02-09 18:34:16 -05:00
Chris Pavlina 3031a3f5cf Pcbnew: fix Flip hotkey for blocks in legacy (fixes lp:1534120) 2016-02-09 18:31:39 -05:00
Tomasz Wlostowski 42aa93e34b GAL: apply grid offset when board is loaded and respect grid color setting. (fixes lp:1533168) 2016-02-09 18:27:13 -05:00
Tomasz Wlostowski eb8b407717 Router: check layers of all traversed joints in FindLinesBetweenJoints(). (fixes lp:1531762) 2016-02-08 21:28:22 -05:00
Johannes Agricola eaea15fbef Properly set keepout flag for new zones in GAL 2016-02-08 21:26:03 -05:00
Maciej Suminski 72a69f9428 pcbnew asks before rotating/flipping a locked item (GAL). 2016-02-08 20:06:22 -05:00
Simon Wells c66656c5d4 Open PDF viewer improvements. (fixes lp:1530162)
* Fix broken ExecuteCommand() when path contains spaces on OSX.
* Only use system defined mime type for PDF files.
* Remove system dependent fallback applications for opening PDF files.
2016-02-08 20:03:57 -05:00
Element Green 14363262c2 Pcbnew: fix VRML export dialog settings having no effect. (fixes lp:1529214) 2016-02-08 19:58:21 -05:00
Jean-Pierre Charras 509e71fdb3 Pcbnew: fix bug when flipping a block that dosesn't flip inner layers nor their connected microvias. (fixes lp:1527446) 2016-02-08 19:16:07 -05:00
Jean-Pierre Charras 6c5e2f3900 Pcbnew: avoid crash if something is wrong when opening the Python Console (for instance missing python module). 2016-02-07 19:38:08 -05:00
Chris Pavlina f46272bed9 Pcbnew: fix zone tool bug when minimum width is compared against thermal relief spoke when Pad connection set to none. (fixes lp 1526158) 2016-02-07 19:35:43 -05:00
Jean-Pierre Charras 2f7b3ab56e Eeschema: fix segfault when loading malformed libraries. (fixes lp:1527804) 2015-12-20 16:46:33 -05:00
Maciej Suminski b526227529 Fixed crash on undo pad placement in the footprint editor using GAL canvases. (fixes lp:1525552) 2015-12-15 10:22:49 -05:00
Maciej Suminski e93c815e02 Fixed ratsnest for PCBs imported using plugins (GAL). 2015-12-15 10:16:15 -05:00
Mark Roszko 5c8f7c7a3a Use defined environment variables before falling back to DEFAULT_INSTALL_PATH. 2015-12-09 09:46:56 -05:00
Jean-Pierre Charras 7fb6698e29 Kicad manager: fix a potential bug which could crash Kicad manager. 2015-12-07 09:55:59 -05:00
Jean-Pierre Charras f11b426151 Better sizing of wx_html_report_panel in dialog_netlist (fix bug #1522758) 2015-12-06 18:24:32 -05:00
Maciej Suminski 827dad3197 GAL bug fixes cherry picked from product branch. 2015-12-06 18:22:13 -05:00
Wayne Stambaugh 593c974063 One last update before 4.0.0 stable release. 2015-11-29 14:53:12 -05:00
Wayne Stambaugh a68b3cb486 Merge with tip of product branch for 4.0.0 stable release. 2015-11-29 14:06:50 -05:00
Wayne Stambaugh ce81524b83 Merge with tip of product branch r6303, 4.0.0-rc1. 2015-11-08 16:22:19 -05:00
368 changed files with 11751 additions and 75341 deletions
+55
View File
@@ -0,0 +1,55 @@
boost_root
.downloads-by-cmake
Build*
build*
common/netlist_keywords.*
common/netlist_lexer.h
common/pcb_plot_params_lexer.h
common/page_layout/page_layout_reader_keywords.cpp
common/lib_table_keywords.*
common/gal/opengl/shader_src.h
include/lib_table_lexer.h
include/netlist_lexer.h
include/page_layout_reader_lexer.h
eeschema/cmp_library_lexer.h
eeschema/cmp_library_keywords.*
eeschema/dialogs/dialog_bom_cfg_keywords.cpp
eeschema/dialogs/dialog_bom_cfg_lexer.h
eeschema/dialogs/dialog_bom_help_html.h
eeschema/template_fieldnames_keywords.*
eeschema/template_fieldnames_lexer.h
pcbnew/dialogs/dialog_freeroute_exchange_help_html.h
pcbnew/pcb_plot_params_keywords.cpp
pcbnew/pcb_plot_params_lexer.h
pcb_calculator/attenuators/bridget_tee_formula.h
pcb_calculator/attenuators/pi_formula.h
pcb_calculator/attenuators/splitter_formula.h
pcb_calculator/attenuators/tee_formula.h
Makefile
CMakeCache.txt
auto_renamed_to_cpp
Testing
version.h
config.h
install_manifest.txt
Documentation/doxygen
Documentation/development/doxygen
*.bak
*.pyc
.*.swp
*~
common/pcb_plot_params_keywords.cpp
include/pcb_plot_params_lexer.h
pcbnew/specctra_keywords.cpp
pcbnew/specctra_lexer.h
pcb_calculator/pcb_calculator_datafile_keywords.cpp
pcb_calculator/pcb_calculator_datafile_lexer.h
new/html
new/sch_lib_table_keywords.cpp
new/sch_lib_table_lexer.h
new/sweet_keywords.cpp
new/sweet_lexer.h
bitmaps_png/png*
bitmaps_png/tmp
common/pcb_keywords.cpp
include/pcb_lexer.h
+29 -20
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -53,6 +53,9 @@
#include <textures/text_pcb.h>
static const double DELTA_MOVE_STEP = 0.7;
/*
* EDA_3D_CANVAS implementation
*/
@@ -86,7 +89,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
m_init = false;
m_reportWarnings = true;
m_shadow_init = false;
// set an invalide value to not yet initialized indexes managing
// set an invalid value to not yet initialized indexes managing
// textures created to enhance 3D rendering
m_text_pcb = m_text_silk = INVALID_INDEX;
m_text_fake_shadow_front = INVALID_INDEX;
@@ -144,8 +147,7 @@ void EDA_3D_CANVAS::ClearLists( int aGlList )
m_glLists[ii] = 0;
}
// When m_text_fake_shadow_??? is set to INVALID_INDEX, textures are no yet
// created.
// When m_text_fake_shadow_??? is set to INVALID_INDEX, textures are not yet created.
if( m_text_fake_shadow_front != INVALID_INDEX )
glDeleteTextures( 1, &m_text_fake_shadow_front );
@@ -169,7 +171,7 @@ void EDA_3D_CANVAS::OnChar( wxKeyEvent& event )
void EDA_3D_CANVAS::SetView3D( int keycode )
{
int ii;
double delta_move = 0.7 * GetPrm3DVisu().m_Zoom;
double delta_move = DELTA_MOVE_STEP * GetPrm3DVisu().m_Zoom;
switch( keycode )
{
@@ -284,19 +286,27 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
{
if( event.ShiftDown() )
double delta = DELTA_MOVE_STEP * GetPrm3DVisu().m_Zoom;
if ( GetPrm3DVisu().GetFlag( FL_MOUSEWHEEL_PANNING ) )
delta *= 0.05 * event.GetWheelRotation();
else
if ( event.GetWheelRotation() < 0 )
delta = -delta;
if( GetPrm3DVisu().GetFlag( FL_MOUSEWHEEL_PANNING ) )
{
if( event.GetWheelRotation() < 0 )
SetView3D( WXK_UP ); // move up
if( event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL )
m_draw3dOffset.x -= delta;
else
SetView3D( WXK_DOWN ); // move down
m_draw3dOffset.y -= delta;
}
else if( event.ShiftDown() )
{
m_draw3dOffset.y -= delta;
}
else if( event.ControlDown() )
{
if( event.GetWheelRotation() > 0 )
SetView3D( WXK_RIGHT ); // move right
else
SetView3D( WXK_LEFT ); // move left
m_draw3dOffset.x += delta;
}
else
{
@@ -310,10 +320,10 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
else
GetPrm3DVisu().m_Zoom *= 1.4;
DisplayStatus();
Refresh( false );
}
DisplayStatus();
Refresh( false );
GetPrm3DVisu().m_Beginx = event.GetX();
GetPrm3DVisu().m_Beginy = event.GetY();
}
@@ -327,7 +337,9 @@ void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event )
GetPrm3DVisu().m_Zoom /= magnification;
if( GetPrm3DVisu().m_Zoom <= 0.01 )
{
GetPrm3DVisu().m_Zoom = 0.01;
}
DisplayStatus();
Refresh( false );
@@ -376,8 +388,6 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
}
/* Construct and display a popup menu when the right button is clicked.
*/
void EDA_3D_CANVAS::OnRightClick( wxMouseEvent& event )
{
wxPoint pos;
@@ -563,7 +573,7 @@ GLuint load_and_generate_texture( tsImage *image )
return texture;
}
/* Initialize broad parameters for OpenGL */
void EDA_3D_CANVAS::InitGL()
{
if( !m_init )
@@ -579,7 +589,7 @@ void EDA_3D_CANVAS::InitGL()
m_ZTop = 10.0;
glDisable( GL_CULL_FACE ); // show back faces
glEnable( GL_DEPTH_TEST ); // Enable z-buferring
glEnable( GL_DEPTH_TEST ); // Enable z-buffering
glEnable( GL_ALPHA_TEST );
glEnable( GL_LINE_SMOOTH );
// glEnable(GL_POLYGON_SMOOTH); // creates issues with some graphic cards
@@ -600,7 +610,6 @@ void EDA_3D_CANVAS::InitGL()
}
/* Initialize OpenGL light sources. */
void EDA_3D_CANVAS::SetLights()
{
// activate light. the source is above the xy plane, at source_pos
+4 -1
View File
@@ -572,7 +572,10 @@ void EDA_3D_CANVAS::buildTechLayers3DView( REPORTER* aErrorMessages, REPORTER* a
// bufferPolys contains polygons to merge. Many overlaps .
// Calculate merged polygons and remove pads and vias holes
if( bufferPolys.IsEmpty() )
if( layer != B_Mask && layer != F_Mask && bufferPolys.IsEmpty() )
// if a layer has no iten to draw, skip it
// However solder mask layers are negative layers, so no item
// means only a full layer mask
continue;
// Solder mask layers are "negative" layers.
+15 -14
View File
@@ -5,7 +5,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -70,6 +70,8 @@ static const wxChar keyBoardBodyColor_Red[] = wxT( "BoardBodyColor_Red" );
static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" );
static const wxChar keyBoardBodyColor_Blue[]= wxT( "BoardBodyColor_Blue" );
static const wxChar keyMousewheelPanning[] = wxT( "MousewheelPAN3D" );
static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
static const wxChar keyRenderShadows[] = wxT( "Render_Shadows" );
static const wxChar keyRenderRemoveHoles[] = wxT( "Render_RemoveHoles" );
@@ -282,6 +284,9 @@ void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg->Read( keyBoardBodyColor_Blue, &GetPrm3DVisu().m_BoardBodyColor.m_Blue, 22.0 /255.0 );
bool tmp;
aCfg->Read( keyMousewheelPanning, &tmp, false );
prms.SetFlag( FL_MOUSEWHEEL_PANNING, tmp );
aCfg->Read( keyShowRealisticMode, &tmp, false );
prms.SetFlag( FL_USE_REALISTIC_MODE, tmp );
@@ -380,6 +385,8 @@ void EDA_3D_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg->Write( keyBoardBodyColor_Green, GetPrm3DVisu().m_BoardBodyColor.m_Green );
aCfg->Write( keyBoardBodyColor_Blue, GetPrm3DVisu().m_BoardBodyColor.m_Blue );
aCfg->Write( keyMousewheelPanning, prms.GetFlag( FL_MOUSEWHEEL_PANNING ) );
aCfg->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
aCfg->Write( keyRenderShadows, prms.GetFlag( FL_RENDER_SHADOWS ) );
@@ -565,6 +572,10 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
Set3DBoardBodyColorFromUser();
break;
case ID_MENU3D_MOUSEWHEEL_PANNING:
GetPrm3DVisu().SetFlag( FL_MOUSEWHEEL_PANNING, isChecked );
return;
case ID_MENU3D_REALISTIC_MODE:
GetPrm3DVisu().SetFlag( FL_USE_REALISTIC_MODE, isChecked );
GetMenuBar()->FindItem( ID_MENU3D_COMMENTS_ONOFF )->Enable( !isChecked );
@@ -747,8 +758,6 @@ void EDA_3D_FRAME::OnActivate( wxActivateEvent& event )
}
/* called to set the background color of the 3D scene
*/
bool EDA_3D_FRAME::Set3DColorFromUser( S3D_COLOR &aColor, const wxString& aTitle,
wxColourData* aPredefinedColors )
{
@@ -780,13 +789,12 @@ bool EDA_3D_FRAME::Set3DColorFromUser( S3D_COLOR &aColor, const wxString& aTitle
return true;
}
/* called to set the silkscreen color. Sets up a number of default colors
*/
bool EDA_3D_FRAME::Set3DSilkScreenColorFromUser()
{
wxColourData definedColors;
definedColors.SetCustomColour(0, wxColour( 241, 241, 241 ) ); // White
definedColors.SetCustomColour(0, wxColour( 241, 241, 241 ) ); // White
definedColors.SetCustomColour(1, wxColour( 180, 180, 180 ) ); // Gray
bool change = Set3DColorFromUser( GetPrm3DVisu().m_SilkScreenColor,
@@ -800,8 +808,6 @@ bool EDA_3D_FRAME::Set3DSilkScreenColorFromUser()
}
/* called to set the soldermask color. Sets up a number of default colors
*/
bool EDA_3D_FRAME::Set3DSolderMaskColorFromUser()
{
wxColourData definedColors;
@@ -824,8 +830,6 @@ bool EDA_3D_FRAME::Set3DSolderMaskColorFromUser()
}
/* called to set the copper surface color. Sets up a number of default colors
*/
bool EDA_3D_FRAME::Set3DCopperColorFromUser()
{
wxColourData definedColors;
@@ -847,8 +851,6 @@ bool EDA_3D_FRAME::Set3DCopperColorFromUser()
}
/* called to set the board body color. Sets up a number of default colors
*/
bool EDA_3D_FRAME::Set3DBoardBodyColorFromUser()
{
wxColourData definedColors;
@@ -873,8 +875,6 @@ bool EDA_3D_FRAME::Set3DBoardBodyColorFromUser()
}
/* called to set the solder paste layer color. Sets up a number of default colors
*/
bool EDA_3D_FRAME::Set3DSolderPasteColorFromUser()
{
wxColourData definedColors;
@@ -907,6 +907,7 @@ INFO3D_VISU& EDA_3D_FRAME::GetPrm3DVisu() const
return g_Parm_3D_Visu;
}
bool EDA_3D_FRAME::IsEnabled( DISPLAY3D_FLG aItem ) const
{
// return true if aItem must be displayed
+14 -3
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -135,10 +135,10 @@ void EDA_3D_FRAME::CreateMenuBar()
menuBar->Append( fileMenu, _( "&File" ) );
AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_PNG,
_( "Create Image (png format)" ),
_( "Create Image (PNG format)" ),
KiBitmap( export_xpm ) );
AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_JPEG,
_( "Create Image (jpeg format)" ),
_( "Create Image (JPEG format)" ),
KiBitmap( export_xpm ) );
fileMenu->AppendSeparator();
@@ -153,6 +153,12 @@ void EDA_3D_FRAME::CreateMenuBar()
menuBar->Append( prefsMenu, _( "&Preferences" ) );
AddMenuItem( prefsMenu, ID_MENU3D_MOUSEWHEEL_PANNING,
_( "Use Touchpad to Pan" ),
KiBitmap( tools_xpm ), wxITEM_CHECK );
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_REALISTIC_MODE,
_( "Realistic Mode" ),
KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
@@ -292,6 +298,7 @@ void EDA_3D_FRAME::CreateMenuBar()
SetMenuBarOptionsState();
}
void EDA_3D_FRAME::SetMenuBarOptionsState()
{
wxMenuBar* menuBar = GetMenuBar();
@@ -301,6 +308,9 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
wxMenuItem* item;
// Set the state of toggle menus according to the current display options
item = menuBar->FindItem( ID_MENU3D_MOUSEWHEEL_PANNING );
item->Check( GetPrm3DVisu().GetFlag( FL_MOUSEWHEEL_PANNING ) );
item = menuBar->FindItem( ID_MENU3D_REALISTIC_MODE );
item->Check( GetPrm3DVisu().IsRealisticMode() );
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
@@ -366,6 +376,7 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
item->Check( GetPrm3DVisu().GetFlag( FL_ECO ));
}
void EDA_3D_FRAME::SetToolbars()
{
}
+1
View File
@@ -51,6 +51,7 @@ enum id_3dview_frm
ID_MENU3D_COMMENTS_ONOFF,
ID_MENU3D_ECO_ONOFF,
ID_MENU3D_SHOW_BOARD_BODY,
ID_MENU3D_MOUSEWHEEL_PANNING,
ID_MENU3D_REALISTIC_MODE,
ID_MENU3D_FL_RENDER_SHADOWS,
ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES,
+1
View File
@@ -71,6 +71,7 @@ enum DISPLAY3D_FLG {
FL_GRID,
FL_USE_COPPER_THICKNESS,
FL_SHOW_BOARD_BODY,
FL_MOUSEWHEEL_PANNING,
FL_USE_REALISTIC_MODE,
FL_RENDER_SHADOWS,
FL_RENDER_SHOW_HOLES_IN_ZONES,
+27 -4
View File
@@ -1,3 +1,25 @@
#
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2007-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
#
# Default to CMAKE_BUILD_TYPE = Release unless overridden on command line
# http://www.cmake.org/pipermail/cmake/2008-September/023808.html
@@ -83,9 +105,6 @@ mark_as_advanced( KICAD_SKIP_BOOST ) # Normal builders should build Boost.
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
# This can be set to a custom name to brag about a particular branch in the "About" dialog:
set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this build came." )
# All CMake downloads go here. Suggested is up in the source tree, not in the build dir where they
# would have to be downloaded over and over again. The default is to choose a directory that is
@@ -299,7 +318,7 @@ if( KICAD_SCRIPTING_WXPYTHON )
add_definitions( -DKICAD_SCRIPTING_WXPYTHON )
endif()
if( USE_WX_GRAPHICS_CONTEXT )
if( USE_WX_GRAPHICS_CONTEXT OR APPLE )
add_definitions( -DUSE_WX_GRAPHICS_CONTEXT )
endif()
@@ -550,6 +569,10 @@ if( NOT GLEW_FOUND )
check_find_package_result( GLEW_FOUND "GLEW" )
endif()
# Find CURL library
find_package( CURL REQUIRED )
######################
# Find Cairo library #
######################
+10 -10
View File
@@ -2,7 +2,7 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
# Copyright (C) 2010-2015 Kicad Developers, see AUTHORS.txt for contributors.
# Copyright (C) 2010-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
@@ -23,9 +23,9 @@
#
macro( create_git_version_header _git_src_path )
# If bzr is not found or an error occurs using the git commands to determine the repo
# version, set the build version string to "no-git"
set( KICAD_BUILD_VERSION "no-git" )
# If an error occurs using the git commands to determine the repo
# version, set the build version string to "git-error".
set( KICAD_GIT_BUILD_VERSION "git-error" )
# Include Git support to automagically create version header file.
find_package( Git )
@@ -72,17 +72,17 @@ macro( create_git_version_header _git_src_path )
execute_process(
COMMAND
${GIT_EXECUTABLE} rev-list HEAD --count
--first-parent
${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${_git_src_path}
OUTPUT_VARIABLE _git_SERIAL
OUTPUT_VARIABLE _git_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Git hash: ${_git_LONG_HASH}")
message(STATUS "Git branch: ${_git_BRANCH}")
if( ${_git_log_result} EQUAL 0 )
string( REGEX REPLACE "^(.*\n)?revno: ([^ \n]+).*"
"\\2" Kicad_REPO_REVISION "BZR ${_git_SERIAL}, Git ${_git_SHORT_HASH}" )
"\\2" Kicad_REPO_REVISION "revision ${_git_SHORT_HASH}" )
string( REGEX REPLACE "^(.*\n)?committer: ([^\n]+).*"
"\\2" Kicad_REPO_LAST_CHANGED_AUTHOR "${_git_LAST_COMITTER}")
string( REGEX REPLACE "^(.*\n)?timestamp: [a-zA-Z]+ ([^ \n]+).*"
@@ -98,8 +98,8 @@ macro( create_git_version_header _git_src_path )
if( Kicad_REPO_LAST_CHANGED_DATE )
string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+)" "\\1-\\2-\\3"
_kicad_git_date ${Kicad_REPO_LAST_CHANGED_DATE} )
set( KICAD_BUILD_VERSION "(${_kicad_git_date} ${Kicad_REPO_REVISION})" )
set( KICAD_VERSION "(${_kicad_git_date} ${Kicad_REPO_REVISION})" )
set( KICAD_BRANCH_NAME ${_git_BRANCH} )
endif()
set( KICAD_BUILD_VERSION ${KICAD_BUILD_VERSION} )
endmacro()
+37
View File
@@ -0,0 +1,37 @@
#
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2016 Wayne Stambaugh <stambaughw@verizon.net>
# Copyright (C) 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
#
# Note: unless you are the person responsible for creating releases,
# do *not* change these variables. This way the KiCad project
# can maintain control over what is an official KiCad build and
# what is not. Setting these variable that conflict with KiCad
# releases is a shooting offense.
#
# This file gets included in the WriteVersionHeader.cmake file to set
# the KiCad version when the source is provided in an archive file.
# When KiCad is cloned using git, the git version is used. The only
# time this should be set to a value other than "no-vcs-found" is when
# a source archive is created. This eliminates the need to set
# KICAD_VERSION during the build configuration step.
set( KICAD_VERSION "4.0.7" )
+41 -40
View File
@@ -2,7 +2,7 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
# Copyright (C) 2015 KiCad Developers, see AUTHORS.txt for contributors.
# Copyright (C) 2015-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
@@ -22,49 +22,35 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
# Automagically create version header file if the version string was not defined during
# the build configuration. If CreateBzrVersionHeader or CreateGitVersionHeader cannot
# determine the current repo version, a version.h file is still created with
# KICAD_BUILD_VERSION set to "no-vcs-found".
if( NOT KICAD_BUILD_VERSION )
set( _wvh_version_str "no-vcs-found" )
# Automagically create version header file if the version string was
# not defined during the build configuration. If
# CreateGitVersionHeader cannot determine the current repo version, a
# version.h file is still created with KICAD_VERSION set to "no-vcs-found".
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
# Detect the appropiate VCS and set the version string.
if( EXISTS "${SRC_PATH}/.bzr" )
message( STATUS "Using Bazaar to determine build version string." )
include( ${CMAKE_MODULE_PATH}/CreateBzrVersionHeader.cmake )
create_bzr_version_header( ${SRC_PATH} )
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
elseif( EXISTS "${SRC_PATH}/.git" )
message( STATUS "Using Git to determine build version string." )
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
create_git_version_header( ${SRC_PATH} )
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
endif()
else()
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
# Attempt to detect if we have a git repo and set the version string if
# the version wasn't set to something other than the default value in
# KiCadVersion.cmake.
if( KICAD_VERSION STREQUAL "no-vcs-found" AND EXISTS "${SRC_PATH}/.git" )
message( STATUS "Using Git to determine build version string." )
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
create_git_version_header( ${SRC_PATH} )
endif()
set( _wvh_write_version_file ON )
# $KICAD_VERSION_FULL will always be set to something. Even if it is "no-vcs-found".
set( KICAD_VERSION_FULL "${KICAD_VERSION}" )
# Compare the version argument against the version in the existing header file for a mismatch.
if( EXISTS ${OUTPUT_FILE} )
file( STRINGS ${OUTPUT_FILE} _current_version_str
REGEX "^#define[\t ]+KICAD_BUILD_VERSION[\t ]+.*" )
string( REGEX REPLACE "^#define KICAD_BUILD_VERSION \"([()a-zA-Z0-9 -.]+)\".*"
"\\1" _wvh_last_version "${_current_version_str}" )
# No change, do not write version.h
if( _wvh_version_str STREQUAL _wvh_last_version )
message( STATUS "Not updating ${OUTPUT_FILE}" )
set( _wvh_write_version_file OFF )
endif()
# Optional branch name detected by git or configuration defined option.
if( KICAD_BRANCH_NAME )
set( KICAD_VERSION_FULL "${KICAD_VERSION_FULL}-${KICAD_BRANCH_NAME}" )
endif()
if( _wvh_write_version_file )
message( STATUS "Writing ${OUTPUT_FILE} file with version: ${_wvh_version_str}" )
# Optional user version information defined at configuration.
if( KICAD_VERSION_EXTRA )
set( KICAD_VERSION_FULL "${KICAD_VERSION_FULL}-${KICAD_VERSION_EXTRA}" )
endif()
file( WRITE ${OUTPUT_FILE}
set( _wvh_new_version_text
"/* Do not modify this file, it was automatically generated by CMake. */
/*
@@ -73,11 +59,26 @@ if( _wvh_write_version_file )
#ifndef __KICAD_VERSION_H__
#define __KICAD_VERSION_H__
#define KICAD_BUILD_VERSION \"${_wvh_version_str}\"
#define KICAD_VERSION_FULL \"${KICAD_VERSION_FULL}\"
#endif /* __KICAD_VERSION_H__ */
"
)
" )
set( _wvh_write_version_file ON )
# Only write the header if it has changed, to avoid rebuilds
if( EXISTS ${OUTPUT_FILE} )
file( READ ${OUTPUT_FILE} _wvh_old_version_text )
if( _wvh_old_version_text STREQUAL _wvh_new_version_text )
message( STATUS "Not updating ${OUTPUT_FILE}" )
set( _wvh_write_version_file OFF )
endif()
endif()
if( _wvh_write_version_file )
message( STATUS "Writing ${OUTPUT_FILE} file with version: ${KICAD_VERSION_FULL}" )
file( WRITE ${OUTPUT_FILE} ${_wvh_new_version_text} )
endif()
-3
View File
@@ -77,7 +77,4 @@
#define KIFACE_SUFFIX wxT( "@KIFACE_SUFFIX@" )
#define KIFACE_PREFIX wxT( "@KIFACE_PREFIX@" )
/// Name of repo from which this build came.
#define KICAD_REPO_NAME "@KICAD_REPO_NAME@"
#endif // CONFIG_H_
-65
View File
@@ -1,65 +0,0 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
# Copyright (C) 2013 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
# Download av_http and install into ${PREFIX}, typically in our KiCad source tree.
# Assumes include( ExternalProject ) was done inline previous to this file
# and that set( DOWNLOAD_DIR ... ) was set in a higher context.
#-----<configure>-------------------------------------------------------------------------------------
# soon cmake will have https support, switch to a true download then:
#set( AVHTTP_RELEASE ??? )
#set( AVHTTP_MD5 ???? ) # re-calc this on every RELEASE change
#-----</configure>-----------------------------------------------------------------------------------
# Where the library is to be installed.
set( PREFIX ${DOWNLOAD_DIR}/avhttp )
if( KICAD_SKIP_BOOST )
set( AVHTTP_DEPEND "" )
else()
set( AVHTTP_DEPEND "boost" )
endif()
# Install the AVHTTP header only library ${PREFIX}
ExternalProject_Add( avhttp
PREFIX ${PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_DIR} # no true download yet
# grab it from a local zip file for now, cmake caller's source dir
URL ${CMAKE_CURRENT_SOURCE_DIR}/avhttp-master.zip
DEPENDS ${AVHTTP_DEPEND}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR> <INSTALL_DIR>
)
set( AVHTTP_INCLUDE_DIR "${PREFIX}/include" CACHE FILEPATH "AVHTTP include directory" )
mark_as_advanced( AVHTTP_INCLUDE_DIR )
+29 -14
View File
@@ -78,14 +78,6 @@ specific patches required to build a working Boost library. These patches can b
[patches folder][] in the KiCad source. These patches are named by the platform name they should
be applied against.
## OpenSSL Secure Socket Layer Library ## {#openssl}
The [OpenSSL][] library is only required when the KiCad build is configured with the Github plugin
enabled. See the [KiCad Build Configuration Options](#build_opts)` section for more information.
Please note that KiCad will download and build version 1.0.1e of OpenSSL by default. You should
probably use the version of OpenSSL installed on your system as it will most likely be more up to
date and contain the latest security fixes.
## GLEW OpenGL Extension Wrangler Library ## {#glew}
The [OpenGL Extension Wrangler][GLEW] is an OpenGL helper library used by the KiCad graphics
@@ -151,6 +143,11 @@ supplied by KiCad. This option is disabled by default.
The KICAD_SCRIPTING_WXPYTHON option is used to enable building the wxPython interface into
Pcbnew including the wxPython console. This option is disabled by default.
## Github Plugin ## {#github_opt}
The BUILD_GITHUB_PLUGIN option is used to control if the Github plugin is built. This option is
enabled by default.
## Build with Static Libraries ## {#static_lib_opt}
The KICAD_BUILD_STATIC option is used to build KiCad with static libraries. This option is
@@ -175,10 +172,30 @@ The USE_OSX_DEPS_BUILDER option forces the build configuration to download and b
required dependencies to build KiCad on OSX. This option is not longer maintained and most
likely is broken. Use it at your own peril.
## Github Plugin ## {#github_opt}
## Setting the Build Version and Repository Name ## {#build_version_opt}
The BUILD_GITHUB_PLUGIN option is used to control if the Github plugin is built. This option is
enabled by default.
The KiCad version string is defined by the three CMake variables KICAD_VERSION, KICAD_BRANCH_NAME,
and KICAD_VERSION_EXTRA. Variables KICAD_BRANCH_NAME and KICAD_VERSION_EXTRA are defined as empty
strings and can be set at configuration. Unless the source branch is a stable release archive,
KICAD_VERSION is set to "no-vcs-found". If an optional variable is not define, it is not appended
to the full version string. If an optional variable is defined it is appended along with a leading
'-' to the full version string as follows:
KICAD_VERSION[-KICAD_BRANCH_NAME][-KICAD_VERSION_EXTRA]
When the version string is set to "no-vcs-found", the build script automatically creates the
version string information from the [git][] repository information as follows:
(2016-08-26 revision 67230ac)-master
| | |
| | branch name, "HEAD" if not on a branch,
| | or "unknown" if no .git present
| |
| abbreviated commit hash, or no-git if no .git
| present
|
date of commit, or date of build if no .git present
# Getting the KiCad Source Code ## {#getting_src}
@@ -274,7 +291,7 @@ the following commands:
mingw-w64-x86_64-boost \
mingw-w64-x86_64-cairo \
mingw-w64-x86_64-glew \
mingw-w64-x86_64-openssl \
mingw-w64-x86_64-curl \
mingw-w64-x86_64-wxPython \
mingw-w64-x86_64-wxWidgets
cd kicad-source
@@ -286,7 +303,6 @@ the following commands:
-DCMAKE_PREFIX_PATH=/mingw64 \
-DCMAKE_INSTALL_PREFIX=/mingw64 \
-DDEFAULT_INSTALL_PATH=/mingw64 \
-DOPENSSL_ROOT_DIR=/mingw64 \
-DKICAD_SKIP_BOOST=ON \
-DKICAD_SCRIPTING=ON \
-DKICAD_SCRIPTING_MODULES=ON \
@@ -383,7 +399,6 @@ Boost patches in the KiCad source [patch folder][].
[wxWidgets]: http://wxwidgets.org/
[patches folder]: http://bazaar.launchpad.net/~kicad-product-committers/kicad/product/files/head:/patches/
[Boost]: http://www.boost.org/
[OpenSSL]: https://www.openssl.org/
[GLEW]: http://glew.sourceforge.net/
[GLUT]: https://www.opengl.org/resources/libraries/glut/
[Cairo]: http://cairographics.org/
+7 -8
View File
@@ -21,6 +21,13 @@ set_source_files_properties( bitmap2cmp_gui.cpp PROPERTIES
COMPILE_DEFINITIONS "COMPILING_DLL"
)
if( MINGW )
# BITMAP2COMPONENT_RESOURCES variable is set by the macro.
mingw_resource_compiler( bitmap2component )
else()
set( BITMAP2COMPONENT_RESOURCES bitmap2component.rc )
endif()
if( APPLE )
# setup bundle
set( BITMAP2COMPONENT_RESOURCES bitmap2component.icns )
@@ -81,11 +88,3 @@ if( false ) # linker map with cross reference
LINK_FLAGS "${TO_LINKER},-cref ${TO_LINKER},-Map=bitmap2component.map"
)
endif()
if( MINGW )
# BITMAP2COMPONENT_RESOURCES variable is set by the macro.
mingw_resource_compiler( bitmap2component )
else()
set( BITMAP2COMPONENT_RESOURCES bitmap2component.rc )
endif()
+24 -5
View File
@@ -4,12 +4,19 @@ include_directories(
./dialog_about
${CAIRO_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${CURL_INCLUDE_DIRS}
../3d-viewer
../pcbnew
../polygon
${INC_AFTER}
)
if( NOT APPLE ) # windows and linux use openssl under curl
find_package( OpenSSL REQUIRED )
endif()
# Generate header files containing shader programs
# Order of input files is significant
add_custom_command(
@@ -115,15 +122,20 @@ install( TARGETS lib_kicad
endif()
# KiCad build version string defaults to undefined which forces the build version header
# command to look for Bazaar to create the version string header.
set( KICAD_BUILD_VERSION "" CACHE STRING "Version string defined at configuration time." )
# KiCad build version string defaults to "no-vcs-found" which forces the build version header
# command to look for git to create the version string header when the .git path is found in
# the source path.
set( KICAD_BRANCH_NAME "" CACHE STRING "KiCad repository name." )
set( KICAD_VERSION_EXTRA "" CACHE STRING
"User defined configuration string to append to KiCad version." )
# Generate version header file.
add_custom_target(
version_header ALL
COMMAND ${CMAKE_COMMAND}
-DKICAD_BUILD_VERSION=${KICAD_BUILD_VERSION}
-DKICAD_VERSION=${KICAD_VERSION}
-DKICAD_BRANCH_NAME=${KICAD_BRANCH_NAME}
-DKICAD_VERSION_EXTRA=${KICAD_VERSION_EXTRA}
-DOUTPUT_FILE=${CMAKE_BINARY_DIR}/kicad_build_version.h
-DSRC_PATH=${PROJECT_SOURCE_DIR}
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
@@ -252,6 +264,9 @@ endif()
set( COMMON_SRCS
${COMMON_SRCS}
kicad_curl/kicad_curl.cpp
kicad_curl/kicad_curl_easy.cpp
view/view.cpp
view/view_item.cpp
view/view_group.cpp
@@ -277,7 +292,11 @@ set( COMMON_SRCS
add_library( common STATIC ${COMMON_SRCS} )
add_dependencies( common lib-dependencies )
add_dependencies( common version_header )
target_link_libraries( common ${Boost_LIBRARIES} )
target_link_libraries( common
${Boost_LIBRARIES}
${CURL_LIBRARIES}
${OPENSSL_LIBRARIES} # empty on Apple
)
set( PCB_COMMON_SRCS
+38 -18
View File
@@ -27,6 +27,14 @@
* @file basicframe.cpp
* @brief EDA_BASE_FRAME class implementation.
*/
#include <config.h>
// kicad_curl.h must be included before wx headers, to avoid
// conflicts for some defines, at least on Windows
#ifdef BUILD_GITHUB_PLUGIN
#include <curl/curlver.h>
#include <kicad_curl/kicad_curl.h>
#endif
#include <wx/aboutdlg.h>
#include <wx/fontdlg.h>
@@ -49,6 +57,7 @@
#include <boost/version.hpp>
#include <typeinfo>
#include <wx/display.h>
/// The default auto save interval is 10 minutes.
#define DEFAULT_AUTO_SAVE_INTERVAL 600
@@ -253,6 +262,20 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg->Read( text, &m_autoSaveInterval, DEFAULT_AUTO_SAVE_INTERVAL );
}
// Ensure the window is on a connected display, and is visible.
// (at least a corner of the frame must be visible on screen)
// Sometimes, if a window was moved on an auxiliary display, and when this
// display is no more available, it is not the case.
wxRect rect( m_FramePos, m_FrameSize );
if( wxDisplay::GetFromPoint( rect.GetTopLeft() ) == wxNOT_FOUND &&
wxDisplay::GetFromPoint( rect.GetTopRight() ) == wxNOT_FOUND &&
wxDisplay::GetFromPoint( rect.GetBottomLeft() ) == wxNOT_FOUND &&
wxDisplay::GetFromPoint( rect.GetBottomRight() ) == wxNOT_FOUND )
{
m_FramePos = wxDefaultPosition;
}
// Ensure Window title bar is visible
#if defined( __WXMAC__ )
// for macOSX, the window must be below system (macOSX) toolbar
@@ -455,26 +478,18 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event )
{
wxFileName fn = Pgm().GetEditorName();
wxString wildcard( wxT( "*" ) );
// Ask for the current editor and instruct GetEditorName() to not show
// unless we pass false as argument.
wxString editorname = Pgm().GetEditorName( false );
#ifdef __WINDOWS__
wildcard += wxT( ".exe" );
#endif
// Ask the user to select a new editor, but suggest the current one as the default.
editorname = Pgm().AskUserForPreferredEditor( editorname );
wildcard.Printf( _( "Executable file (%s)|%s" ),
GetChars( wildcard ), GetChars( wildcard ) );
wxFileDialog dlg( this, _( "Select Preferred Editor" ), fn.GetPath(),
fn.GetFullName(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return;
wxString editor = dlg.GetPath();
Pgm().SetEditorName( editor );
// If we have a new editor name request it to be copied to m_editor_name and saved
// to the preferences file. If the user cancelled the dialog then the previous
// value will be retained.
if( !editorname.IsEmpty() )
Pgm().SetEditorName( editorname );
}
@@ -573,6 +588,11 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
<< ( BOOST_VERSION / 100 % 1000 ) << wxT( "." )
<< ( BOOST_VERSION % 100 ) << wxT( "\n" );
#ifdef BUILD_GITHUB_PLUGIN
// Shows the Curl library version in use:
msg_version << "Curl version: " << KICAD_CURL::GetVersion() << "\n";
#endif
msg_version << wxT( " USE_WX_GRAPHICS_CONTEXT=" );
#ifdef USE_WX_GRAPHICS_CONTEXT
msg_version << wxT( "ON\n" );
+3 -4
View File
@@ -2,7 +2,7 @@
* 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) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2015-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
@@ -37,9 +37,8 @@
wxString GetBuildVersion()
{
wxString msg = wxString::Format(
wxT( "%s-%s" ),
wxT( KICAD_BUILD_VERSION ),
wxT( KICAD_REPO_NAME )
wxT( "%s" ),
wxT( KICAD_VERSION_FULL )
);
return msg;
+17 -18
View File
@@ -6,7 +6,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 jean-pierre.charras
* Copyright (C) 2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2011-2016 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
@@ -107,15 +107,17 @@ bool BITMAP_BASE::SaveData( FILE* aFile ) const
// Write binary data in hexadecimal form (ASCII)
wxStreamBuffer* buffer = stream.GetOutputStreamBuffer();
char* begin = (char*) buffer->GetBufferStart();
int ii;
for( ii = 0; begin <= buffer->GetBufferEnd(); begin++, ii++ )
for( int ii = 0; begin < buffer->GetBufferEnd(); begin++, ii++ )
{
if( ii >= 32 )
{
ii = 0;
if( fprintf( aFile, "\n" ) == EOF )
return false;
}
if( fprintf( aFile, "%2.2X ", *begin & 0xFF ) == EOF )
return false;
}
@@ -124,6 +126,7 @@ bool BITMAP_BASE::SaveData( FILE* aFile ) const
return true;
}
void BITMAP_BASE::SaveData( wxArrayString& aPngStrings ) const
{
if( m_image )
@@ -134,8 +137,9 @@ void BITMAP_BASE::SaveData( wxArrayString& aPngStrings ) const
// Write binary data in hexadecimal form (ASCII)
wxStreamBuffer* buffer = stream.GetOutputStreamBuffer();
char* begin = (char*) buffer->GetBufferStart();
wxString line;
for( int ii = 0; begin <= buffer->GetBufferEnd(); begin++, ii++ )
wxString line;
for( int ii = 0; begin < buffer->GetBufferEnd(); begin++, ii++ )
{
if( ii >= 32 )
{
@@ -144,7 +148,7 @@ void BITMAP_BASE::SaveData( wxArrayString& aPngStrings ) const
line.Empty();
}
line << wxString::Format( wxT("%2.2X "), *begin & 0xFF );
line << wxString::Format( wxT( "%2.2X " ), *begin & 0xFF );
}
// Add last line:
@@ -218,6 +222,11 @@ void BITMAP_BASE::DrawBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
wxPoint pos = aPos;
wxSize size = GetSize();
// This fixes a bug in OSX that should be fixed in the 3.0.3 version or later.
// See: http://trac.wxwidgets.org/ticket/16329 for more information.
if( ( size.x == 0 ) || ( size.y == 0 ) )
return;
// To draw the bitmap, pos is the upper left corner position
pos.x -= size.x / 2;
pos.y -= size.y / 2;
@@ -228,7 +237,7 @@ void BITMAP_BASE::DrawBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
aDC->GetLogicalOrigin( &logicalOriginX, &logicalOriginY );
aDC->SetUserScale( scale * GetScalingFactor(), scale * GetScalingFactor() );
aDC->SetLogicalOrigin( logicalOriginX / GetScalingFactor(),
logicalOriginY / GetScalingFactor() );
logicalOriginY / GetScalingFactor() );
aDC->DrawBitmap( *m_bitmap,
KiROUND( pos.x / GetScalingFactor() ),
KiROUND( pos.y / GetScalingFactor() ),
@@ -238,9 +247,6 @@ void BITMAP_BASE::DrawBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
}
/* Function GetSize
* returns the actual size (in user units, not in pixels) of the image
*/
wxSize BITMAP_BASE::GetSize() const
{
wxSize size;
@@ -258,12 +264,6 @@ wxSize BITMAP_BASE::GetSize() const
}
/*
* Mirror image vertically (i.e. relative to its horizontal X axis )
* or horizontally (i.e relative to its vertical Y axis)
* param aVertically = false to mirror horizontally
* or true to mirror vertically
*/
void BITMAP_BASE::Mirror( bool aVertically )
{
if( m_image )
@@ -292,10 +292,9 @@ void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
if( m_image == NULL )
return;
// These 2 lines are useful only fot plotters that cannot plot a bitmap
// These 2 lines are useful only for plotters that cannot plot a bitmap
// and plot a rectangle instead of.
aPlotter->SetColor( aDefaultColor );
aPlotter->SetCurrentLineWidth( aDefaultPensize );
aPlotter->PlotImage( *m_image, aPos, GetScalingFactor() );
}
-30
View File
@@ -89,36 +89,6 @@ const PAGE_INFO PAGE_INFO::pageUSLedger( wxSize( 17000, 11000 ), wxT( "USLedge
int PAGE_INFO::s_user_width = 17000;
int PAGE_INFO::s_user_height = 11000;
/*
wxArrayString PAGE_INFO::GetStandardSizes()
{
wxArrayString ret;
static const PAGE_INFO* stdPageSizes[] = {
&pageA4,
&pageA3,
&pageA2,
&pageA1,
&pageA0,
&pageA,
&pageB,
&pageC,
&pageD,
&pageE,
// &pageGERBER, // standard?
&pageUSLetter,
&pageUSLegal,
&pageUSLedger,
&pageUser,
};
for( unsigned i=0; i < DIM( stdPageSizes ); ++i )
ret.Add( stdPageSizes[i]->GetType() );
return ret;
}
*/
inline void PAGE_INFO::updatePortrait()
{
-1
View File
@@ -515,6 +515,5 @@ void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, EDA_DRAW
void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
{
wxASSERT( !outputFile );
pageInfo = aPageSettings;
}
+33 -31
View File
@@ -23,6 +23,7 @@
*/
#include <colors.h>
#include <i18n_utility.h>
/**
@@ -32,38 +33,39 @@
* when displaying superimposed objects
* This list must have exactly NBCOLORS items
*/
const StructColors g_ColorRefs[NBCOLORS] =
{
{ 0, 0, 0, BLACK, wxT( "Black" ), DARKDARKGRAY },
{ 72, 72, 72, DARKDARKGRAY, wxT( "Gray 1" ), DARKGRAY },
{ 132, 132, 132, DARKGRAY, wxT( "Gray 2" ), LIGHTGRAY },
{ 194, 194, 194, LIGHTGRAY, wxT( "Gray 3" ), WHITE },
{ 255, 255, 255, WHITE, wxT( "White" ), WHITE },
{ 194, 255, 255, LIGHTYELLOW, wxT( "L.Yellow" ), WHITE },
{ 72, 0, 0, DARKBLUE, wxT( "Blue 1" ), BLUE },
{ 0, 72, 0, DARKGREEN, wxT( "Green 1" ), GREEN },
{ 72, 72, 0, DARKCYAN, wxT( "Cyan 1" ), CYAN },
{ 0, 0, 72, DARKRED, wxT( "Red 1" ), RED },
{ 72, 0, 72, DARKMAGENTA, wxT( "Magenta 1" ), MAGENTA },
{ 0, 72, 72, DARKBROWN, wxT( "Brown 1" ), BROWN },
{ 132, 0, 0, BLUE, wxT( "Blue 2" ), LIGHTBLUE },
{ 0, 132, 0, GREEN, wxT( "Green 2" ), LIGHTGREEN },
{ 132, 132, 0, CYAN, wxT( "Cyan 2" ), LIGHTCYAN },
{ 0, 0, 132, RED, wxT( "Red 2" ), LIGHTRED },
{ 132, 0, 132, MAGENTA, wxT( "Magenta 2" ), LIGHTMAGENTA },
{ 0, 132, 132, BROWN, wxT( "Brown 2" ), YELLOW },
{ 194, 0, 0, LIGHTBLUE, wxT( "Blue 3" ), PUREBLUE, },
{ 0, 194, 0, LIGHTGREEN, wxT( "Green 3" ), PUREGREEN },
{ 194, 194, 0, LIGHTCYAN, wxT( "Cyan 3" ), PURECYAN },
{ 0, 0, 194, LIGHTRED, wxT( "Red 3" ), PURERED },
{ 194, 0, 194, LIGHTMAGENTA, wxT( "Magenta 3" ), PUREMAGENTA },
{ 0, 194, 194, YELLOW, wxT( "Yellow 3" ), PUREYELLOW },
{ 255, 0, 0, PUREBLUE, wxT( "Blue 4" ), WHITE },
{ 0, 255, 0, PUREGREEN, wxT( "Green 4" ), WHITE },
{ 255, 255, 0, PURECYAN, wxT( "Cyan 4" ), WHITE },
{ 0, 0, 255, PURERED, wxT( "Red 4" ), WHITE },
{ 255, 0, 255, PUREMAGENTA, wxT( "Magenta 4" ), WHITE },
{ 0, 255, 255, PUREYELLOW, wxT( "Yellow 4" ), WHITE },
{ 0, 0, 0, BLACK, _HKI( "Black" ), DARKDARKGRAY },
{ 72, 72, 72, DARKDARKGRAY, _HKI( "Gray 1" ), DARKGRAY },
{ 132, 132, 132, DARKGRAY, _HKI( "Gray 2" ), LIGHTGRAY },
{ 194, 194, 194, LIGHTGRAY, _HKI( "Gray 3" ), WHITE },
{ 255, 255, 255, WHITE, _HKI( "White" ), WHITE },
{ 194, 255, 255, LIGHTYELLOW, _HKI( "L.Yellow" ), WHITE },
{ 72, 0, 0, DARKBLUE, _HKI( "Blue 1" ), BLUE },
{ 0, 72, 0, DARKGREEN, _HKI( "Green 1" ), GREEN },
{ 72, 72, 0, DARKCYAN, _HKI( "Cyan 1" ), CYAN },
{ 0, 0, 72, DARKRED, _HKI( "Red 1" ), RED },
{ 72, 0, 72, DARKMAGENTA, _HKI( "Magenta 1" ), MAGENTA },
{ 0, 72, 72, DARKBROWN, _HKI( "Brown 1" ), BROWN },
{ 132, 0, 0, BLUE, _HKI( "Blue 2" ), LIGHTBLUE },
{ 0, 132, 0, GREEN, _HKI( "Green 2" ), LIGHTGREEN },
{ 132, 132, 0, CYAN, _HKI( "Cyan 2" ), LIGHTCYAN },
{ 0, 0, 132, RED, _HKI( "Red 2" ), LIGHTRED },
{ 132, 0, 132, MAGENTA, _HKI( "Magenta 2" ), LIGHTMAGENTA },
{ 0, 132, 132, BROWN, _HKI( "Brown 2" ), YELLOW },
{ 194, 0, 0, LIGHTBLUE, _HKI( "Blue 3" ), PUREBLUE, },
{ 0, 194, 0, LIGHTGREEN, _HKI( "Green 3" ), PUREGREEN },
{ 194, 194, 0, LIGHTCYAN, _HKI( "Cyan 3" ), PURECYAN },
{ 0, 0, 194, LIGHTRED, _HKI( "Red 3" ), PURERED },
{ 194, 0, 194, LIGHTMAGENTA, _HKI( "Magenta 3" ), PUREMAGENTA },
{ 0, 194, 194, YELLOW, _HKI( "Yellow 3" ), PUREYELLOW },
{ 255, 0, 0, PUREBLUE, _HKI( "Blue 4" ), WHITE },
{ 0, 255, 0, PUREGREEN, _HKI( "Green 4" ), WHITE },
{ 255, 255, 0, PURECYAN, _HKI( "Cyan 4" ), WHITE },
{ 0, 0, 255, PURERED, _HKI( "Red 4" ), WHITE },
{ 255, 0, 255, PUREMAGENTA, _HKI( "Magenta 4" ), WHITE },
{ 0, 255, 255, PUREYELLOW, _HKI( "Yellow 4" ), WHITE },
};
@@ -72,7 +74,7 @@ EDA_COLOR_T ColorByName( const wxString& aName )
// look for a match in the palette itself
for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; trying = NextColor(trying) )
{
if( 0 == aName.CmpNoCase( g_ColorRefs[trying].m_Name ) )
if( 0 == aName.CmpNoCase( ColorGetName( trying ) ) )
return trying;
}
+30 -18
View File
@@ -44,6 +44,8 @@
#include <wx/utils.h>
#include <wx/stdpaths.h>
#include <pgm_base.h>
/**
* Global variables definitions.
@@ -58,30 +60,40 @@ EDA_UNITS_T g_UserUnit;
EDA_COLOR_T g_GhostColor;
/**
* Function to use local notation or C standard notation for floating point numbers
* some countries use 1,5 and others (and C) 1.5
* so we switch from local to C and C to local when reading or writing files
* And other problem is a bug when cross compiling under linux:
* a printf print 1,5 and the read functions expects 1.5
* (depending on version print = 1.5 and read = 1,5
* Very annoying and we detect this and use a stupid but necessary workaround
*/
bool g_DisableFloatingPointLocalNotation = false;
/* Class LOCALE_IO
* is a class that can be instantiated within a scope in which you are expecting
* exceptions to be thrown. Its constructor sets a "C" locale, to read/print files
* with fp numbers.
* Its destructor insures that the default locale is restored if an exception
* is thrown, or not.
*/
int LOCALE_IO::m_c_count = 0;
int LOCALE_IO::C_count;
void SetLocaleTo_C_standard()
LOCALE_IO::LOCALE_IO()
{
setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C
wxASSERT_MSG( m_c_count >= 0, wxT( "LOCALE_IO::m_c_count mismanaged." ) );
// use thread safe, atomic operation
if( __sync_fetch_and_add( &m_c_count, 1 ) == 0 )
{
// Store the user locale name, to restore this locale later, in dtor
m_user_locale = setlocale( LC_ALL, 0 );
// Switch the locale to C locale, to read/write files with fp numbers
setlocale( LC_ALL, "C" );
}
}
void SetLocaleTo_Default()
LOCALE_IO::~LOCALE_IO()
{
if( !g_DisableFloatingPointLocalNotation )
setlocale( LC_NUMERIC, "" ); // revert to the current locale
// use thread safe, atomic operation
if( __sync_sub_and_fetch( &m_c_count, 1 ) == 0 )
{
// revert to the user locale
setlocale( LC_ALL, m_user_locale.c_str() );
}
wxASSERT_MSG( m_c_count >= 0, wxT( "LOCALE_IO::m_c_count mismanaged." ) );
}
+4 -9
View File
@@ -49,7 +49,6 @@ static const double DXF_OBLIQUE_ANGLE = 15;
void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !outputFile );
plotOffset = aOffset;
plotScale = aScale;
@@ -277,7 +276,6 @@ bool DXF_PLOTTER::EndPlot()
*/
void DXF_PLOTTER::SetColor( EDA_COLOR_T color )
{
wxASSERT( outputFile );
if( ( color >= 0 && colorMode )
|| ( color == BLACK )
|| ( color == WHITE ) )
@@ -293,7 +291,6 @@ void DXF_PLOTTER::SetColor( EDA_COLOR_T color )
*/
void DXF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
{
wxASSERT( outputFile );
MoveTo( p1 );
LineTo( wxPoint( p1.x, p2.y ) );
LineTo( wxPoint( p2.x, p2.y ) );
@@ -427,7 +424,7 @@ void DXF_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
// Now, output the final polygon to DXF file:
last = path.PointCount() - 1;
VECTOR2I point = path.CPoint( 0 );
VECTOR2I point = path.CPoint( 0 );
wxPoint startPoint( point.x, point.y );
MoveTo( startPoint );
@@ -483,7 +480,8 @@ void DXF_PLOTTER::SetDash( bool dashed )
void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int aWidth,
EDA_DRAW_MODE_T aPlotMode )
{
segmentAsOval( aStart, aEnd, aWidth, aPlotMode );
MoveTo( aStart );
FinishTo( aEnd );
}
/* Plot an arc in DXF format
@@ -523,7 +521,6 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
wxSize size( aSize );
/* The chip is reduced to an oval tablet with size.y > size.x
@@ -545,7 +542,6 @@ void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double
void DXF_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
Circle( pos, diametre, NO_FILL );
}
@@ -624,7 +620,6 @@ void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
void DXF_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
wxASSERT( outputFile );
wxPoint coord[4]; /* coord actual corners of a trapezoidal trace */
for( int ii = 0; ii < 4; ii++ )
@@ -680,7 +675,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
if( textAsLines || containsNonAsciiChars( aText ) || aMultilineAllowed )
{
// output text as graphics.
// Perhaps miltiline texts could be handled as DXF text entity
// Perhaps multiline texts could be handled as DXF text entity
// but I do not want spend time about this (JPC)
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold, aMultilineAllowed );
+5 -6
View File
@@ -61,7 +61,6 @@ GERBER_PLOTTER::GERBER_PLOTTER()
void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !outputFile );
wxASSERT( aMirror == false );
m_plotMirror = false;
plotOffset = aOffset;
@@ -147,8 +146,12 @@ bool GERBER_PLOTTER::StartPlot()
else
fputs( "%MOMM*%\n", outputFile );
/* Specify linear interpol (G01) */
// Be sure the usual dark polarity is selected:
fputs( "%LPD*%\n", outputFile );
// Specify linear interpol (G01):
fputs( "G01*\n", outputFile );
fputs( "G04 APERTURE LIST*\n", outputFile );
/* Select the default aperture */
SetCurrentLineWidth( -1 );
@@ -314,7 +317,6 @@ void GERBER_PLOTTER::writeApertureList()
void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume )
{
wxASSERT( outputFile );
DPOINT pos_dev = userToDeviceCoordinates( aPos );
switch( plume )
@@ -430,7 +432,6 @@ void GERBER_PLOTTER:: PlotPoly( const std::vector< wxPoint >& aCornerList,
void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
wxSize size( diametre, diametre );
if( trace_mode == SKETCH )
@@ -450,7 +451,6 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_
void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
int x0, y0, x1, y1, delta;
wxSize size( aSize );
@@ -504,7 +504,6 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
double orient, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
wxSize size( aSize );
// Plot as an aperture flash
+6 -7
View File
@@ -212,7 +212,6 @@ HPGL_PLOTTER::HPGL_PLOTTER()
void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !outputFile );
plotOffset = aOffset;
plotScale = aScale;
m_IUsPerDecimil = aIusPerDecimil;
@@ -223,8 +222,6 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
paperSize.y *= 10.0 * aIusPerDecimil;
SetDefaultLineWidth( 0 ); // HPGL has pen sizes instead
m_plotMirror = aMirror;
penOverlap = 0;
penDiameter = 0;
}
@@ -388,7 +385,6 @@ void HPGL_PLOTTER::SetDash( bool dashed )
void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
int width, EDA_DRAW_MODE_T tracemode )
{
wxASSERT( outputFile );
wxPoint center;
wxSize size;
@@ -451,7 +447,6 @@ void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
int deltaxy, cx, cy;
wxSize size( aSize );
@@ -637,7 +632,6 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners,
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
wxASSERT( outputFile );
wxPoint polygone[4]; // coordinates of corners relatives to the pad
wxPoint coord[4]; // absolute coordinates of corners (coordinates in plotter space)
int move;
@@ -685,7 +679,12 @@ void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorne
}
// Calculation of dd = number of segments was traced to fill.
jj = jj / (int) ( penDiameter - penOverlap );
int delta = (int) ( penDiameter - penOverlap );
if( delta )
jj = jj / delta;
else
jj = 0;
// Trace the outline.
for( ; jj > 0; jj-- )
+6 -4
View File
@@ -7,7 +7,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 Lorenzo Marcantonio, l.marcantonio@logossrl.com
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -70,7 +70,6 @@ void PDF_PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
void PDF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !workFile );
m_plotMirror = aMirror;
plotOffset = aOffset;
plotScale = aScale;
@@ -767,7 +766,10 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
aMultilineAllowed = false; // the text has only one line.
// Emit native PDF text (if requested)
if( m_textMode != PLOTTEXTMODE_STROKE && !aMultilineAllowed )
// Currently: does not work: disable it
bool use_native = false; // = m_textMode != PLOTTEXTMODE_STROKE && !aMultilineAllowed;
if( use_native )
{
const char *fontname = aItalic ? (aBold ? "/KicadFontBI" : "/KicadFontI")
: (aBold ? "/KicadFontB" : "/KicadFont");
@@ -823,7 +825,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
}
// Plot the stroked text (if requested)
if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed )
if( !use_native )
{
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold, aMultilineAllowed );
+7 -6
View File
@@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2017 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -91,7 +91,6 @@ void PSLIKE_PLOTTER::SetColor( EDA_COLOR_T color )
void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize,
double aPadOrient, EDA_DRAW_MODE_T aTraceMode )
{
wxASSERT( outputFile );
int x0, y0, x1, y1, delta;
wxSize size( aSize );
@@ -339,7 +338,6 @@ void PSLIKE_PLOTTER::postscriptOverlinePositions( const wxString& aText, int aXS
void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !outputFile );
m_plotMirror = aMirror;
plotOffset = aOffset;
plotScale = aScale;
@@ -875,7 +873,10 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
aMultilineAllowed = false; // the text has only one line.
// Draw the native postscript text (if requested)
if( m_textMode == PLOTTEXTMODE_NATIVE && !aMultilineAllowed )
// Currently: does not work: disable it
bool use_native = false; // = m_textMode == PLOTTEXTMODE_NATIVE && !aMultilineAllowed;
if( use_native )
{
const char *fontname = aItalic ? (aBold ? "/KicadFont-BoldOblique"
: "/KicadFont-Oblique")
@@ -928,7 +929,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
}
// Draw the stroked text (if requested)
if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed )
if( !use_native )
{
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold, aMultilineAllowed );
-1
View File
@@ -172,7 +172,6 @@ SVG_PLOTTER::SVG_PLOTTER()
void SVG_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
wxASSERT( !outputFile );
m_plotMirror = aMirror;
m_yaxisReversed = true; // unlike other plotters, SVG has Y axis reversed
plotOffset = aOffset;
+24 -22
View File
@@ -148,45 +148,47 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
description << wxT( "<ul>" );
description << wxT( "<li>" )
<< HtmlHyperlink( wxT( "http://www.kicad-pcb.org" ),
_( "The official KiCad site" ) )
<< wxT( "</li>" );
description << wxT( "<li>" )
<< HtmlHyperlink( wxT( "http://iut-tice.ujf-grenoble.fr/kicad" ),
_( "The original site of the KiCad project founder" ) )
_( "The official KiCad website" ) )
<< wxT( "</li>" );
description << wxT( "<li>" )
<< HtmlHyperlink( wxT( "https://launchpad.net/kicad" ),
_( "Developer's website on Launchpad" ) )
<< wxT("</li>" );
description << wxT( "<li>" )
<< HtmlHyperlink( wxT( "http://www.kicadlib.org" ),
_( "Repository with additional component libraries" ) )
<< HtmlHyperlink( wxT( "https://github.com/KiCad/" ),
_( "Official repository for component and footprint libraries" ) )
<< wxT( "</li>" );
description << wxT( "</ul>" );
description << wxT( "</p>" );
description << wxT( "<p>" );
description << wxT( "<b><u>" )
<< _( "Contribute to KiCad" )
description << wxT( "<p><b><u>" )
<< _( "Bug tracker" )
<< wxT( "</u></b>" ); // bold & underlined font caption
// bullet-ed list with some http links
description << wxT( "<ul>" );
description << wxT( "<li>" )
<<HtmlHyperlink( wxT( "https://bugs.launchpad.net/kicad" ),
_( "Report bugs if you found any" ) )
<< HtmlHyperlink( wxT( "https://bugs.launchpad.net/kicad/+bugs?orderby=-id&start=0" ),
_( "Report or examine bugs" ) )
<< wxT( "</li>" );
description << wxT( "<li>" )
<< HtmlHyperlink( wxT( "https://blueprints.launchpad.net/kicad" ),
_( "File an idea for improvement" ) )
<< wxT( "</li>" );
description << wxT( "<li>" )
<< HtmlHyperlink( wxT( "http://www.kicadlib.org/Kicad_related_links.html" ),
_( "KiCad links to user groups, tutorials and much more" ) )
<< wxT( "</li>" );
description << wxT( "</ul>" );
description << wxT( "</ul></p>" );
description << wxT( "</p>" );
description << wxT( "<p><b><u>" )
<< _( "KiCad user's groups and community" )
<< wxT( "</u></b>" ); // bold & underlined font caption
description << wxT( "<ul>" );
description << wxT( "<li>" )
<< HtmlHyperlink( wxT( "https://groups.yahoo.com/neo/groups/kicad-users/info" ),
_( "KiCad user's group" ) )
<< wxT( "</li>" );
description << wxT( "<li>" )
<< HtmlHyperlink( wxT( "https://forum.kicad.info" ),
_( "KiCad forum" ) )
<< wxT( "</li>" );
description << wxT( "</ul></p>" );
info.SetDescription( description );
+89 -2
View File
@@ -1,9 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-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
@@ -70,6 +69,9 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl
if( h )
SetKiway( this, &h->Kiway() );
Bind( wxEVT_CLOSE_WINDOW, &DIALOG_SHIM::OnCloseWindow, this );
Bind( wxEVT_BUTTON, &DIALOG_SHIM::OnButton, this );
#ifdef __WINDOWS__
// On Windows, the app top windows can be brought to the foreground
// (at least temporary) in certain circumstances,
@@ -97,6 +99,33 @@ DIALOG_SHIM::~DIALOG_SHIM()
delete m_qmodal_parent_disabler; // usually NULL by now
}
void DIALOG_SHIM::FinishDialogSettings()
{
// must be called from the constructor of derived classes,
// when all widgets are initialized, and therefore their size fixed
// SetSizeHints fixes the minimal size of sizers in the dialog
// (SetSizeHints calls Fit(), so no need to call it)
GetSizer()->SetSizeHints( this );
// the default position, when calling the first time the dlg
Center();
}
void DIALOG_SHIM::FixOSXCancelButtonIssue()
{
#ifdef __WXMAC__
// A ugly hack to fix an issue on OSX: ctrl+c closes the dialog instead of
// copying a 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
// to copy text standard accelerator, and the dlg is closed when trying to copy text
wxButton* button = dynamic_cast< wxButton* > ( wxWindow::FindWindowById( wxID_CANCEL, this ) );
if( button )
button->SetLabel( _( "Cancel" ) );
#endif
}
// our hashtable is an implementation secret, don't need or want it in a header file
#include <hashtables.h>
@@ -505,6 +534,11 @@ int DIALOG_SHIM::ShowQuasiModal()
void DIALOG_SHIM::EndQuasiModal( int retCode )
{
// Hook up validator and transfer data from controls handling so quasi-modal dialogs
// handle validation in the same way as other dialogs.
if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
return;
SetReturnCode( retCode );
if( !IsQuasiModal() )
@@ -530,3 +564,56 @@ void DIALOG_SHIM::EndQuasiModal( int retCode )
Show( false );
}
void DIALOG_SHIM::OnCloseWindow( wxCloseEvent& aEvent )
{
if( IsQuasiModal() )
{
EndQuasiModal( wxID_CANCEL );
return;
}
// This is mandatory to allow wxDialogBase::OnCloseWindow() to be called.
aEvent.Skip();
}
void DIALOG_SHIM::OnButton( wxCommandEvent& aEvent )
{
if( IsQuasiModal() )
{
const int id = aEvent.GetId();
if( id == GetAffirmativeId() )
{
EndQuasiModal( id );
}
else if( id == wxID_APPLY )
{
// Dialogs that provide Apply buttons should make sure data is valid before
// allowing a transfer, as there is no other way to indicate failure
// (i.e. the dialog can't refuse to close as it might with OK, because it
// isn't closing anyway)
if( Validate() )
{
bool success = TransferDataFromWindow();
(void) success;
}
}
else if( id == GetEscapeId() ||
(id == wxID_CANCEL && GetEscapeId() == wxID_ANY) )
{
EndQuasiModal( wxID_CANCEL );
}
else // not a standard button
{
aEvent.Skip();
}
return;
}
// This is mandatory to allow wxDialogBase::OnButton() to be called.
aEvent.Skip();
}
@@ -62,7 +62,7 @@ DIALOG_ENV_VAR_CONFIG_BASE::DIALOG_ENV_VAR_CONFIG_BASE( wxWindow* parent, wxWind
brightSizer->Add( m_buttonAdd, 0, wxALL|wxEXPAND, 5 );
m_buttonDelete = new wxButton( this, wxID_ANY, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonDelete->SetToolTip( _("Remove the selectect entry from the table.") );
m_buttonDelete->SetToolTip( _("Remove the selected entry from the table.") );
brightSizer->Add( m_buttonDelete, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 );
@@ -407,7 +407,7 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Remove the selectect entry from the table.</property>
<property name="tooltip">Remove the selected entry from the table.</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
+19 -16
View File
@@ -52,26 +52,29 @@
// List of page formats.
// should be statically initialized, because we need both
// the translated and the not translated version.
// they are prefixed by "_HKI" (already in use for hotkeys) instead of "_",
// because we need both the translated and the not translated version.
// when displayed in dialog we should explicitely call wxGetTranslation()
// to show the translated version.
// See hotkeys_basic.h for more info
#define _HKI( x ) wxT( x )
static const wxString pageFmts[] =
{
_("A4 210x297mm"),
_("A3 297x420mm"),
_("A2 420x594mm"),
_("A1 594x841mm"),
_("A0 841x1189mm"),
_("A 8.5x11in"),
_("B 11x17in"),
_("C 17x22in"),
_("D 22x34in"),
_("E 34x44in"),
_("USLetter 8.5x11in"), // USLetter without space is correct
_("USLegal 8.5x14in"), // USLegal without space is correct
_("USLedger 11x17in"), // USLedger without space is correct
_("User (Custom)"),
_HKI("A4 210x297mm"),
_HKI("A3 297x420mm"),
_HKI("A2 420x594mm"),
_HKI("A1 594x841mm"),
_HKI("A0 841x1189mm"),
_HKI("A 8.5x11in"),
_HKI("B 11x17in"),
_HKI("C 17x22in"),
_HKI("D 22x34in"),
_HKI("E 34x44in"),
_HKI("USLetter 8.5x11in"), // USLetter without space is correct
_HKI("USLegal 8.5x14in"), // USLegal without space is correct
_HKI("USLedger 11x17in"), // USLedger without space is correct
_HKI("User (Custom)"), // size defined by user. The string must contain "Custom"
// to be reconized in code
};
void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
+7
View File
@@ -45,6 +45,13 @@ WX_HTML_REPORT_PANEL::~WX_HTML_REPORT_PANEL()
}
void WX_HTML_REPORT_PANEL::MsgPanelSetMinSize( const wxSize& aMinSize )
{
m_htmlView->SetMinSize( aMinSize );
GetSizer()->SetSizeHints( this );
}
REPORTER& WX_HTML_REPORT_PANEL::Reporter()
{
return m_reporter;
+3
View File
@@ -46,6 +46,9 @@ public:
const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
~WX_HTML_REPORT_PANEL();
///> Set the min size of the area which displays html messages:
void MsgPanelSetMinSize( const wxSize& aMinSize );
///> returns the reporter object that reports to this panel
REPORTER& Reporter();
+2 -1
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 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
@@ -1076,6 +1076,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
// Transfer EDA_DRAW_PANEL settings
GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
GetGalCanvas()->GetViewControls()->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
GetToolManager()->RunAction( "pcbnew.Control.switchCursor" );
}
else if( m_galCanvasActive )
+90 -28
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2007-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -48,6 +48,7 @@ static const int CURSOR_SIZE = 12; ///< Cursor size in pixels
// keys to store options in config:
#define ENBL_ZOOM_NO_CENTER_KEY wxT( "ZoomNoCenter" )
#define ENBL_MOUSEWHEEL_PAN_KEY wxT( "MousewheelPAN" )
#define ENBL_MIDDLE_BUTT_PAN_KEY wxT( "MiddleButtonPAN" )
#define MIDDLE_BUTT_PAN_LIMITED_KEY wxT( "MiddleBtnPANLimited" )
#define ENBL_AUTO_PAN_KEY wxT( "AutoPAN" )
@@ -96,16 +97,14 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
{
wxASSERT( parent );
#ifndef USE_OSX_MAGNIFY_EVENT
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
#else
ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
#endif
DisableKeyboardScrolling();
m_scrollIncrementX = std::min( size.x / 8, 10 );
m_scrollIncrementY = std::min( size.y / 8, 10 );
SetLayoutDirection( wxLayout_LeftToRight );
SetBackgroundColour( MakeColour( parent->GetDrawBgColor() ) );
#if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC
@@ -117,12 +116,16 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_ClipBox.SetY( 0 );
m_canStartBlock = -1; // Command block can start if >= 0
m_abortRequest = false;
m_enableMousewheelPan = false;
m_enableMiddleButtonPan = true;
m_enableZoomNoCenter = false;
m_panScrollbarLimits = false;
m_enableAutoPan = true;
m_ignoreMouseEvents = false;
m_ignoreNextLeftButtonRelease = false;
// Be sure a mouse release button event will be ignored when creating the canvas
// if the mouse click was not made inside the canvas (can happen sometimes, when
// launching an editor from a double click made in an other frame)
m_ignoreNextLeftButtonRelease = true;
m_mouseCaptureCallback = NULL;
m_endMouseCaptureCallback = NULL;
@@ -131,6 +134,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
if( cfg )
{
cfg->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false );
cfg->Read( ENBL_MIDDLE_BUTT_PAN_KEY, &m_enableMiddleButtonPan, true );
cfg->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
cfg->Read( MIDDLE_BUTT_PAN_LIMITED_KEY, &m_panScrollbarLimits, false );
@@ -160,6 +164,7 @@ EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
if( cfg )
{
cfg->Write( ENBL_MOUSEWHEEL_PAN_KEY, m_enableMousewheelPan );
cfg->Write( ENBL_MIDDLE_BUTT_PAN_KEY, m_enableMiddleButtonPan );
cfg->Write( ENBL_ZOOM_NO_CENTER_KEY, m_enableZoomNoCenter );
cfg->Write( MIDDLE_BUTT_PAN_LIMITED_KEY, m_panScrollbarLimits );
@@ -432,7 +437,7 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
// so we skip these events.
// Note they are here just in case, because they are not actually used
// in Kicad
#if wxCHECK_VERSION( 3, 1, 0 ) || !wxCHECK_VERSION( 2, 9, 5 ) || !defined (__WINDOWS__)
#if wxCHECK_VERSION( 3, 1, 0 ) || !wxCHECK_VERSION( 2, 9, 5 ) || ( !defined (__WINDOWS__) && !defined (__WXMAC__) )
int maxX = unitsX - csizeX;
int maxY = unitsY - csizeY;
@@ -643,6 +648,15 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
}
void EDA_DRAW_PANEL::SetEnableMousewheelPan( bool aEnable )
{
m_enableMousewheelPan = aEnable;
if( GetParent()->IsGalCanvasActive() )
GetParent()->GetGalCanvas()->GetViewControls()->EnableMousewheelPan( aEnable );
}
void EDA_DRAW_PANEL::SetEnableZoomNoCenter( bool aEnable )
{
m_enableZoomNoCenter = aEnable;
@@ -731,20 +745,54 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
GRSetColorPen( aDC, GetParent()->GetGridColor() );
#else
// On mac (Cocoa), a point isn't a pixel and being of size 1 don't survive to antialiasing
GRSetColorPen( aDC, GetParent()->GetGridColor(), aDC->DeviceToLogicalXRel(2) );
GRSetColorPen( aDC, GetParent()->GetGridColor(), aDC->DeviceToLogicalXRel( 2 ) );
#endif
int xpos;
double right = ( double ) m_ClipBox.GetRight();
double bottom = ( double ) m_ClipBox.GetBottom();
for( double x = (double) org.x; x <= right; x += gridSize.x )
#if defined( __WXMAC__ ) && defined( USE_WX_GRAPHICS_CONTEXT )
wxGCDC *gcdc = wxDynamicCast( aDC, wxGCDC );
if( gcdc )
{
xpos = KiROUND( x );
wxGraphicsContext *gc = gcdc->GetGraphicsContext();
for( double y = (double) org.y; y <= bottom; y += gridSize.y )
// Grid point size
const int gsz = 1;
const double w = aDC->DeviceToLogicalXRel( gsz );
const double h = aDC->DeviceToLogicalYRel( gsz );
// Use our own pen
wxPen pen( MakeColour( GetParent()->GetGridColor() ), h );
pen.SetCap( wxCAP_BUTT );
gc->SetPen( pen );
// draw grid
wxGraphicsPath path = gc->CreatePath();
for( double x = (double) org.x - w/2.0; x <= right - w/2.0; x += gridSize.x )
{
aDC->DrawPoint( xpos, KiROUND( y ) );
for( double y = (double) org.y; y <= bottom; y += gridSize.y )
{
path.MoveToPoint( x, y );
path.AddLineToPoint( x+w, y );
}
}
gc->StrokePath( path );
}
else
#endif
{
GRSetColorPen( aDC, GetParent()->GetGridColor() );
for( double x = (double) org.x; x <= right; x += gridSize.x )
{
xpos = KiROUND( x );
for( double y = (double) org.y; y <= bottom; y += gridSize.y )
{
aDC->DrawPoint( xpos, KiROUND( y ) );
}
}
}
}
@@ -845,6 +893,17 @@ bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
pos = event.GetPosition();
m_ignoreMouseEvents = true;
PopupMenu( &MasterMenu, pos );
// here, we are waiting for popup menu closing.
// Among different ways, it can be closed by clicking on the left mouse button.
// The expected behavior is to move the mouse cursor to its initial
// location, where the right click was made.
// However there is a case where the move cursor does not work as expected:
// when the user left clicks on the caption frame: the entire window is moved.
// Calling wxSafeYield avoid this behavior because it allows the left click
// to be proceeded before moving the mouse
wxSafeYield();
// Move the mouse cursor to its initial position:
MoveCursorToCrossHair();
m_ignoreMouseEvents = false;
@@ -926,17 +985,24 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
offCenterReq = offCenterReq || m_enableZoomNoCenter;
int axis = event.GetWheelAxis();
int wheelRotation = event.GetWheelRotation();
// This is a zoom in or out command
if( event.GetWheelRotation() > 0 )
if( m_enableMousewheelPan )
{
wxPoint newStart = GetViewStart();
if( axis == wxMOUSE_WHEEL_HORIZONTAL )
newStart.x += wheelRotation;
else
newStart.y -= wheelRotation;
wxPoint center = GetScreenCenterLogicalPosition();
GetParent()->SetScrollCenterPosition( center );
Scroll( newStart );
}
else if( wheelRotation > 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
{
if( axis == 0 )
cmd.SetId( ID_PAN_UP );
else
cmd.SetId( ID_PAN_RIGHT );
}
cmd.SetId( ID_PAN_UP );
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_LEFT );
else if( offCenterReq )
@@ -944,15 +1010,10 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
else
cmd.SetId( ID_POPUP_ZOOM_IN );
}
else if( event.GetWheelRotation() < 0 )
else if( wheelRotation < 0 )
{
if( event.ShiftDown() && !event.ControlDown() )
{
if( axis == 0 )
cmd.SetId( ID_PAN_DOWN );
else
cmd.SetId( ID_PAN_LEFT );
}
cmd.SetId( ID_PAN_DOWN );
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_RIGHT );
else if( offCenterReq )
@@ -961,7 +1022,8 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
cmd.SetId( ID_POPUP_ZOOM_OUT );
}
GetEventHandler()->ProcessEvent( cmd );
if( cmd.GetId() )
GetEventHandler()->ProcessEvent( cmd );
event.Skip();
}
+24 -2
View File
@@ -62,9 +62,17 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
m_eventDispatcher = NULL;
m_lostFocus = false;
SetLayoutDirection( wxLayout_LeftToRight );
SwitchBackend( aGalType );
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
// Scrollbars broken in GAL on OSX
#ifdef __WXMAC__
ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
#else
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
#endif
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
m_painter = new KIGFX::PCB_PAINTER( m_gal );
@@ -142,11 +150,18 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_drawing = true;
// Scrollbars broken in GAL on OSX
#ifndef __WXMAC__
m_viewControls->UpdateScrollbars();
#endif
m_view->UpdateItems();
m_gal->BeginDrawing();
m_gal->ClearScreen( m_painter->GetSettings()->GetBackgroundColor() );
KIGFX::COLOR4D gridColor = static_cast<KIGFX::PCB_RENDER_SETTINGS*> (m_painter->GetSettings())->GetLayerColor( ITEM_GAL_LAYER ( GRID_VISIBLE ) );
m_gal->SetGridColor ( gridColor );
if( m_view->IsDirty() )
{
m_view->ClearTargets();
@@ -179,20 +194,27 @@ void EDA_DRAW_PANEL_GAL::Refresh( bool aEraseBackground, const wxRect* aRect )
if( m_pendingRefresh )
return;
m_pendingRefresh = true;
#ifdef __WXMAC__
// Timers on OS X may have a high latency (seen up to 500ms and more) which
// makes repaints jerky. No negative impact seen without throttling, so just
// do an unconditional refresh for OS X.
ForceRefresh();
#else
wxLongLong t = wxGetLocalTimeMillis();
wxLongLong delta = t - m_lastRefresh;
if( delta >= MinRefreshPeriod )
{
ForceRefresh();
m_pendingRefresh = true;
}
else
{
// One shot timer
m_refreshTimer.Start( ( MinRefreshPeriod - delta ).ToLong(), true );
m_pendingRefresh = true;
}
#endif
}
+23 -17
View File
@@ -39,24 +39,29 @@
#include <class_drawpanel.h>
#include <class_base_screen.h>
#include <gal/stroke_font.h>
#include <newstroke_font.h>
#include <plot_common.h>
/* factor used to calculate actual size of shapes from hershey fonts
* (could be adjusted depending on the font name)
* Its value is choosen in order to have letters like M, P .. vertical size
* equal to the vertical char size parameter
* Of course some shapes can be bigger or smaller than the vertical char size
* parameter
*/
#define HERSHEY_SCALE_FACTOR 1 / 21.0
double s_HersheyScaleFactor = HERSHEY_SCALE_FACTOR;
using namespace KIGFX;
// A ugly hack to avoid UTF8::uni_iter method not found at link stage
// in gerbview and pl_editor.
// Hoping I (JPC) can remove that soon.
void dummy()
{
UTF8 text = "x";
for( UTF8::uni_iter it = text.ubegin(), end = text.uend(); it < end; ++it )
;
}
int OverbarPositionY( int size_v )
{
return KiROUND( size_v * 1.22 );
return KiROUND( size_v * STROKE_FONT::OVERBAR_HEIGHT );
}
@@ -184,13 +189,13 @@ int GraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, bool aWid
// Get metrics
int xsta = *shape_ptr++ - 'R';
int xsto = *shape_ptr++ - 'R';
tally += KiROUND( aXSize * (xsto - xsta) * s_HersheyScaleFactor );
tally += KiROUND( aXSize * (xsto - xsta) * STROKE_FONT::STROKE_FONT_SCALE );
}
// For italic correction, add 1/8 size
if( aItalic )
{
tally += KiROUND( aXSize * 0.125 );
tally += KiROUND( aXSize * STROKE_FONT::ITALIC_TILT );
}
return tally;
@@ -415,7 +420,7 @@ void DrawGraphicText( EDA_RECT* aClipBox,
if( aItalic )
{
overbar_italic_comp = OverbarPositionY( size_v ) / 8;
overbar_italic_comp = KiROUND( OverbarPositionY( size_v ) * STROKE_FONT::ITALIC_TILT );
if( italic_reverse )
{
@@ -519,13 +524,14 @@ void DrawGraphicText( EDA_RECT* aClipBox,
{
wxPoint currpoint;
hc1 -= xsta; hc2 -= 10; // Align the midpoint
hc1 = KiROUND( hc1 * size_h * s_HersheyScaleFactor );
hc2 = KiROUND( hc2 * size_v * s_HersheyScaleFactor );
hc1 = KiROUND( hc1 * size_h * STROKE_FONT::STROKE_FONT_SCALE );
hc2 = KiROUND( hc2 * size_v * STROKE_FONT::STROKE_FONT_SCALE );
// To simulate an italic font,
// add a x offset depending on the y offset
if( aItalic )
hc1 -= KiROUND( italic_reverse ? -hc2 / 8.0 : hc2 / 8.0 );
hc1 -= KiROUND( italic_reverse ? -hc2 * STROKE_FONT::ITALIC_TILT
: hc2 * STROKE_FONT::ITALIC_TILT );
currpoint.x = hc1 + current_char_pos.x;
currpoint.y = hc2 + current_char_pos.y;
@@ -541,7 +547,7 @@ void DrawGraphicText( EDA_RECT* aClipBox,
ptr++;
// Apply the advance width
current_char_pos.x += KiROUND( size_h * (xsto - xsta) * s_HersheyScaleFactor );
current_char_pos.x += KiROUND( size_h * (xsto - xsta) * STROKE_FONT::STROKE_FONT_SCALE );
}
if( overbars % 2 )
+18 -12
View File
@@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2016 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
@@ -46,6 +46,8 @@
#error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW."
#endif
#include <gal/stroke_font.h>
#include <convert_to_biu.h>
EDA_TEXT::EDA_TEXT( const wxString& text )
@@ -106,15 +108,16 @@ wxString EDA_TEXT::ShortenedShownText() const
}
/**
* Function GetInterline
* return the distance between 2 text lines
* has meaning only for multiline texts
/*
* calculate the distance (pitch) between 2 text lines
* the distance includes the interline + room for chars like j { and [
* Is used for multiline texts, but also for single line texts, to calculate
* the text bounding box
*/
int EDA_TEXT::GetInterline( int aTextThickness ) const
{
int thickness = aTextThickness <= 0 ? m_Thickness : aTextThickness;
return (( m_Size.y * 14 ) / 10) + thickness;
return KiROUND( m_Size.y * KIGFX::STROKE_FONT::INTERLINE_PITCH_RATIO ) + thickness;
}
EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
@@ -130,7 +133,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
{
wxStringSplit( text, strings, '\n' );
if ( strings.GetCount() ) // GetCount() == 0 for void strings
if( strings.GetCount() ) // GetCount() == 0 for void strings
{
if( aLine >= 0 && (aLine < (int)strings.GetCount()) )
text = strings.Item( aLine );
@@ -153,11 +156,15 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
else
rect.SetOrigin( m_Pos );
// extra dy interval for letters like j and y and ]
int extra_dy = dy - m_Size.y;
rect.Move( wxPoint( 0, -extra_dy / 2 ) ); // move origin by the half extra interval
// The bbox vertical size returned by GetInterline( aThickness )
// includes letters like j and y and ] + interval between lines.
// The interval below the last line is not usefull, and we can use its half value
// as vertical margin above the text
// the full interval is roughly m_Size.y * 0.4 - aThickness/2
rect.Move( wxPoint( 0, aThickness/4 - KiROUND( m_Size.y * 0.2 ) ) );
// for multiline texts and aLine < 0, merge all rectangles
// ( if aLine < 0, we want the full text bounding box )
if( m_MultilineAllowed && aLine < 0 )
{
for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
@@ -232,7 +239,6 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
}
}
rect.Inflate( thickness / 2 );
rect.Normalize(); // Make h and v sizes always >= 0
return rect;
+24 -61
View File
@@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 Jean-Pierre Charras, <jp.charras@wanadoo.fr>
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013-2016 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* 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
@@ -28,7 +28,12 @@
*/
#define USE_WORKER_THREADS 1 // 1:yes, 0:no. use worker thread to load libraries
/**
No. concurrent threads doing "http(s) GET". More than 6 is not significantly
faster, less than 6 is likely slower. Main thread is in this count, so if
set to 1 then no temp threads are created.
*/
#define READER_THREADS 6
/*
* Functions to read footprint libraries and fill m_footprints by available footprints names
@@ -46,6 +51,7 @@
#include <fpid.h>
#include <class_module.h>
#include <boost/thread.hpp>
#include <html_messagebox.h>
/*
@@ -119,26 +125,10 @@ void FOOTPRINT_INFO::load()
}
#define JOBZ 6 // no. libraries per worker thread. It takes about
// a second to load a GITHUB library, so assigning
// this no. libraries to each thread should give a little
// over this no. seconds total time if the original delay
// were caused by latencies alone.
// (If https://github.com does not mind.)
#define NTOLERABLE_ERRORS 4 // max errors before aborting, although threads
// in progress will still pile on for a bit. e.g. if 9 threads
// expect 9 greater than this.
void FOOTPRINT_LIST::loader_job( const wxString* aNicknameList, int aJobZ )
{
//DBG(printf( "%s: first:'%s' count:%d\n", __func__, (char*) TO_UTF8( *aNicknameList ), aJobZ );)
for( int i=0; i<aJobZ; ++i )
{
if( m_error_count >= NTOLERABLE_ERRORS )
break;
const wxString& nickname = aNicknameList[i];
try
@@ -212,8 +202,6 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
// do all of them
nicknames = aTable->GetLogicalLibs();
#if USE_WORKER_THREADS
// Even though the PLUGIN API implementation is the place for the
// locale toggling, in order to keep LOCAL_IO::C_count at 1 or greater
// for the duration of all helper threads, we increment by one here via instantiation.
@@ -229,29 +217,23 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
MYTHREADS threads;
unsigned jobz = (nicknames.size() + READER_THREADS - 1) / READER_THREADS;
// Give each thread JOBZ nicknames to process. The last portion of, or if the entire
// size() is small, I'll do myself.
for( unsigned i=0; i<nicknames.size(); )
{
if( m_error_count >= NTOLERABLE_ERRORS )
{
// abort the remaining nicknames.
retv = false;
break;
}
int jobz = JOBZ;
if( i + jobz >= nicknames.size() )
if( i + jobz >= nicknames.size() ) // on the last iteration of this for(;;)
{
jobz = nicknames.size() - i;
// Only a little bit to do, I'll do it myself, on current thread.
// Only a little bit to do, I'll do it myself on current thread.
// I am part of the READER_THREADS count.
loader_job( &nicknames[i], jobz );
}
else
{
// Delegate the job to a worker thread created here.
// Delegate the job to a temporary thread created here.
threads.push_back( new boost::thread( &FOOTPRINT_LIST::loader_job,
this, &nicknames[i], jobz ) );
}
@@ -266,9 +248,6 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
{
threads[i].join();
}
#else
loader_job( &nicknames[0], nicknames.size() );
#endif
m_list.sort();
}
@@ -312,29 +291,8 @@ bool FOOTPRINT_INFO::InLibrary( const wxString& aLibrary ) const
}
#include <confirm.h> // until scaffolding goes.
void FOOTPRINT_LIST::DisplayErrors( wxTopLevelWindow* aWindow )
{
#if 1
// scaffolding until a better one is written, hopefully below.
DBG(printf( "m_error_count:%d\n", m_error_count );)
wxString msg = _( "Errors were encountered loading footprints" );
msg += wxT( '\n' );
for( unsigned i = 0; i<m_errors.size(); ++i )
{
msg += m_errors[i].errorText;
msg += wxT( '\n' );
}
DisplayError( aWindow, msg );
#else // real evolving deal:
// @todo: go to a more HTML !<table>! ? centric output, possibly with
// recommendations for remedy of errors. Add numeric error codes
// to PARSE_ERROR, and switch on them for remedies, etc. Full
@@ -342,13 +300,18 @@ void FOOTPRINT_LIST::DisplayErrors( wxTopLevelWindow* aWindow )
HTML_MESSAGE_BOX dlg( aWindow, _( "Load Error" ) );
dlg.MessageSet( _( "Errors were encountered loading footprints" ) );
dlg.MessageSet( _( "Errors were encountered loading footprints:" ) );
wxString msg = my html wizardry.
wxString msg;
for( unsigned i = 0; i<m_errors.size(); ++i )
{
msg += wxT( "<p>" ) + m_errors[i].errorText + wxT( "</p>" );
}
// Preserve new lines in error messages so queued errors don't run together.
msg.Replace( "\n", "<BR>" );
dlg.AddHTML_Text( msg );
dlg.ShowModal();
#endif
}
+25 -7
View File
@@ -260,6 +260,7 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
*/
T tok;
wxString errMsg; // to collect error messages
// This table may be nested within a larger s-expression, or not.
// Allow for parser of that optional containing s-epression to have looked ahead.
@@ -280,10 +281,6 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
if( tok != T_LEFT )
in->Expecting( T_LEFT );
// in case there is a "row integrity" error, tell where later.
int lineNum = in->CurLineNumber();
int offset = in->CurOffset();
if( ( tok = in->NextTok() ) != T_lib )
in->Expecting( T_lib );
@@ -323,7 +320,17 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
in->Duplicate( tok );
sawUri = true;
in->NeedSYMBOLorNUMBER();
row.SetFullURI( in->FromUTF8() );
// Saved path and file names use the Unix notation (separator = '/')
// However old files, and files edited by hand can use the windows
// separator. Force the unix notation.
// (It works on windows, and moreover, wxFileName and wxDir takes care to that
// on windows)
// moreover, URLs use the '/' as separator
{
wxString uri = in->FromUTF8();
uri.Replace( '\\', '/' );
row.SetFullURI( uri );
}
break;
case T_type:
@@ -372,9 +379,15 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
wxString msg = wxString::Format(
_( "'%s' is a duplicate footprint library nickName" ),
GetChars( row.nickName ) );
THROW_PARSE_ERROR( msg, in->CurSource(), in->CurLine(), lineNum, offset );
if( !errMsg.IsEmpty() )
errMsg << '\n';
errMsg << msg;
}
}
if( !errMsg.IsEmpty() )
THROW_IO_ERROR( errMsg );
}
@@ -393,10 +406,15 @@ void FP_LIB_TABLE::Format( OUTPUTFORMATTER* out, int nestLevel ) const
void FP_LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR, boost::interprocess::lock_exception )
{
// In Kicad, we save path and file names using the Unix notation (separator = '/')
// So ensure separator is always '/' is saved URI string
wxString uri = GetFullURI();
uri.Replace( '\\', '/' );
out->Print( nestLevel, "(lib (name %s)(type %s)(uri %s)(options %s)(descr %s))\n",
out->Quotew( GetNickName() ).c_str(),
out->Quotew( GetType() ).c_str(),
out->Quotew( GetFullURI() ).c_str(),
out->Quotew( uri ).c_str(),
out->Quotew( GetOptions() ).c_str(),
out->Quotew( GetDescr() ).c_str()
);
+33 -32
View File
@@ -257,38 +257,6 @@ void CAIRO_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd
}
void CAIRO_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList )
{
// Iterate over the point list and draw the segments
std::deque<VECTOR2D>::const_iterator it = aPointList.begin();
cairo_move_to( currentContext, it->x, it->y );
for( ++it; it != aPointList.end(); ++it )
{
cairo_line_to( currentContext, it->x, it->y );
}
isElementAdded = true;
}
void CAIRO_GAL::DrawPolygon( const std::deque<VECTOR2D>& aPointList )
{
// Iterate over the point list and draw the polygon
std::deque<VECTOR2D>::const_iterator it = aPointList.begin();
cairo_move_to( currentContext, it->x, it->y );
for( ++it; it != aPointList.end(); ++it )
{
cairo_line_to( currentContext, it->x, it->y );
}
isElementAdded = true;
}
void CAIRO_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControlPointA,
const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint )
{
@@ -1059,6 +1027,39 @@ void CAIRO_GAL::setCompositor()
}
void CAIRO_GAL::drawPoly( const std::deque<VECTOR2D>& aPointList )
{
// Iterate over the point list and draw the segments
std::deque<VECTOR2D>::const_iterator it = aPointList.begin();
cairo_move_to( currentContext, it->x, it->y );
for( ++it; it != aPointList.end(); ++it )
{
cairo_line_to( currentContext, it->x, it->y );
}
isElementAdded = true;
}
void CAIRO_GAL::drawPoly( const VECTOR2D aPointList[], int aListSize )
{
// Iterate over the point list and draw the segments
const VECTOR2D* ptr = aPointList;
cairo_move_to( currentContext, ptr->x, ptr->y );
for( int i = 0; i < aListSize; ++i )
{
++ptr;
cairo_line_to( currentContext, ptr->x, ptr->y );
}
isElementAdded = true;
}
unsigned int CAIRO_GAL::getNewGroupNumber()
{
wxASSERT_MSG( groups.size() < std::numeric_limits<unsigned int>::max(),
+68 -6
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2012 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2013-2015 CERN
* Copyright (C) 2013-2016 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* Graphics Abstraction Layer (GAL) for OpenGL
@@ -358,7 +358,7 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
SWAP( aStartAngle, >, aEndAngle );
Save();
currentManager->Translate( aCenterPoint.x, aCenterPoint.y, layerDepth );
currentManager->Translate( aCenterPoint.x, aCenterPoint.y, 0.0 );
if( isStrokeEnabled )
{
@@ -448,9 +448,9 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn
}
void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList )
void OPENGL_GAL::DrawPolyline( const std::deque<VECTOR2D>& aPointList )
{
if( aPointList.empty() )
if( aPointList.size() < 2 )
return;
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
@@ -476,19 +476,46 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList )
}
void OPENGL_GAL::DrawPolyline( const VECTOR2D aPointList[], int aListSize )
{
if( aListSize < 2 )
return;
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
// Start from the second point
for( int i = 1; i < aListSize; ++i )
{
const VECTOR2D startEndVector = ( aPointList[i] - aPointList[i - 1] );
double lineAngle = startEndVector.Angle();
drawLineQuad( aPointList[i - 1], aPointList[i] );
// There is no need to draw line caps on both ends of polyline's segments
drawFilledSemiCircle( aPointList[i - 1], lineWidth / 2, lineAngle + M_PI / 2 );
}
// ..and now - draw the ending cap
const VECTOR2D startEndVector = ( aPointList[aListSize - 1] - aPointList[aListSize - 2] );
double lineAngle = startEndVector.Angle();
drawFilledSemiCircle( aPointList[aListSize - 1], lineWidth / 2, lineAngle - M_PI / 2 );
}
void OPENGL_GAL::DrawPolygon( const std::deque<VECTOR2D>& aPointList )
{
// Any non convex polygon needs to be tesselated
// for this purpose the GLU standard functions are used
currentManager->Shader( SHADER_NONE );
currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a );
// Any non convex polygon needs to be tesselated
// for this purpose the GLU standard functions are used
TessParams params = { currentManager, tessIntersects };
gluTessBeginPolygon( tesselator, &params );
gluTessBeginContour( tesselator );
boost::shared_array<GLdouble> points( new GLdouble[3 * aPointList.size()] );
int v = 0;
for( std::deque<VECTOR2D>::const_iterator it = aPointList.begin(); it != aPointList.end(); ++it )
{
points[v] = it->x;
@@ -508,6 +535,41 @@ void OPENGL_GAL::DrawPolygon( const std::deque<VECTOR2D>& aPointList )
}
void OPENGL_GAL::DrawPolygon( const VECTOR2D aPointList[], int aListSize )
{
currentManager->Shader( SHADER_NONE );
currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a );
// Any non convex polygon needs to be tesselated
// for this purpose the GLU standard functions are used
TessParams params = { currentManager, tessIntersects };
gluTessBeginPolygon( tesselator, &params );
gluTessBeginContour( tesselator );
boost::shared_array<GLdouble> points( new GLdouble[3 * aListSize] );
int v = 0;
const VECTOR2D* ptr = aPointList;
for( int i = 0; i < aListSize; ++i )
{
points[v] = ptr->x;
points[v + 1] = ptr->y;
points[v + 2] = layerDepth;
gluTessVertex( tesselator, &points[v], &points[v] );
++ptr;
v += 3;
}
gluTessEndContour( tesselator );
gluTessEndPolygon( tesselator );
// Free allocated intersecting points
tessIntersects.clear();
// vertexList destroyed here
}
void OPENGL_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControlPointA,
const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint )
{
+10 -8
View File
@@ -32,9 +32,11 @@
using namespace KIGFX;
const double STROKE_FONT::INTERLINE_PITCH_RATIO = 1.5;
const double STROKE_FONT::OVERBAR_HEIGHT = 1.22;
const double STROKE_FONT::BOLD_FACTOR = 1.3;
const double STROKE_FONT::HERSHEY_SCALE = 1.0 / 21.0;
const double STROKE_FONT::STROKE_FONT_SCALE = 1.0 / 21.0;
const double STROKE_FONT::ITALIC_TILT = 1.0 / 8;
STROKE_FONT::STROKE_FONT( GAL* aGal ) :
m_gal( aGal ),
@@ -81,8 +83,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
if( i < 2 )
{
// The first two values contain the width of the char
glyphStartX = ( coordinate[0] - 'R' ) * HERSHEY_SCALE;
glyphEndX = ( coordinate[1] - 'R' ) * HERSHEY_SCALE;
glyphStartX = ( coordinate[0] - 'R' ) * STROKE_FONT_SCALE;
glyphEndX = ( coordinate[1] - 'R' ) * STROKE_FONT_SCALE;
glyphBoundingX = VECTOR2D( 0, glyphEndX - glyphStartX );
}
else if( ( coordinate[0] == ' ' ) && ( coordinate[1] == 'R' ) )
@@ -97,9 +99,9 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
{
// Every coordinate description of the Hershey format has an offset,
// it has to be subtracted
point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX;
point.x = (double) ( coordinate[0] - 'R' ) * STROKE_FONT_SCALE - glyphStartX;
// -10 is here to keep GAL rendering consistent with the legacy gfx stuff
point.y = (double) ( coordinate[1] - 'R' - 10) * HERSHEY_SCALE;
point.y = (double) ( coordinate[1] - 'R' - 10) * STROKE_FONT_SCALE;
pointList.push_back( point );
}
@@ -121,7 +123,7 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
int STROKE_FONT::getInterline() const
{
return ( m_glyphSize.y * 14 ) / 10 + m_gal->GetLineWidth();
return KiROUND( m_glyphSize.y * INTERLINE_PITCH_RATIO ) + m_gal->GetLineWidth();
}
@@ -307,11 +309,11 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
{
if( m_mirrored )
{
overbar_italic_comp = (-m_glyphSize.y * OVERBAR_HEIGHT) / 8;
overbar_italic_comp = (-m_glyphSize.y * OVERBAR_HEIGHT) / ITALIC_TILT;
}
else
{
overbar_italic_comp = (m_glyphSize.y * OVERBAR_HEIGHT) / 8;
overbar_italic_comp = (m_glyphSize.y * OVERBAR_HEIGHT) / ITALIC_TILT;
}
}
+17 -5
View File
@@ -121,14 +121,26 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_CIRCLE& aB, int aC
static VECTOR2I pushoutForce( const SHAPE_CIRCLE& aA, const SEG& aB, int aClearance )
{
VECTOR2I nearest = aB.NearestPoint( aA.GetCenter() );
VECTOR2I f (0, 0);
VECTOR2I f( 0, 0 );
int dist = ( nearest - aA.GetCenter() ).EuclideanNorm();
int min_dist = aClearance + aA.GetRadius();
const VECTOR2I c = aA.GetCenter();
const VECTOR2I nearest = aB.NearestPoint( c );
const int r = aA.GetRadius();
int dist = ( nearest - c ).EuclideanNorm();
int min_dist = aClearance + r;
if( dist < min_dist )
f = ( aA.GetCenter() - nearest ).Resize ( min_dist - dist + 10 );
{
for( int corr = 0; corr < 5; corr++ )
{
f = ( aA.GetCenter() - nearest ).Resize( min_dist - dist + corr );
if( aB.Distance( c + f ) >= min_dist )
break;
}
}
return f;
}
+22 -80
View File
@@ -28,33 +28,26 @@
* @brief Functions for file management
*/
// For compilers that support precompilation, includes "wx.h".
#include <fctsys.h>
#include <pgm_base.h>
#include <confirm.h>
#include <common.h>
#include <macros.h>
#include <gestfich.h>
#include <wx/mimetype.h>
#include <wx/filename.h>
#include <wx/dir.h>
// For compilers that support precompilation, includes "wx.h".
#include <fctsys.h>
#include <pgm_base.h>
#include <confirm.h>
#include <common.h>
#include <macros.h>
#include <gestfich.h>
void AddDelimiterString( wxString& string )
{
wxString text;
if( !string.StartsWith( wxT( "\"" ) ) )
text = wxT( "\"" );
text += string;
if( (text.Last() != '"' ) || (text.length() <= 1) )
text += wxT( "\"" );
string = text;
{
string.Prepend ( wxT( "\"" ) );
string.Append ( wxT( "\"" ) );
}
}
@@ -227,6 +220,8 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para
#ifdef __WXMAC__
else
{
AddDelimiterString( fullFileName );
if( !param.IsEmpty() )
fullFileName += wxT( " " ) + param;
@@ -351,8 +346,6 @@ bool OpenPDF( const wxString& file )
{
wxString command;
wxString filename = file;
wxString type;
bool success = false;
Pgm().ReadPdfBrowserInfos();
@@ -363,71 +356,21 @@ bool OpenPDF( const wxString& file )
}
else
{
wxFileType* filetype = NULL;
wxFileType::MessageParameters params( filename, type );
filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );
if( filetype )
success = filetype->GetOpenCommand( &command, params );
command = filetype->GetOpenCommand( filename );
delete filetype;
#ifndef __WINDOWS__
// Bug ? under linux wxWidgets returns acroread as PDF viewer, even if
// it does not exist.
if( command.StartsWith( wxT( "acroread" ) ) ) // Workaround
success = false;
#endif
if( success && !command.IsEmpty() )
{
success = ProcessExecute( command );
if( success )
return success;
}
success = false;
command.clear();
if( !success )
{
#if !defined(__WINDOWS__)
AddDelimiterString( filename );
// here is a list of PDF viewers candidates
static const wxChar* tries[] =
{
wxT( "/usr/bin/evince" ),
wxT( "/usr/bin/okular" ),
wxT( "/usr/bin/gpdf" ),
wxT( "/usr/bin/konqueror" ),
wxT( "/usr/bin/kpdf" ),
wxT( "/usr/bin/xpdf" ),
wxT( "/usr/bin/open" ), // BSD and OSX file & dir opener
wxT( "/usr/bin/xdg-open" ), // Freedesktop file & dir opener
};
for( unsigned ii = 0; ii<DIM(tries); ii++ )
{
if( wxFileExists( tries[ii] ) )
{
command = tries[ii];
command += wxT( ' ' );
command += filename;
break;
}
}
#endif
}
}
if( !command.IsEmpty() )
{
success = ProcessExecute( command );
if( !success )
if( ProcessExecute( command ) )
{
return true;
}
else
{
wxString msg;
msg.Printf( _( "Problem while running the PDF viewer\nCommand is '%s'" ),
@@ -440,10 +383,9 @@ bool OpenPDF( const wxString& file )
wxString msg;
msg.Printf( _( "Unable to find a PDF viewer for <%s>" ), GetChars( filename ) );
DisplayError( NULL, msg );
success = false;
}
return success;
return false;
}
+106 -21
View File
@@ -13,6 +13,9 @@
#include <bezier_curves.h>
#include <math_for_graphics.h>
#include <wx/graphics.h>
#if defined(__WXMAC__) && defined(USE_WX_GRAPHICS_CONTEXT)
#include <wx/dcgraph.h>
#endif
static const bool FILLED = true;
static const bool NOT_FILLED = false;
@@ -429,17 +432,45 @@ void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
if( aClipBox )
aClipBox->Inflate(aWidth/2);
for( unsigned i = 0; i < aLines.size(); i += 2)
#if defined( __WXMAC__ ) && defined( USE_WX_GRAPHICS_CONTEXT )
wxGCDC *gcdc = wxDynamicCast( aDC, wxGCDC );
if( gcdc )
{
int x1 = aLines[i].x;
int y1 = aLines[i].y;
int x2 = aLines[i+1].x;
int y2 = aLines[i+1].y;
GRLastMoveToX = x2;
GRLastMoveToY = y2;
if( ( aClipBox == NULL ) || !clipLine( aClipBox, x1, y1, x2, y2 ) )
aDC->DrawLine( x1, y1, x2, y2 );
wxGraphicsContext *gc = gcdc->GetGraphicsContext();
// create path
wxGraphicsPath path = gc->CreatePath();
for( unsigned i = 0; i < aLines.size(); i += 2 )
{
int x1 = aLines[i].x;
int y1 = aLines[i].y;
int x2 = aLines[i+1].x;
int y2 = aLines[i+1].y;
if( ( aClipBox == NULL ) || !clipLine( aClipBox, x1, y1, x2, y2 ) )
{
path.MoveToPoint( x1, y1 );
path.AddLineToPoint( x2, y2 );
}
}
// draw path
gc->StrokePath( path );
}
else
#endif
{
for( unsigned i = 0; i < aLines.size(); i += 2 )
{
int x1 = aLines[i].x;
int y1 = aLines[i].y;
int x2 = aLines[i+1].x;
int y2 = aLines[i+1].y;
if( ( aClipBox == NULL ) || !clipLine( aClipBox, x1, y1, x2, y2 ) )
aDC->DrawLine( x1, y1, x2, y2 );
}
}
GRMoveTo( aLines[aLines.size() - 1].x, aLines[aLines.size() - 1].y );
if( aClipBox )
aClipBox->Inflate(-aWidth/2);
}
@@ -626,10 +657,36 @@ static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, wxPoint Points[],
}
else
{
GRMoveTo( Points[0].x, Points[0].y );
for( int i = 1; i < n; ++i )
#if defined( __WXMAC__ ) && defined( USE_WX_GRAPHICS_CONTEXT )
wxGCDC *gcdc = wxDynamicCast( DC, wxGCDC );
if( gcdc )
{
GRLineTo( ClipBox, DC, Points[i].x, Points[i].y, width, Color );
wxGraphicsContext *gc = gcdc->GetGraphicsContext();
// set pen
GRSetColorPen( DC, Color, width );
// create path
wxGraphicsPath path = gc->CreatePath();
path.MoveToPoint( Points[0].x, Points[0].y );
for( int i = 1; i < n; ++i )
{
path.AddLineToPoint( Points[i].x, Points[i].y );
}
// draw path
gc->StrokePath( path );
// correctly update last position
GRMoveTo( Points[n - 1].x, Points[n - 1].y );
}
else
#endif
{
GRMoveTo( Points[0].x, Points[0].y );
for( int i = 1; i < n; ++i )
{
GRLineTo( ClipBox, DC, Points[i].x, Points[i].y, width, Color );
}
}
}
}
@@ -657,18 +714,46 @@ static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC,
}
else
{
GRMoveTo( aPoints[0].x, aPoints[0].y );
for( int i = 1; i < aPointCount; ++i )
#if defined( __WXMAC__ ) && defined( USE_WX_GRAPHICS_CONTEXT )
wxGCDC *gcdc = wxDynamicCast( aDC, wxGCDC );
if( gcdc )
{
GRLineTo( aClipBox, aDC, aPoints[i].x, aPoints[i].y, aWidth, aColor );
wxGraphicsContext *gc = gcdc->GetGraphicsContext();
// set pen
GRSetColorPen( aDC, aColor, aWidth );
// create path
wxGraphicsPath path = gc->CreatePath();
path.MoveToPoint( aPoints[0].x, aPoints[0].y );
for( int i = 1; i < aPointCount; ++i )
{
path.AddLineToPoint( aPoints[i].x, aPoints[i].y );
}
if( aPoints[aPointCount - 1] != aPoints[0] )
path.AddLineToPoint( aPoints[0].x, aPoints[0].y );
// draw path
gc->StrokePath( path );
// correctly update last position
GRMoveTo( aPoints[aPointCount - 1].x, aPoints[aPointCount - 1].y );
}
int lastpt = aPointCount - 1;
// Close the polygon
if( aPoints[lastpt] != aPoints[0] )
else
#endif
{
GRLineTo( aClipBox, aDC, aPoints[0].x, aPoints[0].y, aWidth, aColor );
GRMoveTo( aPoints[0].x, aPoints[0].y );
for( int i = 1; i < aPointCount; ++i )
{
GRLineTo( aClipBox, aDC, aPoints[i].x, aPoints[i].y, aWidth, aColor );
}
int lastpt = aPointCount - 1;
// Close the polygon
if( aPoints[lastpt] != aPoints[0] )
{
GRLineTo( aClipBox, aDC, aPoints[0].x, aPoints[0].y, aWidth, aColor );
}
}
}
}
+1
View File
@@ -32,6 +32,7 @@ HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString& aTitle,
wxPoint aPos, wxSize aSize) :
DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, aTitle, aPos, aSize )
{
m_htmlWindow->SetLayoutDirection( wxLayout_LeftToRight );
ListClear();
Center();
}
+224
View File
@@ -0,0 +1,224 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 2016 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* 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
*/
// kicad_curl.h must be included before wx headers, to avoid
// conflicts for some defines, at least on Windows
#include <kicad_curl/kicad_curl.h>
#include <wx/log.h>
#include <wx/dynlib.h>
#include <macros.h>
#include <fctsys.h>
#include <ki_mutex.h> // MUTEX and MUTLOCK
#include <richio.h>
// These are even more private than class members, and since there is only
// one instance of KICAD_CURL ever, these statics are hidden here to simplify the
// client (API) header file.
static volatile bool s_initialized;
static MUTEX s_lock; // for s_initialized
// Assume that on these platforms libcurl uses OpenSSL
#if defined(__linux__) || defined(__MINGW32__)
#include <openssl/crypto.h>
static MUTEX* s_crypto_locks;
static void lock_callback( int mode, int type, const char* file, int line )
{
(void)file;
(void)line;
wxASSERT( s_crypto_locks && unsigned( type ) < unsigned( CRYPTO_num_locks() ) );
//DBG( printf( "%s: mode=0x%x type=%d file=%s line=%d\n", __func__, mode, type, file, line );)
if( mode & CRYPTO_LOCK )
{
s_crypto_locks[ type ].lock();
}
else
{
s_crypto_locks[ type ].unlock();
}
}
static void init_locks()
{
s_crypto_locks = new MUTEX[ CRYPTO_num_locks() ];
// From http://linux.die.net/man/3/crypto_set_id_callback:
/*
OpenSSL can safely be used in multi-threaded applications provided that at
least two callback functions are set, locking_function and threadid_func.
locking_function(int mode, int n, const char *file, int line) is needed to
perform locking on shared data structures. (Note that OpenSSL uses a number
of global data structures that will be implicitly shared whenever multiple
threads use OpenSSL.) Multi-threaded applications will crash at random if it
is not set.
threadid_func( CRYPTO_THREADID *id) is needed to record the
currently-executing thread's identifier into id. The implementation of this
callback should not fill in id directly, but should use
CRYPTO_THREADID_set_numeric() if thread IDs are numeric, or
CRYPTO_THREADID_set_pointer() if they are pointer-based. If the application
does not register such a callback using CRYPTO_THREADID_set_callback(), then
a default implementation is used - on Windows and BeOS this uses the
system's default thread identifying APIs, and on all other platforms it uses
the address of errno. The latter is satisfactory for thread-safety if and
only if the platform has a thread-local error number facility.
Dick: "sounds like CRYPTO_THREADID_set_callback() is not mandatory on our
2 OpenSSL platforms."
*/
CRYPTO_set_locking_callback( &lock_callback );
}
static void kill_locks()
{
CRYPTO_set_locking_callback( NULL );
delete[] s_crypto_locks;
s_crypto_locks = NULL;
}
#else
inline void init_locks() { /* dummy */ }
inline void kill_locks() { /* dummy */ }
#endif
/// At process termination, using atexit() keeps the CURL stuff out of the
/// singletops and PGM_BASE.
static void at_terminate()
{
KICAD_CURL::Cleanup();
}
void KICAD_CURL::Init()
{
// We test s_initialized twice in an effort to avoid
// unnecessarily locking s_lock. This understands that the common case
// will not need to lock.
if( !s_initialized )
{
MUTLOCK lock( s_lock );
if( !s_initialized )
{
if( curl_global_init( CURL_GLOBAL_ALL ) != CURLE_OK )
{
THROW_IO_ERROR( "curl_global_init() failed." );
}
init_locks();
wxLogDebug( "Using %s", GetVersion() );
s_initialized = true;
}
}
}
void KICAD_CURL::Cleanup()
{
/*
Calling MUTLOCK() from a static destructor will typically be bad, since the
s_lock may already have been statically destroyed itself leading to a boost
exception. (Remember C++ does not provide certain sequencing of static
destructor invocation.)
To prevent this we test s_initialized twice, which ensures that the MUTLOCK
is only instantiated on the first call, which should be from
PGM_BASE::destroy() which is first called earlier than static destruction.
Then when called again from the actual PGM_BASE::~PGM_BASE() function,
MUTLOCK will not be instantiated because s_initialized will be false.
*/
if( s_initialized )
{
MUTLOCK lock( s_lock );
if( s_initialized )
{
curl_global_cleanup();
kill_locks();
atexit( &at_terminate );
s_initialized = false;
}
}
}
std::string KICAD_CURL::GetSimpleVersion()
{
if( !s_initialized )
Init();
curl_version_info_data* info = curl_version_info( CURLVERSION_NOW );
std::string res;
if( info->version )
{
res += "libcurl version: " + std::string( info->version );
}
res += " (";
if( info->features & CURL_VERSION_SSL )
{
res += "with SSL - ";
res += std::string( info->ssl_version );
}
else
{
res += "without SSL";
}
res += ")";
return res;
}
+94
View File
@@ -0,0 +1,94 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* 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
*/
#include <kicad_curl/kicad_curl_easy.h>
#include <cstddef>
#include <exception>
#include <stdarg.h>
#include <sstream>
#include <richio.h>
static size_t write_callback( void* contents, size_t size, size_t nmemb, void* userp )
{
size_t realsize = size * nmemb;
std::string* p = (std::string*) userp;
p->append( (const char*) contents, realsize );
return realsize;
}
KICAD_CURL_EASY::KICAD_CURL_EASY() :
m_headers( NULL )
{
// Call KICAD_CURL::Init() from in here everytime, but only the first time
// will incur any overhead. This strategy ensures that libcurl is never loaded
// unless it is needed.
KICAD_CURL::Init();
m_CURL = curl_easy_init();
if( !m_CURL )
{
THROW_IO_ERROR( "Unable to initialize CURL session" );
}
curl_easy_setopt( m_CURL, CURLOPT_WRITEFUNCTION, write_callback );
curl_easy_setopt( m_CURL, CURLOPT_WRITEDATA, (void*) &m_buffer );
}
KICAD_CURL_EASY::~KICAD_CURL_EASY()
{
if( m_headers )
curl_slist_free_all( m_headers );
curl_easy_cleanup( m_CURL );
}
void KICAD_CURL_EASY::Perform()
{
if( m_headers )
{
curl_easy_setopt( m_CURL, CURLOPT_HTTPHEADER, m_headers );
}
// bonus: retain worst case memory allocation, should re-use occur
m_buffer.clear();
CURLcode res = curl_easy_perform( m_CURL );
if( res != CURLE_OK )
{
std::string msg = StrPrintf( "curl_easy_perform()=%d: %s",
res, GetErrorText( res ).c_str() );
THROW_IO_ERROR( msg );
}
}
+1 -1
View File
@@ -212,7 +212,7 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
if( ! wxFileExists( dname ) )
msg << wxT( "It is missing.\n" );
else
msg << wxT( "Perhaps a wxWidgets shared (.dll or .so) file is missing.\n" );
msg << wxT( "Perhaps a shared library (.dll or .so) file is missing.\n" );
msg << wxT( "From command line: argv[0]:\n'" );
msg << wxStandardPaths::Get().GetExecutablePath() << wxT( "'\n" );
+6 -7
View File
@@ -101,14 +101,14 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow
m_modal_resultant_parent = aResultantFocusWindow;
Show( true );
Raise(); // Needed on sole Window managers to always display the frame
Raise(); // Needed on some Window managers to always display the frame
SetFocus();
{
// We have to disable all frames but the the modal one.
// wxWindowDisabler does that, but remember it disables all top level windows
// We do not want to disable top level windows which are child off the modal one,
// wxWindowDisabler does that, but it also disables all top level windows
// We do not want to disable top level windows which are child of the modal one,
// if they are enabled.
// An example is an aui toolbar which was moved
// or a dialog or an other frame or miniframe opened by the modal one.
@@ -119,19 +119,18 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow
if( wlist[ii]->IsTopLevel() && wlist[ii]->IsEnabled() )
enabledTopLevelWindows.push_back( wlist[ii] );
// exception safe way to disable all top level windows except the modal one,
// re-enables only those that were disabled on exit
wxWindowDisabler toggle( this );
wxWindowDisabler toggle( this );
for( unsigned ii = 0; ii < enabledTopLevelWindows.size(); ii++ )
enabledTopLevelWindows[ii]->Enable( true );
enabledTopLevelWindows[ii]->Enable( true );
WX_EVENT_LOOP event_loop;
m_modal_loop = &event_loop;
event_loop.Run();
} // End of scop for some variables.
} // End of scope for some variables.
// End nesting before setting focus below.
if( aResult )
+37 -4
View File
@@ -441,7 +441,7 @@ LSEQ LSET::SeqStackupBottom2Top() const
}
LAYER_ID FlipLayer( LAYER_ID aLayerId )
LAYER_ID FlipLayer( LAYER_ID aLayerId, int aCopperLayersCount )
{
switch( aLayerId )
{
@@ -466,14 +466,28 @@ LAYER_ID FlipLayer( LAYER_ID aLayerId )
case B_Fab: return F_Fab;
case F_Fab: return B_Fab;
// No change for the other layers
default:
default: // change internal layer if aCopperLayersCount is >= 4
if( IsCopperLayer( aLayerId ) && aCopperLayersCount >= 4 )
{
// internal copper layers count is aCopperLayersCount-2
LAYER_ID fliplayer = LAYER_ID(aCopperLayersCount - 2 - ( aLayerId - In1_Cu ) );
// Ensure fliplayer has a value which does not crash pcbnew:
if( fliplayer < F_Cu )
fliplayer = F_Cu;
if( fliplayer > B_Cu )
fliplayer = B_Cu;
return fliplayer;
}
// No change for the other layers
return aLayerId;
}
}
LSET FlipLayerMask( LSET aMask )
LSET FlipLayerMask( LSET aMask, int aCopperLayersCount )
{
// layers on physical outside of a board:
const static LSET and_mask( 16, // !! update count
@@ -537,6 +551,25 @@ LSET FlipLayerMask( LSET aMask )
if( aMask[F_Fab] )
newMask.set( B_Fab );
if( aCopperLayersCount >= 4 ) // Internal layers exist
{
LSET internalMask = aMask & ~LSET::InternalCuMask();
if( internalMask != LSET::InternalCuMask() )
{ // the mask does not include all internal layers. Therefore
// the flipped mask for internal copper layers must be built
int innerLayerCnt = aCopperLayersCount -2;
for( int ii = 0; ii < innerLayerCnt; ii++ )
{
if( internalMask[innerLayerCnt - ii + In1_Cu] )
newMask.set( ii + In1_Cu );
else
newMask.reset( ii + In1_Cu );
}
}
}
return newMask;
}
@@ -142,23 +142,23 @@ const char defaultPageLayout[] = "( page_layout\n"
"(line (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50) )\n"
"(tbtext \"A\" (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50) )\n"
"(tbtext \"Date: %D\" (pos 87 6.9) )\n"
"(line (start 110 5.5) end 2 5.5) )\n"
"(line (start 110 5.5) (end 2 5.5) )\n"
"(tbtext \"%K\" (pos 109 4.1) (comment \"Kicad version\" ) )\n"
"(line (start 110 8.5) end 2 8.5) )\n"
"(line (start 110 8.5) (end 2 8.5) )\n"
"(tbtext \"Rev: %R\" (pos 24 6.9)(font bold)(justify left) )\n"
"(tbtext \"Size: %Z\" (comment \"Paper format name\")(pos 109 6.9) )\n"
"(tbtext \"Id: %S/%N\" (comment \"Sheet id\")(pos 24 4.1) )\n"
"(line (start 110 12.5) end 2 12.5) )\n"
"(line (start 110 12.5) (end 2 12.5) )\n"
"(tbtext \"Title: %T\" (pos 109 10.7)(font bold italic (size 2 2)) )\n"
"(tbtext \"File: %F\" (pos 109 14.3) )\n"
"(line (start 110 18.5) end 2 18.5) )\n"
"(line (start 110 18.5) (end 2 18.5) )\n"
"(tbtext \"Sheet: %P\" (pos 109 17) )\n"
"(tbtext \"%Y\" (comment \"Company name\") (pos 109 20)(font bold) )\n"
"(tbtext \"%C0\" (comment \"Comment 0\") (pos 109 23) )\n"
"(tbtext \"%C1\" (comment \"Comment 1\") (pos 109 26) )\n"
"(tbtext \"%C2\" (comment \"Comment 2\") (pos 109 29) )\n"
"(tbtext \"%C3\" (comment \"Comment 3\") (pos 109 32) )\n"
"(line (start 90 8.5) end 90 5.5) )\n"
"(line (start 26 8.5) end 26 2) )\n"
"(line (start 90 8.5) (end 90 5.5) )\n"
"(line (start 26 8.5) (end 26 2) )\n"
")\n"
;
+33 -1
View File
@@ -70,14 +70,37 @@ private:
double parseDouble();
void parseSetup( WORKSHEET_LAYOUT* aLayout ) throw( IO_ERROR, PARSE_ERROR );
/**
* parse a graphic item starting by "(line" or "(rect" and read parameters.
*/
void parseGraphic( WORKSHEET_DATAITEM * aItem ) throw( IO_ERROR, PARSE_ERROR );
/**
* parse a text item starting by "(tbtext" and read parameters.
*/
void parseText( WORKSHEET_DATAITEM_TEXT * aItem ) throw( IO_ERROR, PARSE_ERROR );
/**
* parse a polygon item starting by "( polygon" and read parameters.
* the list of corners included in this description is read by parsePolyOutline
*/
void parsePolygon( WORKSHEET_DATAITEM_POLYPOLYGON * aItem )
throw( IO_ERROR, PARSE_ERROR );
/**
* parse a list of corners starting by "( pts" and read coordinates.
*/
void parsePolyOutline( WORKSHEET_DATAITEM_POLYPOLYGON * aItem )
throw( IO_ERROR, PARSE_ERROR );
/**
* parse a bitmap item starting by "( bitmap" and read parameters.
*/
void parseBitmap( WORKSHEET_DATAITEM_BITMAP * aItem )
throw( IO_ERROR, PARSE_ERROR );
void parseCoordinate( POINT_COORD& aCoord) throw( IO_ERROR, PARSE_ERROR );
void readOption( WORKSHEET_DATAITEM * aItem ) throw( IO_ERROR, PARSE_ERROR );
void readPngdata( WORKSHEET_DATAITEM_BITMAP * aItem ) throw( IO_ERROR, PARSE_ERROR );
@@ -463,12 +486,21 @@ void PAGE_LAYOUT_READER_PARSER::parseGraphic( WORKSHEET_DATAITEM * aItem )
if( token == T_LEFT )
token = NextTok();
else
{
// If an other token than T_LEFT is read here, this is an error
// however, due to a old bug in kicad, the token T_end can be found
// without T_LEFT in a very few .wks files (perhaps only one in a demo).
// So this ugly hack disables the error detection.
if( token != T_end )
Unexpected( CurText() );
}
switch( token )
{
case T_comment:
NeedSYMBOLorNUMBER();
aItem->m_Info = FromUTF8();
aItem->m_Info = FromUTF8();
NeedRIGHT();
break;
+105 -57
View File
@@ -308,14 +308,13 @@ void PGM_BASE::SetEditorName( const wxString& aFileName )
}
const wxString& PGM_BASE::GetEditorName()
const wxString& PGM_BASE::GetEditorName( bool aCanShowFileChooser )
{
wxString editorname = m_editor_name;
if( !editorname )
{
// Get the preferred editor name from environment variable first.
if(!wxGetEnv( wxT( "EDITOR" ), &editorname ))
if( !wxGetEnv( wxT( "EDITOR" ), &editorname ) )
{
// If there is no EDITOR variable set, try the desktop default
#ifdef __WXMAC__
@@ -326,31 +325,49 @@ const wxString& PGM_BASE::GetEditorName()
}
}
if( !editorname ) // We must get a preferred editor name
// If we still don't have an editor name show a dialog asking the user to select one
if( !editorname && aCanShowFileChooser )
{
DisplayInfoMessage( NULL,
_( "No default editor found, you must choose it" ) );
wxString mask( wxT( "*" ) );
#ifdef __WINDOWS__
mask += wxT( ".exe" );
#endif
editorname = EDA_FILE_SELECTOR( _( "Preferred Editor:" ), wxEmptyString,
wxEmptyString, wxEmptyString, mask,
NULL, wxFD_OPEN, true );
editorname = AskUserForPreferredEditor();
}
// If we finally have a new editor name request it to be copied to m_editor_name and
// saved to the preferences file.
if( !editorname.IsEmpty() )
{
m_editor_name = editorname;
m_common_settings->Write( wxT( "Editor" ), m_editor_name );
}
SetEditorName( editorname );
// m_editor_name already has the same value that editorname, or empty if no editor was
// found/chosen.
return m_editor_name;
}
const wxString PGM_BASE::AskUserForPreferredEditor( const wxString& aDefaultEditor )
{
// Create a mask representing the executable files in the current platform
#ifdef __WINDOWS__
wxString mask( _( "Executable file (*.exe)|*.exe" ) );
#else
wxString mask( _( "Executable file (*)|*" ) );
#endif
// Extract the path, name and extension from the default editor (even if the editor's
// name was empty, this method will succeed and return empty strings).
wxString path, name, ext;
wxFileName::SplitPath( aDefaultEditor, &path, &name, &ext );
// Show the modal editor and return the file chosen (may be empty if the user cancels
// the dialog).
return EDA_FILE_SELECTOR( _( "Select Preferred Editor" ), path,
name, ext, mask,
NULL, wxFD_OPEN | wxFD_FILE_MUST_EXIST,
true );
}
bool PGM_BASE::initPgm()
{
wxFileName pgm_name( App().argv[0] );
@@ -416,6 +433,8 @@ bool PGM_BASE::initPgm()
{
wxString envVarName = wxT( "KIGITHUB" );
ENV_VAR_ITEM envVarItem;
wxString envValue;
wxFileName tmpFileName;
envVarItem.SetValue( wxString( wxT( "https://github.com/KiCad" ) ) );
envVarItem.SetDefinedExternally( wxGetEnv( envVarName, NULL ) );
@@ -429,35 +448,62 @@ bool PGM_BASE::initPgm()
baseSharePath.AppendDir( wxT( "kicad" ) );
#endif
wxFileName tmpFileName = baseSharePath;
tmpFileName.AppendDir( wxT( "modules" ) );
// KISYSMOD
envVarName = wxT( "KISYSMOD" );
envVarItem.SetValue( tmpFileName.GetPath() );
envVarItem.SetDefinedExternally( wxGetEnv( envVarName, NULL ) );
if( wxGetEnv( envVarName, &envValue ) == true && !envValue.IsEmpty() )
{
tmpFileName.AssignDir( envValue );
envVarItem.SetDefinedExternally( true );
}
else
{
tmpFileName = baseSharePath;
tmpFileName.AppendDir( wxT( "modules" ) );
envVarItem.SetDefinedExternally( false );
}
envVarItem.SetValue( tmpFileName.GetFullPath() );
m_local_env_vars[ envVarName ] = envVarItem;
// KISYS3DMOD
envVarName = wxT( "KISYS3DMOD" );
tmpFileName.AppendDir( wxT( "packages3d" ) );
envVarItem.SetValue( tmpFileName.GetPath() );
envVarItem.SetDefinedExternally( wxGetEnv( envVarName, NULL ) );
if( wxGetEnv( envVarName, &envValue ) == true && !envValue.IsEmpty() )
{
tmpFileName.AssignDir( envValue );
envVarItem.SetDefinedExternally( true );
}
else
{
tmpFileName.AppendDir( wxT( "packages3d" ) );
envVarItem.SetDefinedExternally( false );
}
envVarItem.SetValue( tmpFileName.GetFullPath() );
m_local_env_vars[ envVarName ] = envVarItem;
// KICAD_PTEMPLATES
envVarName = wxT( "KICAD_PTEMPLATES" );
tmpFileName = baseSharePath;
tmpFileName.AppendDir( wxT( "template" ) );
envVarItem.SetValue( tmpFileName.GetPath() );
envVarItem.SetDefinedExternally( wxGetEnv( envVarName, NULL ) );
if( wxGetEnv( envVarName, &envValue ) == true && !envValue.IsEmpty() )
{
tmpFileName.AssignDir( envValue );
envVarItem.SetDefinedExternally( true );
}
else
{
tmpFileName = baseSharePath;
tmpFileName.AppendDir( wxT( "template" ) );
envVarItem.SetDefinedExternally( false );
}
envVarItem.SetValue( tmpFileName.GetFullPath() );
m_local_env_vars[ envVarName ] = envVarItem;
}
ReadPdfBrowserInfos(); // needs m_common_settings
loadCommonSettings();
// Init user language *before* calling loadCommonSettings, because
// env vars could be incorrectly initialized on Linux
// (if the value contains some non ASCII7 chars, the env var is not initialized)
SetLanguage( true );
// Set locale option for separator used in float numbers
SetLocaleTo_Default();
loadCommonSettings();
#ifdef __WXMAC__
// Always show filters on Open dialog to be able to choose plugin
@@ -517,23 +563,8 @@ void PGM_BASE::loadCommonSettings()
m_help_size.x = 500;
m_help_size.y = 400;
wxString languageSel;
m_common_settings->Read( languageCfgKey, &languageSel );
setLanguageId( wxLANGUAGE_DEFAULT );
m_common_settings->Read( showEnvVarWarningDialog, &m_show_env_var_dialog );
// Search for the current selection
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
{
if( s_Languages[ii].m_Lang_Label == languageSel )
{
setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
break;
}
}
m_editor_name = m_common_settings->Read( wxT( "Editor" ) );
wxString entry, oldPath;
@@ -579,7 +610,7 @@ void PGM_BASE::saveCommonSettings()
for( ENV_VAR_MAP_ITER it = m_local_env_vars.begin(); it != m_local_env_vars.end(); ++it )
{
wxLogTrace( traceEnvVars, wxT( "Saving environment varaiable config entry %s as %s" ),
wxLogTrace( traceEnvVars, wxT( "Saving environment variable config entry %s as %s" ),
GetChars( it->first ), GetChars( it->second.GetValue() ) );
m_common_settings->Write( it->first, it->second.GetValue() );
}
@@ -593,6 +624,26 @@ bool PGM_BASE::SetLanguage( bool first_time )
{
bool retv = true;
if( first_time )
{
setLanguageId( wxLANGUAGE_DEFAULT );
// First time SetLanguage is called, the user selected language id is set
// from commun user config settings
wxString languageSel;
m_common_settings->Read( languageCfgKey, &languageSel );
// Search for the current selection
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
{
if( s_Languages[ii].m_Lang_Label == languageSel )
{
setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
break;
}
}
}
// dictionary file name without extend (full name is kicad.mo)
wxString dictionaryName( wxT( "kicad" ) );
@@ -616,9 +667,12 @@ bool PGM_BASE::SetLanguage( bool first_time )
GetChars( dictionaryName ), GetChars( m_locale->GetName() ) );
}
// how about a meaningful comment here.
if( !first_time )
{
// If we are here, the user has selected an other language.
// Therefore the new prefered language name is stored in common config.
// Do NOT store the wxWidgets language Id, it can change between wxWidgets
// versions, for a given language
wxString languageSel;
// Search for the current selection
@@ -639,20 +693,14 @@ bool PGM_BASE::SetLanguage( bool first_time )
double dtst = 0.5;
wxString msg;
extern bool g_DisableFloatingPointLocalNotation; // See common.cpp
g_DisableFloatingPointLocalNotation = false;
msg << dtst;
double result;
msg.ToDouble( &result );
if( result != dtst ) // string to double encode/decode does not work! Bug detected
{
if( result != dtst )
// string to double encode/decode does not work! Bug detected:
// Disable floating point localization:
g_DisableFloatingPointLocalNotation = true;
SetLocaleTo_C_standard( );
}
setlocale( LC_ALL, "C" );
if( !m_locale->IsLoaded( dictionaryName ) )
m_locale->AddCatalog( dictionaryName );
+3 -9
View File
@@ -1,9 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 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
@@ -35,11 +34,6 @@
#endif
// This file defines 3 classes and some functions useful for working with text files
// and is named "richio" after its author, Richard Hollenbeck, aka Dick Hollenbeck.
static int vprint( std::string* result, const char* format, va_list ap )
{
char msg[512];
@@ -106,7 +100,7 @@ std::string StrPrintf( const char* format, ... )
void IO_ERROR::init( const char* aThrowersFile, const char* aThrowersLoc, const wxString& aMsg )
{
errorText.Printf( IO_FORMAT, aMsg.GetData(),
wxString::FromUTF8( aThrowersFile ).GetData(),
wxString::FromUTF8( aThrowersFile ).AfterLast( '/' ).GetData(),
wxString::FromUTF8( aThrowersLoc ).GetData() );
}
@@ -123,7 +117,7 @@ void PARSE_ERROR::init( const char* aThrowersFile, const char* aThrowersLoc,
errorText.Printf( PARSE_FORMAT, aMsg.GetData(), aSource.GetData(),
aLineNumber, aByteIndex,
wxString::FromUTF8( aThrowersFile ).GetData(),
wxString::FromUTF8( aThrowersFile ).AfterLast( '/' ).GetData(),
wxString::FromUTF8( aThrowersLoc ).GetData() );
}
+4 -4
View File
@@ -144,7 +144,6 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
wxBoxSizer* MainBoxSizer = NULL;
wxFlexGridSizer* FlexColumnBoxSizer = NULL;
wxBitmapButton* BitmapButton = NULL;
wxStaticText* Label = NULL;
wxStaticLine* Line = NULL;
wxStdDialogButtonSizer* StdDialogButtonSizer = NULL;
wxButton* Button = NULL;
@@ -215,9 +214,10 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
BitmapButton->SetFocus();
}
Label = new wxStaticText( this, -1, ColorGetName( buttcolor ),
wxDefaultPosition, wxDefaultSize, 0 );
FlexColumnBoxSizer->Add( Label, 1,
wxStaticText* label = new wxStaticText( this, -1,
wxGetTranslation( ColorGetName( buttcolor ) ),
wxDefaultPosition, wxDefaultSize, 0 );
FlexColumnBoxSizer->Add( label, 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxBOTTOM, 5 );
}
-40
View File
@@ -47,42 +47,6 @@
#include <confirm.h>
// The functions we use will cause the program launcher to pull stuff in
// during linkage, keep the map file in mind to see what's going into it.
/// Extend LIB_ENV_VAR list with the directory from which I came, prepending it.
static void set_lib_env_var( const wxString& aAbsoluteArgv0 )
{
// POLICY CHOICE 2: Keep same path, so that installer MAY put the
// "subsidiary DSOs" in the same directory as the kiway top process modules.
// A subsidiary shared library is one that is not a top level DSO, but rather
// some shared library that a top level DSO needs to even be loaded. It is
// a static link to a shared object from a top level DSO.
// This directory POLICY CHOICE 2 is not the only dir in play, since LIB_ENV_VAR
// has numerous path options in it, as does DSO searching on linux, windows, and OSX.
// See "man ldconfig" on linux. What's being done here is for quick installs
// into a non-standard place, and especially for Windows users who may not
// know what the PATH environment variable is or how to set it.
wxFileName fn( aAbsoluteArgv0 );
wxString ld_path( LIB_ENV_VAR );
wxString my_path = fn.GetPath();
wxString new_paths = PrePendPath( ld_path, my_path );
wxSetEnv( ld_path, new_paths );
#if defined(DEBUG)
{
wxString test;
wxGetEnv( ld_path, &test );
printf( "LIB_ENV_VAR:'%s'\n", TO_UTF8( test ) );
}
#endif
}
// Only a single KIWAY is supported in this single_top top level component,
// which is dedicated to loading only a single DSO.
KIWAY Kiway( &Pgm(), KFCTL_STANDALONE );
@@ -223,10 +187,6 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
return false;
}
// Set LIB_ENV_VAR *before* loading the DSO, in case the top-level DSO holding the
// KIFACE has hard dependencies on subsidiary DSOs below it.
set_lib_env_var( absoluteArgv0 );
if( !initPgm() )
return false;
+11
View File
@@ -323,7 +323,18 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
m_toolMgr->ProcessEvent( *evt );
// pass the event to the GUI, it might still be interested in it
#ifdef __APPLE__
// On OS X, key events are always meant to be caught. An uncaught key event is assumed
// to be a user input error by OS X (as they are pressing keys in a context where nothing
// is there to catch the event). This annoyingly makes OS X beep and/or flash the screen
// in pcbnew and the footprint editor any time a hotkey is used. The correct procedure is
// to NOT pass key events to the GUI under OS X.
if( type != wxEVT_CHAR )
aEvent.Skip();
#else
aEvent.Skip();
#endif
updateUI();
}
+3 -1
View File
@@ -66,6 +66,8 @@ void TOOL_INTERACTIVE::goInternal( TOOL_STATE_FUNC& aState, const TOOL_EVENT_LIS
void TOOL_INTERACTIVE::SetContextMenu( CONTEXT_MENU* aMenu, CONTEXT_MENU_TRIGGER aTrigger )
{
aMenu->SetTool( this );
if( aMenu )
aMenu->SetTool( this );
m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
}
+29 -10
View File
@@ -24,7 +24,7 @@
*/
#include <map>
#include <deque>
#include <list>
#include <stack>
#include <algorithm>
@@ -428,11 +428,15 @@ TOOL_BASE* TOOL_MANAGER::FindTool( const std::string& aName ) const
return NULL;
}
void TOOL_MANAGER::ResetTools( TOOL_BASE::RESET_REASON aReason )
void TOOL_MANAGER::DeactivateTool()
{
TOOL_EVENT evt( TC_COMMAND, TA_ACTIVATE, "" ); // deactivate the active tool
ProcessEvent( evt );
}
void TOOL_MANAGER::ResetTools( TOOL_BASE::RESET_REASON aReason )
{
DeactivateTool();
BOOST_FOREACH( TOOL_BASE* tool, m_toolState | boost::adaptors::map_keys )
{
@@ -446,7 +450,7 @@ int TOOL_MANAGER::GetPriority( int aToolId ) const
{
int priority = 0;
for( std::deque<int>::const_iterator it = m_activeTools.begin(),
for( std::list<TOOL_ID>::const_iterator it = m_activeTools.begin(),
itEnd = m_activeTools.end(); it != itEnd; ++it )
{
if( *it == aToolId )
@@ -490,9 +494,12 @@ optional<TOOL_EVENT> TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool,
void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
{
// iterate over all registered tools
BOOST_FOREACH( TOOL_ID toolId, m_activeTools )
for( std::list<TOOL_ID>::iterator it = m_activeTools.begin();
it != m_activeTools.end(); /* iteration is done inside */)
{
TOOL_STATE* st = m_toolIdIndex[toolId];
std::list<TOOL_ID>::iterator curIt = it;
TOOL_STATE* st = m_toolIdIndex[*it];
++it; // it might be overwritten, if the tool is removed the m_activeTools list
// the tool state handler is waiting for events (i.e. called Wait() method)
if( st->pendingWait )
@@ -508,7 +515,10 @@ void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
st->waitEvents.clear();
if( st->cofunc && !st->cofunc->Resume() )
finishTool( st ); // The couroutine has finished
{
if( finishTool( st, false ) ) // The couroutine has finished
it = m_activeTools.erase( curIt );
}
// If the tool did not request to propagate
// the event to other tools, we should stop it now
@@ -636,8 +646,10 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
}
void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
bool TOOL_MANAGER::finishTool( TOOL_STATE* aState, bool aDeactivate )
{
bool shouldDeactivate = false;
// Reset VIEW_CONTROLS only if the most recent tool is finished
if( m_activeTools.empty() || m_activeTools.front() == aState->theTool->GetId() )
m_viewControls->Reset();
@@ -645,14 +657,21 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
if( !aState->Pop() ) // if there are no other contexts saved on the stack
{
// find the tool and deactivate it
std::deque<TOOL_ID>::iterator tool = std::find( m_activeTools.begin(), m_activeTools.end(),
std::list<TOOL_ID>::iterator tool = std::find( m_activeTools.begin(), m_activeTools.end(),
aState->theTool->GetId() );
if( tool != m_activeTools.end() )
m_activeTools.erase( tool );
{
shouldDeactivate = true;
if( aDeactivate )
m_activeTools.erase( tool );
}
}
aState->theTool->SetTransitions();
return shouldDeactivate;
}
+21 -8
View File
@@ -3,6 +3,8 @@
*
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2013-2015 CERN
* Copyright (C) 2012-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@@ -96,20 +98,31 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
{
const double wheelPanSpeed = 0.001;
if( aEvent.ControlDown() || aEvent.ShiftDown() )
if( aEvent.ControlDown() || aEvent.ShiftDown() || m_enableMousewheelPan )
{
// Scrolling
VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
double scrollSpeed;
int axis = aEvent.GetWheelAxis();
double scrollX = 0.0;
double scrollY = 0.0;
if( std::abs( scrollVec.x ) > std::abs( scrollVec.y ) )
scrollSpeed = scrollVec.x;
if ( m_enableMousewheelPan )
{
if ( axis == wxMOUSE_WHEEL_HORIZONTAL )
scrollX = scrollVec.x;
else
scrollY = -scrollVec.y;
}
else
scrollSpeed = scrollVec.y;
{
if ( aEvent.ControlDown() )
scrollX = -scrollVec.x;
else
scrollY = -scrollVec.y;
}
VECTOR2D delta( aEvent.ControlDown() ? -scrollSpeed : 0.0,
aEvent.ShiftDown() ? -scrollSpeed : 0.0 );
VECTOR2D delta( scrollX, scrollY );
m_view->SetCenter( m_view->GetCenter() + delta );
}
@@ -121,7 +134,7 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
int rotation = aEvent.GetWheelRotation();
double zoomScale;
#ifdef __APPLE__
#ifdef __WXMAC__
// The following is to support Apple pointer devices (MagicMouse &
// Macbook touchpad), which send events more frequently, but with smaller
// wheel rotation.
+2
View File
@@ -56,6 +56,8 @@ set( CVPCB_SRCS
if( MINGW )
# CVPCB_RESOURCES variable is set by the macro.
mingw_resource_compiler( cvpcb )
else()
set( CVPCB_RESOURCES cvpcb.rc )
endif()
+31 -18
View File
@@ -53,7 +53,7 @@
* put text in aTarget
* return a pointer to the last read char (the second quote if OK)
*/
wxString GetQuotedText( wxString & text )
wxString GetQuotedText( wxString& text )
{
int i = text.Find( QUOTE );
@@ -82,7 +82,7 @@ bool sortListbyCmpValue( const FOOTPRINT_EQUIVALENCE& ref, const FOOTPRINT_EQUIV
// read the .equ files and populate the list of equivalents
int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages )
{
char Line[1024];
char line[1024];
int error_count = 0;
FILE* file;
wxFileName fn;
@@ -136,17 +136,18 @@ int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wx
continue;
}
while( GetLine( file, Line, NULL, sizeof(Line) ) != NULL )
while( GetLine( file, line, NULL, sizeof( line ) ) != NULL )
{
char* text = Line;
wxString value, footprint, wtext = FROM_UTF8( Line );
value = GetQuotedText( wtext );
if( text == NULL || ( *text == 0 ) || value.IsEmpty() )
if( *line == 0 )
continue;
footprint = GetQuotedText( wtext );
wxString wtext = FROM_UTF8( line );
wxString value = GetQuotedText( wtext );
if( value.IsEmpty() )
continue;
wxString footprint = GetQuotedText( wtext );
if( footprint.IsEmpty() )
continue;
@@ -169,9 +170,7 @@ int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wx
void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
{
FOOTPRINT_EQUIVALENCE_LIST equiv_List;
COMPONENT* component;
wxString msg, error_msg;
size_t ii;
if( m_netlist.IsEmpty() )
return;
@@ -191,15 +190,13 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
// Now, associate each free component with a footprint, when the association
// is found in list
m_skipComponentSelect = true;
ii = 0;
error_msg.Empty();
for( unsigned kk = 0; kk < m_netlist.GetCount(); kk++ )
{
component = m_netlist.GetComponent( kk );
COMPONENT* component = m_netlist.GetComponent( kk );
bool found = false;
m_compListBox->SetSelection( ii++, true );
if( !component->GetFPID().empty() ) // the component has already a footprint
continue;
@@ -208,6 +205,8 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
// When happens, using the footprint filter of components can remove the ambiguity by
// filtering equivItem so one can use multiple equiv_List (for polar and
// non-polar caps for example)
wxString fpid_candidate;
for( unsigned idx = 0; idx < equiv_List.size(); idx++ )
{
FOOTPRINT_EQUIVALENCE& equivItem = equiv_List[idx];
@@ -232,13 +231,19 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
// If the equivalence is unique, no ambiguity: use the association
if( module && equ_is_unique )
{
SetNewPkg( equivItem.m_FootprintFPID );
SetNewPkg( equivItem.m_FootprintFPID, kk );
found = true;
break;
}
// Store the first candidate found in list, when equivalence is not unique
// We use it later.
if( module && fpid_candidate.IsEmpty() )
fpid_candidate = equivItem.m_FootprintFPID;
// The equivalence is not unique: use the footprint filter to try to remove
// ambiguity
// if the footprint filter does not remove ambiguity, we will use fpid_candidate
if( module )
{
size_t filtercount = component->GetFootprintFilters().GetCount();
@@ -264,13 +269,18 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
if( found )
{
SetNewPkg( equivItem.m_FootprintFPID );
SetNewPkg( equivItem.m_FootprintFPID, kk );
break;
}
}
if( found )
continue;
else if( !fpid_candidate.IsEmpty() )
{
SetNewPkg( fpid_candidate, kk );
continue;
}
// obviously the last chance: there's only one filter matching one footprint
if( 1 == component->GetFootprintFilters().GetCount() )
@@ -280,7 +290,9 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
const FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( component->GetFootprintFilters()[0] );
if( module )
SetNewPkg( component->GetFootprintFilters()[0] );
{
SetNewPkg( component->GetFootprintFilters()[0], kk );
}
}
}
@@ -288,4 +300,5 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
wxMessageBox( error_msg, _( "CvPcb Warning" ), wxOK | wxICON_WARNING, this );
m_skipComponentSelect = false;
m_compListBox->Refresh();
}
+9
View File
@@ -199,11 +199,20 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
if( m_footprintList.IsEmpty() )
return;
// On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
// are opened and refreshed when a new footprint is selected.
// If the listbox has the focus before selecting a new footprint, it will be forced
// after selection.
bool hasFocus = HasFocus();
// If the footprint view window is displayed, update the footprint.
if( GetParent()->GetFpViewerFrame() )
GetParent()->CreateScreenCmp();
GetParent()->DisplayStatus();
if( hasFocus )
SetFocus();
}
+6 -8
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
@@ -80,7 +80,6 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AutomaticFootprintMatching )
EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile )
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
@@ -480,6 +479,7 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
if( tableChanged )
{
wxBusyCursor dummy;
BuildLIBRARY_LISTBOX();
m_footprints.ReadFootprintFiles( Prj().PcbFootprintLibs() );
}
@@ -499,12 +499,6 @@ void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
}
void CVPCB_MAINFRAME::DisplayDocFile( wxCommandEvent& event )
{
GetAssociatedDocument( this, m_DocModulesFileName, &Kiface().KifaceSearch() );
}
void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
{
if( m_skipComponentSelect )
@@ -689,7 +683,11 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
return false;
}
{
wxBusyCursor dummy; // Let the user know something is happening.
m_footprints.ReadFootprintFiles( fptbl );
}
if( m_footprints.GetErrorCount() )
{
+11 -4
View File
@@ -164,8 +164,6 @@ public:
*/
void AutomaticFootprintMatching( wxCommandEvent& event );
void DisplayDocFile( wxCommandEvent& event );
/**
* Function OnSelectFilteringFootprint
* is the command event handler for enabling and disabling footprint filtering.
@@ -176,12 +174,21 @@ public:
/**
* Function SetNewPkg
* links the footprint to the current selected component
* set the footprint name for all selected components in component list
* and selects the next component.
* @param aFootprintName = the selected footprint
* @param aFootprintName = the new footprint name
*/
void SetNewPkg( const wxString& aFootprintName );
/**
* Function SetNewPkg
* Set the footprint name for the component of position aIndex in the component list
*
* @param aFootprintName = the new footprint name
* @param aIndex = the index of the component to modify in the component list
*/
void SetNewPkg( const wxString& aFootprintName, int aIndex );
void BuildCmpListBox();
void BuildFOOTPRINTS_LISTBOX();
void BuildLIBRARY_LISTBOX();
@@ -40,7 +40,7 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(
wxStaticBoxSizer* sbSizerViewOpt;
sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL );
m_IsZoomNoCenter = new wxCheckBox( this, wxID_ANY, _("Do not center and warp cusor on zoom"), wxDefaultPosition, wxDefaultSize, 0 );
m_IsZoomNoCenter = new wxCheckBox( this, wxID_ANY, _("Do not center and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 );
m_IsZoomNoCenter->SetToolTip( _("Keep the cursor at its current location when zooming") );
sbSizerViewOpt->Add( m_IsZoomNoCenter, 0, wxEXPAND|wxALL, 5 );
@@ -513,7 +513,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Do not center and warp cusor on zoom</property>
<property name="label">Do not center and warp cursor on zoom</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
+5 -4
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 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
@@ -91,9 +91,10 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
KiBitmap( editor_xpm ) );
AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
_( "Edit &Equ Files List" ),
_( "Setup equ files list (.equ files)\n"
"They are files which give the footprint name from the component value"),
_( "Footprint &Association Files" ),
_( "Configure footprint association file (.equ) list."
"These files are used to automatically assign"
"the footprint name from the component value" ),
KiBitmap( library_table_xpm ) );
// Language submenu
+50 -28
View File
@@ -48,7 +48,6 @@
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
{
COMPONENT* component;
bool hasFootprint = false;
int componentIndex;
if( m_netlist.IsEmpty() )
@@ -71,34 +70,8 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
if( component == NULL )
return;
// Check to see if the component has already a footprint set.
hasFootprint = !component->GetFPID().empty();
SetNewPkg( aFootprintName, componentIndex );
FPID fpid;
if( !aFootprintName.IsEmpty() )
{
wxCHECK_RET( fpid.Parse( aFootprintName ) < 0,
wxString::Format( wxT( "<%s> is not a valid FPID." ),
GetChars( aFootprintName ) ) );
}
component->SetFPID( fpid );
// create the new component description
wxString description = wxString::Format( CMP_FORMAT, componentIndex + 1,
GetChars( component->GetReference() ),
GetChars( component->GetValue() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
// If the component hasn't had a footprint associated with it
// it now has, so we decrement the count of components without
// a footprint assigned.
if( !hasFootprint )
m_undefinedComponentCnt -= 1;
// Set the new description and deselect the processed component
m_compListBox->SetString( componentIndex, description );
m_compListBox->SetSelection( componentIndex, false );
}
@@ -116,6 +89,55 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
}
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName, int aIndex )
{
COMPONENT* component;
if( m_netlist.IsEmpty() )
return;
component = m_netlist.GetComponent( aIndex );
if( component == NULL )
return;
// Check to see if the component has already a footprint set.
bool hasFootprint = !component->GetFPID().empty();
FPID fpid;
if( !aFootprintName.IsEmpty() )
{
wxCHECK_RET( fpid.Parse( aFootprintName ) < 0,
wxString::Format( wxT( "<%s> is not a valid FPID." ),
GetChars( aFootprintName ) ) );
}
component->SetFPID( fpid );
// create the new component description
wxString description = wxString::Format( CMP_FORMAT, aIndex + 1,
GetChars( component->GetReference() ),
GetChars( component->GetValue() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
// If the component hasn't had a footprint associated with it
// it now has, so we decrement the count of components without
// a footprint assigned.
if( !hasFootprint )
m_undefinedComponentCnt -= 1;
// Set the new description and deselect the processed component
m_compListBox->SetString( aIndex, description );
// Mark this "session" as modified
m_modified = true;
// update the statusbar
DisplayStatus();
}
/// Return true if the resultant FPID has a certain nickname. The guess
/// is only made if this footprint resides in only one library.
/// @return int - 0 on success, 1 on not found, 2 on ambiguous i.e. multiple matches
+2 -7
View File
@@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2007-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2007-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
@@ -79,11 +79,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
KiBitmap( delete_association_xpm ),
_( "Delete all associations (links)" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString,
KiBitmap( datasheet_xpm ),
_( "Display footprint documentation" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
KiBitmap( module_filtered_list_xpm ),
+140 -190
View File
@@ -1,191 +1,141 @@
( page_layout
( setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) )
( rect (comment "rect around the title block") (linewidth 0.15) (start 110 34) (end 2 2) )
( rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )
( line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )
( tbtext "1" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) )
( line (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50) )
( tbtext "1" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )
( line (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50) )
( tbtext "A" (pos 1 25 ltcorner) (font (size 1.3 1.3))
(justify center)(repeat 100) (incry 50) )
( line (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50) )
( tbtext "A" (pos 1 25 rtcorner) (font (size 1.3 1.3))
(justify center) (repeat 100) (incry 50) )
( tbtext "Date: %D" (pos 87 6.9) )
( line (start 110 5.5) end 2 5.5) )
( tbtext "%K" (pos 109 4.1) (comment "Kicad version" ) )
( line (start 110 8.5) end 2 8.5) )
( tbtext "Rev: %R" (pos 24 6.9)(font bold)(justify left) )
( tbtext "Size: %Z" (comment "Paper format name")(pos 109 6.9) )
( tbtext "Id: %S/%N" (comment "Sheet id")(pos 24 4.1) )
( line (start 110 12.5) end 2 12.5) )
( tbtext "Title: %T" (pos 109 10.7)(font bold (size 2 2)) )
( tbtext "File: %F" (pos 109 14.3) )
( line (start 110 18.5) end 2 18.5) )
( tbtext "Sheet: %P" (pos 109 17) )
( tbtext "%Y" (comment "Company name") (pos 109 20)(font bold) )
( tbtext "%C0" (comment "Comment 0") (pos 109 23) )
( tbtext "%C1" (comment "Comment 1") (pos 109 26) )
( tbtext "%C2" (comment "Comment 2") (pos 109 29) )
( tbtext "%C3" (comment "Comment 3") (pos 109 32) )
( line (start 90 8.5) (end 90 5.5) )
( line (start 26 8.5) (end 26 2) )
( rect (comment "rect around the logo") (linewidth 0.15) (start 157 34) (end 110 2) )
(polygon (pos 134 18 rbcorner) (rotate 20) (linewidth 0.00254)
(pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932)
(xy 19.71802 5.92328) (xy 19.69262 5.83946) (xy 19.66976 5.72262) (xy 19.65198 5.56006)
(xy 19.63674 5.33908) (xy 19.6215 5.04952) (xy 19.61134 4.67614) (xy 19.60372 4.20624)
(xy 19.5961 3.62712) (xy 19.58848 2.92862) (xy 19.5834 2.09296) (xy 19.57832 1.11252)
(xy 19.57578 0.27432) (xy 19.55038 -5.16636) (xy 18.15592 -5.16636) (xy 17.69364 -5.16382)
(xy 17.29232 -5.15874) (xy 16.98752 -5.15112) (xy 16.80464 -5.14096) (xy 16.764 -5.13334)
(xy 16.79194 -5.0419) (xy 16.8656 -4.85648) (xy 16.891 -4.79806) (xy 16.93672 -4.64312)
(xy 16.97228 -4.42468) (xy 16.99514 -4.11734) (xy 17.01038 -3.69824) (xy 17.01546 -3.14198)
(xy 17.018 -2.82702) (xy 17.01546 -2.25806) (xy 17.01292 -1.83896) (xy 17.0053 -1.5494)
(xy 16.99006 -1.36652) (xy 16.9672 -1.27508) (xy 16.93164 -1.25222) (xy 16.88592 -1.28016)
(xy 16.8656 -1.29794) (xy 16.47444 -1.5494) (xy 15.96644 -1.71704) (xy 15.3797 -1.7907)
(xy 15.2527 -1.79324) (xy 14.53134 -1.71958) (xy 13.89634 -1.50622) (xy 13.35278 -1.14808)
(xy 12.9032 -0.65024) (xy 12.5476 -0.0127) (xy 12.28598 0.762) (xy 12.22756 1.016)
(xy 12.1539 1.50368) (xy 12.11326 2.07264) (xy 12.10564 2.667) (xy 12.13104 3.23342)
(xy 12.18692 3.71348) (xy 12.2301 3.91668) (xy 12.49934 4.66344) (xy 12.88288 5.2959)
(xy 13.36802 5.8039) (xy 13.94968 6.17982) (xy 14.39164 6.35508) (xy 14.76248 6.41858)
(xy 15.21968 6.4262) (xy 15.69466 6.38302) (xy 16.11376 6.29158) (xy 16.20266 6.2611)
(xy 16.49984 6.1341) (xy 16.76146 5.99694) (xy 16.87576 5.92074) (xy 17.06118 5.7912)
(xy 17.15262 5.78104) (xy 17.1831 5.9055) (xy 17.18564 6.00964) (xy 17.18564 6.26364)
(xy 18.542 6.26364) (xy 19.9009 6.26364) (xy 19.9009 8.382) (xy 11.51636 8.382)
(xy 11.51636 6.26364) (xy 11.3665 6.03504) (xy 11.32586 5.9563) (xy 11.2903 5.84962)
(xy 11.26236 5.69468) (xy 11.24204 5.4737) (xy 11.22172 5.17144) (xy 11.20648 4.76504)
(xy 11.19124 4.2418) (xy 11.17854 3.57886) (xy 11.16838 3.00736) (xy 11.1506 2.16408)
(xy 11.13282 1.47066) (xy 11.10996 0.90932) (xy 11.07694 0.45974) (xy 11.03122 0.10414)
(xy 10.97026 -0.1778) (xy 10.89152 -0.40386) (xy 10.78738 -0.59436) (xy 10.6553 -0.76962)
(xy 10.49274 -0.94234) (xy 10.40892 -1.0287) (xy 9.93394 -1.38684) (xy 9.34212 -1.63576)
(xy 8.64616 -1.77546) (xy 7.85622 -1.80086) (xy 6.99262 -1.7145) (xy 6.31952 -1.57988)
(xy 5.92836 -1.48844) (xy 5.58038 -1.41478) (xy 5.31622 -1.36906) (xy 5.19938 -1.35636)
(xy 5.0419 -1.32588) (xy 4.99364 -1.27254) (xy 5.02666 -1.1557) (xy 5.10794 -0.92964)
(xy 5.22224 -0.635) (xy 5.35432 -0.31496) (xy 5.48132 -0.01524) (xy 5.588 0.22098)
(xy 5.65658 0.35052) (xy 5.6642 0.36068) (xy 5.76834 0.36322) (xy 5.98424 0.31496)
(xy 6.26872 0.22098) (xy 6.3119 0.2032) (xy 6.83768 0.04572) (xy 7.3406 -0.03048)
(xy 7.79018 -0.0254) (xy 8.14324 0.0635) (xy 8.2677 0.13462) (xy 8.49376 0.40132)
(xy 8.60044 0.68326) (xy 8.69188 1.05664) (xy 7.66826 1.10744) (xy 6.97738 1.16078)
(xy 6.41096 1.24968) (xy 5.92836 1.3843) (xy 5.49148 1.5748) (xy 5.24764 1.70942)
(xy 4.77012 2.08534) (xy 4.4196 2.54762) (xy 4.19608 3.0734) (xy 4.09448 3.63474)
(xy 4.11988 4.20878) (xy 4.26974 4.76758) (xy 4.54406 5.28828) (xy 4.9403 5.74294)
(xy 5.31876 6.02742) (xy 5.85978 6.2738) (xy 6.47954 6.40588) (xy 7.12724 6.42112)
(xy 7.74954 6.30936) (xy 7.75208 6.30936) (xy 8.06958 6.18744) (xy 8.37438 6.02742)
(xy 8.46582 5.96646) (xy 8.763 5.74802) (xy 8.7884 6.00456) (xy 8.8138 6.26364)
(xy 10.16508 6.26364) (xy 11.51636 6.26364) (xy 11.51636 8.382) (xy 4.13766 8.382)
(xy 4.13766 5.44068) (xy 4.10972 5.36702) (xy 4.0132 5.1816) (xy 3.86334 4.91744)
(xy 3.68046 4.6101) (xy 3.48742 4.29006) (xy 3.29946 3.99034) (xy 3.1369 3.74142)
(xy 3.10896 3.70078) (xy 2.9464 3.46456) (xy 2.65684 3.7211) (xy 2.20726 4.05892)
(xy 1.76276 4.26212) (xy 1.27254 4.34848) (xy 1.05664 4.3561) (xy 0.70104 4.34594)
(xy 0.43942 4.29768) (xy 0.19558 4.19862) (xy 0.05842 4.11988) (xy -0.38862 3.76682)
(xy -0.75946 3.28168) (xy -1.03378 2.7051) (xy -1.07188 2.58572) (xy -1.143 2.30378)
(xy -1.19126 1.98374) (xy -1.21666 1.58496) (xy -1.22936 1.0668) (xy -1.22936 0.889)
(xy -1.22428 0.381) (xy -1.21158 0) (xy -1.17856 -0.30226) (xy -1.12776 -0.56896)
(xy -1.04902 -0.84328) (xy -1.02108 -0.92964) (xy -0.75438 -1.53416) (xy -0.3937 -2.01676)
(xy 0.04318 -2.36474) (xy 0.54864 -2.57048) (xy 0.99822 -2.62636) (xy 1.54686 -2.55524)
(xy 2.05486 -2.35712) (xy 2.35712 -2.15138) (xy 2.5527 -1.98882) (xy 2.68986 -1.88468)
(xy 2.7305 -1.86436) (xy 2.794 -1.9304) (xy 2.92608 -2.10312) (xy 3.10388 -2.35458)
(xy 3.30962 -2.65176) (xy 3.51536 -2.96164) (xy 3.70586 -3.25374) (xy 3.85318 -3.4925)
(xy 3.94208 -3.64998) (xy 3.95732 -3.69316) (xy 3.86588 -3.74396) (xy 3.66268 -3.85064)
(xy 3.3782 -3.99288) (xy 3.22326 -4.06654) (xy 2.54508 -4.36118) (xy 1.92532 -4.5466)
(xy 1.31318 -4.64058) (xy 0.87122 -4.65836) (xy 0.02286 -4.59232) (xy -0.7493 -4.38912)
(xy -1.46558 -4.0386) (xy -2.15392 -3.5306) (xy -2.38252 -3.32232) (xy -2.9464 -2.70764)
(xy -3.37312 -2.04978) (xy -3.6957 -1.30302) (xy -3.82524 -0.87376) (xy -3.94208 -0.26924)
(xy -4.00304 0.43434) (xy -4.00812 1.17348) (xy -3.95986 1.88976) (xy -3.85572 2.52222)
(xy -3.82524 2.64922) (xy -3.51028 3.53314) (xy -3.07848 4.32562) (xy -2.53746 5.0165)
(xy -1.905 5.588) (xy -1.19126 6.02488) (xy -0.44958 6.30682) (xy 0.01016 6.39064)
(xy 0.57404 6.4262) (xy 1.17856 6.41604) (xy 1.76276 6.3627) (xy 2.26822 6.26364)
(xy 2.286 6.25856) (xy 2.72288 6.11124) (xy 3.23088 5.90296) (xy 3.73888 5.66166)
(xy 4.13766 5.44068) (xy 4.13766 8.382) (xy 0 8.382) (xy -4.74218 8.382)
(xy -4.74218 1.7653) (xy -4.74218 0.71882) (xy -4.74218 -0.55118) (xy -4.74218 -1.66116)
(xy -4.74218 -2.62382) (xy -4.74472 -3.44678) (xy -4.7498 -4.14528) (xy -4.75742 -4.7244)
(xy -4.77012 -5.19938) (xy -4.79044 -5.57784) (xy -4.81584 -5.87248) (xy -4.84886 -6.09346)
(xy -4.8895 -6.2484) (xy -4.94284 -6.35254) (xy -5.0038 -6.4135) (xy -5.07746 -6.44144)
(xy -5.16382 -6.44906) (xy -5.26542 -6.44398) (xy -5.37972 -6.4389) (xy -5.40512 -6.4389)
(xy -5.6515 -6.4516) (xy -5.79374 -6.51002) (xy -5.90042 -6.65734) (xy -5.969 -6.79958)
(xy -6.23062 -7.1755) (xy -6.57606 -7.4295) (xy -6.97738 -7.56158) (xy -7.40156 -7.57682)
(xy -7.81558 -7.47014) (xy -8.1915 -7.24662) (xy -8.49376 -6.90626) (xy -8.58774 -6.73354)
(xy -8.72998 -6.43636) (xy -14.05382 -6.43636) (xy -15.14602 -6.43636) (xy -16.08074 -6.43382)
(xy -16.87068 -6.43128) (xy -17.52854 -6.42874) (xy -18.06702 -6.42112) (xy -18.49628 -6.4135)
(xy -18.83156 -6.40334) (xy -19.08302 -6.39064) (xy -19.2659 -6.3754) (xy -19.38782 -6.35508)
(xy -19.46402 -6.33222) (xy -19.50974 -6.30428) (xy -19.50974 -6.30174) (xy -19.53514 -6.26618)
(xy -19.55546 -6.1976) (xy -19.57324 -6.08838) (xy -19.59102 -5.92582) (xy -19.60372 -5.69976)
(xy -19.61388 -5.40004) (xy -19.6215 -5.0165) (xy -19.62912 -4.53644) (xy -19.6342 -3.95224)
(xy -19.63928 -3.24866) (xy -19.64182 -2.41808) (xy -19.64182 -1.4478) (xy -19.64436 -0.32766)
(xy -19.64436 0.71882) (xy -19.64436 1.9685) (xy -19.64182 3.06324) (xy -19.64182 4.00812)
(xy -19.63928 4.81584) (xy -19.6342 5.49656) (xy -19.62912 6.06552) (xy -19.6215 6.52526)
(xy -19.61134 6.8961) (xy -19.60118 7.18058) (xy -19.58848 7.39394) (xy -19.5707 7.54634)
(xy -19.55292 7.64794) (xy -19.53006 7.71144) (xy -19.50974 7.73938) (xy -19.47418 7.76224)
(xy -19.4056 7.7851) (xy -19.29892 7.80288) (xy -19.1389 7.81812) (xy -18.91538 7.83082)
(xy -18.62074 7.84098) (xy -18.24228 7.85114) (xy -17.76984 7.85622) (xy -17.1958 7.86384)
(xy -16.50238 7.86638) (xy -15.68704 7.86892) (xy -14.732 7.87146) (xy -13.63218 7.87146)
(xy -12.37488 7.87146) (xy -12.192 7.874) (xy -10.91438 7.87146) (xy -9.79424 7.87146)
(xy -8.82142 7.86892) (xy -7.98576 7.86638) (xy -7.2771 7.86384) (xy -6.68782 7.85876)
(xy -6.20014 7.85114) (xy -5.81152 7.84352) (xy -5.50672 7.83336) (xy -5.27304 7.81812)
(xy -5.1054 7.80542) (xy -4.9911 7.78764) (xy -4.91998 7.76732) (xy -4.87934 7.74192)
(xy -4.8768 7.73938) (xy -4.8514 7.70128) (xy -4.83108 7.6327) (xy -4.8133 7.52348)
(xy -4.79552 7.36092) (xy -4.78282 7.1374) (xy -4.77266 6.83768) (xy -4.76504 6.45414)
(xy -4.75742 5.97408) (xy -4.75234 5.38734) (xy -4.74726 4.6863) (xy -4.74472 3.85318)
(xy -4.74472 2.88544) (xy -4.74218 1.7653) (xy -4.74218 8.382) (xy -20.574 8.382)
(xy -20.574 0) (xy -20.574 -8.382) (xy 0 -8.382) (xy 20.574 -8.382)
(xy 20.574 0) (xy 20.574 8.382) (xy 20.574 8.382))
(pts (xy -9.4742 6.26364) (xy -11.25728 6.26364) (xy -13.04036 6.26364) (xy -13.04036 6.0071)
(xy -13.07846 5.76072) (xy -13.17752 5.48386) (xy -13.20038 5.4356) (xy -13.28674 5.29336)
(xy -13.45692 5.0419) (xy -13.68806 4.70662) (xy -13.96746 4.31292) (xy -14.27226 3.88112)
(xy -14.58976 3.4417) (xy -14.8971 3.02006) (xy -15.1765 2.63652) (xy -15.41526 2.31902)
(xy -15.58798 2.09296) (xy -15.67942 1.98882) (xy -15.7099 2.03454) (xy -15.73022 2.24282)
(xy -15.74038 2.61874) (xy -15.74292 3.15976) (xy -15.7353 3.76682) (xy -15.72514 4.37896)
(xy -15.71244 4.84886) (xy -15.69974 5.19684) (xy -15.67688 5.45084) (xy -15.64894 5.63372)
(xy -15.6083 5.76834) (xy -15.55496 5.88518) (xy -15.5194 5.94614) (xy -15.33144 6.26364)
(xy -16.96974 6.26364) (xy -18.61058 6.26364) (xy -18.45056 5.94868) (xy -18.415 5.87502)
(xy -18.38706 5.78612) (xy -18.36166 5.67182) (xy -18.34134 5.51688) (xy -18.3261 5.30606)
(xy -18.3134 5.02666) (xy -18.30324 4.66598) (xy -18.29816 4.20624) (xy -18.29308 3.63728)
(xy -18.29054 2.94386) (xy -18.29054 2.11328) (xy -18.29054 1.12776) (xy -18.288 0.889)
(xy -18.29054 -0.13208) (xy -18.29054 -0.99568) (xy -18.29308 -1.71958) (xy -18.29562 -2.31394)
(xy -18.30324 -2.79654) (xy -18.31086 -3.18008) (xy -18.32356 -3.47472) (xy -18.3388 -3.70078)
(xy -18.35658 -3.86588) (xy -18.37944 -3.9878) (xy -18.40738 -4.08178) (xy -18.4404 -4.15798)
(xy -18.45056 -4.17322) (xy -18.61058 -4.48818) (xy -17.01038 -4.48818) (xy -16.51 -4.48564)
(xy -16.07566 -4.48056) (xy -15.73022 -4.4704) (xy -15.49908 -4.4577) (xy -15.41018 -4.44246)
(xy -15.44574 -4.3434) (xy -15.53464 -4.16052) (xy -15.55496 -4.12496) (xy -15.61084 -3.9878)
(xy -15.65402 -3.7973) (xy -15.6845 -3.52806) (xy -15.70736 -3.15468) (xy -15.72514 -2.64922)
(xy -15.73276 -2.37236) (xy -15.75054 -1.70434) (xy -15.75816 -1.20396) (xy -15.748 -0.86106)
(xy -15.70228 -0.6731) (xy -15.61084 -0.63754) (xy -15.46098 -0.74422) (xy -15.24 -0.99314)
(xy -14.93266 -1.37668) (xy -14.5288 -1.8923) (xy -14.51102 -1.91516) (xy -14.04112 -2.51714)
(xy -13.67028 -3.00482) (xy -13.39088 -3.39344) (xy -13.18768 -3.70078) (xy -13.0556 -3.94208)
(xy -12.9794 -4.13004) (xy -12.95654 -4.28244) (xy -12.954 -4.29768) (xy -12.954 -4.48818)
(xy -11.23696 -4.48818) (xy -9.51992 -4.48818) (xy -10.07364 -3.91668) (xy -10.25398 -3.7211)
(xy -10.50544 -3.43154) (xy -10.81278 -3.06832) (xy -11.1633 -2.64922) (xy -11.54176 -2.19202)
(xy -11.93038 -1.71704) (xy -12.319 -1.23952) (xy -12.68476 -0.78232) (xy -13.02004 -0.36068)
(xy -13.30452 0.00254) (xy -13.5255 0.2921) (xy -13.66774 0.49022) (xy -13.716 0.57404)
(xy -13.66774 0.66294) (xy -13.53058 0.86868) (xy -13.31976 1.17348) (xy -13.04798 1.55702)
(xy -12.7254 2.00406) (xy -12.3698 2.49428) (xy -11.99388 3.00736) (xy -11.61034 3.5306)
(xy -11.23442 4.0386) (xy -10.87628 4.51866) (xy -10.55116 4.95046) (xy -10.27176 5.31622)
(xy -10.05332 5.59562) (xy -9.91108 5.76834) (xy -9.4742 6.26364) (xy -9.4742 6.26364))
(pts (xy -5.75818 6.23316) (xy -5.83946 6.24332) (xy -6.06044 6.25094) (xy -6.39826 6.25856)
(xy -6.82498 6.26364) (xy -7.239 6.26364) (xy -7.71906 6.2611) (xy -8.13562 6.25856)
(xy -8.4582 6.25094) (xy -8.6614 6.24078) (xy -8.72236 6.23316) (xy -8.69188 6.14172)
(xy -8.61822 5.95376) (xy -8.59536 5.89534) (xy -8.5598 5.72262) (xy -8.52932 5.40512)
(xy -8.50392 4.9657) (xy -8.4836 4.42468) (xy -8.46836 3.81) (xy -8.4582 3.14198)
(xy -8.45566 2.44602) (xy -8.45566 1.74498) (xy -8.46074 1.06172) (xy -8.47344 0.42164)
(xy -8.49122 -0.15494) (xy -8.51408 -0.64262) (xy -8.54202 -1.01854) (xy -8.57504 -1.25984)
(xy -8.59028 -1.31572) (xy -8.7122 -1.61036) (xy -7.36346 -1.61036) (xy -6.01218 -1.61036)
(xy -6.01218 1.99136) (xy -6.01218 2.8956) (xy -6.00964 3.6449) (xy -6.00456 4.2545)
(xy -5.9944 4.74472) (xy -5.98424 5.12572) (xy -5.96646 5.41274) (xy -5.94614 5.6261)
(xy -5.92074 5.77596) (xy -5.89026 5.88264) (xy -5.88518 5.89534) (xy -5.8039 6.09854)
(xy -5.76072 6.22046) (xy -5.75818 6.23316) (xy -5.75818 6.23316))
(pts (xy 8.636 3.4544) (xy 8.62838 3.80238) (xy 8.60298 4.0259) (xy 8.54964 4.17322)
(xy 8.45312 4.28752) (xy 8.4455 4.29514) (xy 8.08736 4.52628) (xy 7.66826 4.64058)
(xy 7.24408 4.62788) (xy 7.05866 4.572) (xy 6.77672 4.37388) (xy 6.5913 4.07924)
(xy 6.5405 3.74142) (xy 6.54558 3.70078) (xy 6.60146 3.45186) (xy 6.68782 3.25882)
(xy 6.70052 3.24104) (xy 6.96468 3.03784) (xy 7.35076 2.88798) (xy 7.81812 2.8067)
(xy 8.0645 2.794) (xy 8.636 2.794) (xy 8.636 3.4544) (xy 8.636 3.4544))
(pts (xy 17.018 4.04876) (xy 16.7259 4.2291) (xy 16.34744 4.3942) (xy 15.94358 4.46024)
(xy 15.56766 4.4196) (xy 15.35938 4.3307) (xy 15.13332 4.15544) (xy 14.9733 3.93192)
(xy 14.86408 3.6322) (xy 14.80058 3.23342) (xy 14.77518 2.70764) (xy 14.77264 2.45364)
(xy 14.79296 1.77546) (xy 14.859 1.23952) (xy 14.97076 0.82296) (xy 15.1384 0.508)
(xy 15.33652 0.29718) (xy 15.66418 0.127) (xy 16.06042 0.08382) (xy 16.48714 0.17018)
(xy 16.68018 0.254) (xy 17.018 0.42672) (xy 17.018 2.23774) (xy 17.018 4.04876)
(xy 17.018 4.04876)) )
(page_layout
(setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)
(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))
(rect (name rect1:Rect) (start 110 34) (end 2 2))
(rect (name rect2:Rect) (start 0 0 ltcorner) (end 0 0) (repeat 2) (incrx 2) (incry 2))
(line (name segm1:Line) (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50))
(tbtext 1 (name text1:Text) (pos 25 1 ltcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50))
(line (name segm2:Line) (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50))
(tbtext 1 (name text2:Text) (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50))
(line (name segm3:Line) (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50))
(tbtext A (name text3:Text) (pos 1 25 ltcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50))
(line (name segm4:Line) (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50))
(tbtext A (name text4:Text) (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50))
(tbtext "Date: %D" (name text5:Text) (pos 87 6.9))
(line (name segm5:Line) (start 110 5.5) (end 2 5.5))
(tbtext %K (name text6:Text) (pos 109 4.1))
(line (name segm6:Line) (start 110 8.5) (end 2 8.5))
(tbtext "Rev: %R" (name text7:Text) (pos 24 6.9) (font bold))
(tbtext "Size: %Z" (name text8:Text) (pos 109 6.9))
(tbtext "Id: %S/%N" (name text9:Text) (pos 24 4.1))
(line (name segm7:Line) (start 110 12.5) (end 2 12.5))
(tbtext "Title: %T" (name text10:Text) (pos 109 10.7) (font (size 2 2) bold))
(tbtext "File: %F" (name text11:Text) (pos 109 14.3))
(line (name segm8:Line) (start 110 18.5) (end 2 18.5))
(tbtext "Sheet: %P" (name text12:Text) (pos 109 17))
(tbtext %Y (name text13:Text) (pos 109 20) (font bold))
(tbtext %C0 (name text14:Text) (pos 109 23))
(tbtext %C1 (name text15:Text) (pos 109 26))
(tbtext %C2 (name text16:Text) (pos 109 29))
(tbtext %C3 (name text17:Text) (pos 109 32))
(line (name segm9:Line) (start 90 8.5) (end 90 5.5))
(line (name segm10:Line) (start 26 8.5) (end 26 2))
(rect (name rect3:Rect) (start 157 34) (end 110 2))
(polygon (name poly1:Poly) (pos 134 18) (rotate 20) (linewidth 0.00254)
(pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932) (xy 19.71802 5.92328)
(xy 19.69262 5.83946) (xy 19.66976 5.72262) (xy 19.65198 5.56006) (xy 19.63674 5.33908) (xy 19.6215 5.04952) (xy 19.61134 4.67614)
(xy 19.60372 4.20624) (xy 19.5961 3.62712) (xy 19.58848 2.92862) (xy 19.5834 2.09296) (xy 19.57832 1.11252) (xy 19.57578 0.27432)
(xy 19.55038 -5.16636) (xy 18.15592 -5.16636) (xy 17.69364 -5.16382) (xy 17.29232 -5.15874) (xy 16.98752 -5.15112) (xy 16.80464 -5.14096)
(xy 16.764 -5.13334) (xy 16.79194 -5.0419) (xy 16.8656 -4.85648) (xy 16.891 -4.79806) (xy 16.93672 -4.64312) (xy 16.97228 -4.42468)
(xy 16.99514 -4.11734) (xy 17.01038 -3.69824) (xy 17.01546 -3.14198) (xy 17.018 -2.82702) (xy 17.01546 -2.25806) (xy 17.01292 -1.83896)
(xy 17.0053 -1.5494) (xy 16.99006 -1.36652) (xy 16.9672 -1.27508) (xy 16.93164 -1.25222) (xy 16.88592 -1.28016) (xy 16.8656 -1.29794)
(xy 16.47444 -1.5494) (xy 15.96644 -1.71704) (xy 15.3797 -1.7907) (xy 15.2527 -1.79324) (xy 14.53134 -1.71958) (xy 13.89634 -1.50622)
(xy 13.35278 -1.14808) (xy 12.9032 -0.65024) (xy 12.5476 -0.0127) (xy 12.28598 0.762) (xy 12.22756 1.016) (xy 12.1539 1.50368)
(xy 12.11326 2.07264) (xy 12.10564 2.667) (xy 12.13104 3.23342) (xy 12.18692 3.71348) (xy 12.2301 3.91668) (xy 12.49934 4.66344)
(xy 12.88288 5.2959) (xy 13.36802 5.8039) (xy 13.94968 6.17982) (xy 14.39164 6.35508) (xy 14.76248 6.41858) (xy 15.21968 6.4262)
(xy 15.69466 6.38302) (xy 16.11376 6.29158) (xy 16.20266 6.2611) (xy 16.49984 6.1341) (xy 16.76146 5.99694) (xy 16.87576 5.92074)
(xy 17.06118 5.7912) (xy 17.15262 5.78104) (xy 17.1831 5.9055) (xy 17.18564 6.00964) (xy 17.18564 6.26364) (xy 18.542 6.26364)
(xy 19.9009 6.26364) (xy 19.9009 8.382) (xy 11.51636 8.382) (xy 11.51636 6.26364) (xy 11.3665 6.03504) (xy 11.32586 5.9563)
(xy 11.2903 5.84962) (xy 11.26236 5.69468) (xy 11.24204 5.4737) (xy 11.22172 5.17144) (xy 11.20648 4.76504) (xy 11.19124 4.2418)
(xy 11.17854 3.57886) (xy 11.16838 3.00736) (xy 11.1506 2.16408) (xy 11.13282 1.47066) (xy 11.10996 0.90932) (xy 11.07694 0.45974)
(xy 11.03122 0.10414) (xy 10.97026 -0.1778) (xy 10.89152 -0.40386) (xy 10.78738 -0.59436) (xy 10.6553 -0.76962) (xy 10.49274 -0.94234)
(xy 10.40892 -1.0287) (xy 9.93394 -1.38684) (xy 9.34212 -1.63576) (xy 8.64616 -1.77546) (xy 7.85622 -1.80086) (xy 6.99262 -1.7145)
(xy 6.31952 -1.57988) (xy 5.92836 -1.48844) (xy 5.58038 -1.41478) (xy 5.31622 -1.36906) (xy 5.19938 -1.35636) (xy 5.0419 -1.32588)
(xy 4.99364 -1.27254) (xy 5.02666 -1.1557) (xy 5.10794 -0.92964) (xy 5.22224 -0.635) (xy 5.35432 -0.31496) (xy 5.48132 -0.01524)
(xy 5.588 0.22098) (xy 5.65658 0.35052) (xy 5.6642 0.36068) (xy 5.76834 0.36322) (xy 5.98424 0.31496) (xy 6.26872 0.22098)
(xy 6.3119 0.2032) (xy 6.83768 0.04572) (xy 7.3406 -0.03048) (xy 7.79018 -0.0254) (xy 8.14324 0.0635) (xy 8.2677 0.13462)
(xy 8.49376 0.40132) (xy 8.600440000000001 0.68326) (xy 8.691879999999999 1.05664) (xy 7.66826 1.10744) (xy 6.97738 1.16078) (xy 6.41096 1.24968)
(xy 5.92836 1.3843) (xy 5.49148 1.5748) (xy 5.24764 1.70942) (xy 4.77012 2.08534) (xy 4.4196 2.54762) (xy 4.19608 3.0734)
(xy 4.09448 3.63474) (xy 4.11988 4.20878) (xy 4.26974 4.76758) (xy 4.54406 5.28828) (xy 4.9403 5.74294) (xy 5.31876 6.02742)
(xy 5.85978 6.2738) (xy 6.47954 6.40588) (xy 7.12724 6.42112) (xy 7.74954 6.30936) (xy 7.75208 6.30936) (xy 8.06958 6.18744)
(xy 8.37438 6.02742) (xy 8.465820000000001 5.96646) (xy 8.763 5.74802) (xy 8.788399999999999 6.00456) (xy 8.813800000000001 6.26364) (xy 10.16508 6.26364)
(xy 11.51636 6.26364) (xy 11.51636 8.382) (xy 4.13766 8.382) (xy 4.13766 5.44068) (xy 4.10972 5.36702) (xy 4.0132 5.1816)
(xy 3.86334 4.91744) (xy 3.68046 4.6101) (xy 3.48742 4.29006) (xy 3.29946 3.99034) (xy 3.1369 3.74142) (xy 3.10896 3.70078)
(xy 2.9464 3.46456) (xy 2.65684 3.7211) (xy 2.20726 4.05892) (xy 1.76276 4.26212) (xy 1.27254 4.34848) (xy 1.05664 4.3561)
(xy 0.70104 4.34594) (xy 0.43942 4.29768) (xy 0.19558 4.19862) (xy 0.05842 4.11988) (xy -0.38862 3.76682) (xy -0.75946 3.28168)
(xy -1.03378 2.7051) (xy -1.07188 2.58572) (xy -1.143 2.30378) (xy -1.19126 1.98374) (xy -1.21666 1.58496) (xy -1.22936 1.0668)
(xy -1.22936 0.889) (xy -1.22428 0.381) (xy -1.21158 0) (xy -1.17856 -0.30226) (xy -1.12776 -0.56896) (xy -1.04902 -0.84328)
(xy -1.02108 -0.92964) (xy -0.7543800000000001 -1.53416) (xy -0.3937 -2.01676) (xy 0.04318 -2.36474) (xy 0.54864 -2.57048) (xy 0.99822 -2.62636)
(xy 1.54686 -2.55524) (xy 2.05486 -2.35712) (xy 2.35712 -2.15138) (xy 2.5527 -1.98882) (xy 2.68986 -1.88468) (xy 2.7305 -1.86436)
(xy 2.794 -1.9304) (xy 2.92608 -2.10312) (xy 3.10388 -2.35458) (xy 3.30962 -2.65176) (xy 3.51536 -2.96164) (xy 3.70586 -3.25374)
(xy 3.85318 -3.4925) (xy 3.94208 -3.64998) (xy 3.95732 -3.69316) (xy 3.86588 -3.74396) (xy 3.66268 -3.85064) (xy 3.3782 -3.99288)
(xy 3.22326 -4.06654) (xy 2.54508 -4.36118) (xy 1.92532 -4.5466) (xy 1.31318 -4.64058) (xy 0.87122 -4.65836) (xy 0.02286 -4.59232)
(xy -0.7493 -4.38912) (xy -1.46558 -4.0386) (xy -2.15392 -3.5306) (xy -2.38252 -3.32232) (xy -2.9464 -2.70764) (xy -3.37312 -2.04978)
(xy -3.6957 -1.30302) (xy -3.82524 -0.87376) (xy -3.94208 -0.26924) (xy -4.00304 0.43434) (xy -4.00812 1.17348) (xy -3.95986 1.88976)
(xy -3.85572 2.52222) (xy -3.82524 2.64922) (xy -3.51028 3.53314) (xy -3.07848 4.32562) (xy -2.53746 5.0165) (xy -1.905 5.588)
(xy -1.19126 6.02488) (xy -0.44958 6.30682) (xy 0.01016 6.39064) (xy 0.57404 6.4262) (xy 1.17856 6.41604) (xy 1.76276 6.3627)
(xy 2.26822 6.26364) (xy 2.286 6.25856) (xy 2.72288 6.11124) (xy 3.23088 5.90296) (xy 3.73888 5.66166) (xy 4.13766 5.44068)
(xy 4.13766 8.382) (xy 0 8.382) (xy -4.74218 8.382) (xy -4.74218 1.7653) (xy -4.74218 0.71882) (xy -4.74218 -0.55118)
(xy -4.74218 -1.66116) (xy -4.74218 -2.62382) (xy -4.74472 -3.44678) (xy -4.7498 -4.14528) (xy -4.75742 -4.7244) (xy -4.77012 -5.19938)
(xy -4.79044 -5.57784) (xy -4.81584 -5.87248) (xy -4.84886 -6.09346) (xy -4.8895 -6.2484) (xy -4.94284 -6.35254) (xy -5.0038 -6.4135)
(xy -5.07746 -6.44144) (xy -5.16382 -6.44906) (xy -5.26542 -6.44398) (xy -5.37972 -6.4389) (xy -5.40512 -6.4389) (xy -5.6515 -6.4516)
(xy -5.79374 -6.51002) (xy -5.90042 -6.65734) (xy -5.969 -6.79958) (xy -6.23062 -7.1755) (xy -6.57606 -7.4295) (xy -6.97738 -7.56158)
(xy -7.40156 -7.57682) (xy -7.81558 -7.47014) (xy -8.1915 -7.24662) (xy -8.49376 -6.90626) (xy -8.58774 -6.73354) (xy -8.729979999999999 -6.43636)
(xy -14.05382 -6.43636) (xy -15.14602 -6.43636) (xy -16.08074 -6.43382) (xy -16.87068 -6.43128) (xy -17.52854 -6.42874) (xy -18.06702 -6.42112)
(xy -18.49628 -6.4135) (xy -18.83156 -6.40334) (xy -19.08302 -6.39064) (xy -19.2659 -6.3754) (xy -19.38782 -6.35508) (xy -19.46402 -6.33222)
(xy -19.50974 -6.30428) (xy -19.50974 -6.30174) (xy -19.53514 -6.26618) (xy -19.55546 -6.1976) (xy -19.57324 -6.08838) (xy -19.59102 -5.92582)
(xy -19.60372 -5.69976) (xy -19.61388 -5.40004) (xy -19.6215 -5.0165) (xy -19.62912 -4.53644) (xy -19.6342 -3.95224) (xy -19.63928 -3.24866)
(xy -19.64182 -2.41808) (xy -19.64182 -1.4478) (xy -19.64436 -0.32766) (xy -19.64436 0.71882) (xy -19.64436 1.9685) (xy -19.64182 3.06324)
(xy -19.64182 4.00812) (xy -19.63928 4.81584) (xy -19.6342 5.49656) (xy -19.62912 6.06552) (xy -19.6215 6.52526) (xy -19.61134 6.8961)
(xy -19.60118 7.18058) (xy -19.58848 7.39394) (xy -19.5707 7.54634) (xy -19.55292 7.64794) (xy -19.53006 7.71144) (xy -19.50974 7.73938)
(xy -19.47418 7.76224) (xy -19.4056 7.7851) (xy -19.29892 7.80288) (xy -19.1389 7.81812) (xy -18.91538 7.83082) (xy -18.62074 7.84098)
(xy -18.24228 7.85114) (xy -17.76984 7.85622) (xy -17.1958 7.86384) (xy -16.50238 7.86638) (xy -15.68704 7.86892) (xy -14.732 7.87146)
(xy -13.63218 7.87146) (xy -12.37488 7.87146) (xy -12.192 7.874) (xy -10.91438 7.87146) (xy -9.79424 7.87146) (xy -8.82142 7.86892)
(xy -7.98576 7.86638) (xy -7.2771 7.86384) (xy -6.68782 7.85876) (xy -6.20014 7.85114) (xy -5.81152 7.84352) (xy -5.50672 7.83336)
(xy -5.27304 7.81812) (xy -5.1054 7.80542) (xy -4.9911 7.78764) (xy -4.91998 7.76732) (xy -4.87934 7.74192) (xy -4.8768 7.73938)
(xy -4.8514 7.70128) (xy -4.83108 7.6327) (xy -4.8133 7.52348) (xy -4.79552 7.36092) (xy -4.78282 7.1374) (xy -4.77266 6.83768)
(xy -4.76504 6.45414) (xy -4.75742 5.97408) (xy -4.75234 5.38734) (xy -4.74726 4.6863) (xy -4.74472 3.85318) (xy -4.74472 2.88544)
(xy -4.74218 1.7653) (xy -4.74218 8.382) (xy -20.574 8.382) (xy -20.574 0) (xy -20.574 -8.382) (xy 0 -8.382)
(xy 20.574 -8.382) (xy 20.574 0) (xy 20.574 8.382) (xy 20.574 8.382))
(pts (xy -9.4742 6.26364) (xy -11.25728 6.26364) (xy -13.04036 6.26364) (xy -13.04036 6.0071) (xy -13.07846 5.76072)
(xy -13.17752 5.48386) (xy -13.20038 5.4356) (xy -13.28674 5.29336) (xy -13.45692 5.0419) (xy -13.68806 4.70662) (xy -13.96746 4.31292)
(xy -14.27226 3.88112) (xy -14.58976 3.4417) (xy -14.8971 3.02006) (xy -15.1765 2.63652) (xy -15.41526 2.31902) (xy -15.58798 2.09296)
(xy -15.67942 1.98882) (xy -15.7099 2.03454) (xy -15.73022 2.24282) (xy -15.74038 2.61874) (xy -15.74292 3.15976) (xy -15.7353 3.76682)
(xy -15.72514 4.37896) (xy -15.71244 4.84886) (xy -15.69974 5.19684) (xy -15.67688 5.45084) (xy -15.64894 5.63372) (xy -15.6083 5.76834)
(xy -15.55496 5.88518) (xy -15.5194 5.94614) (xy -15.33144 6.26364) (xy -16.96974 6.26364) (xy -18.61058 6.26364) (xy -18.45056 5.94868)
(xy -18.415 5.87502) (xy -18.38706 5.78612) (xy -18.36166 5.67182) (xy -18.34134 5.51688) (xy -18.3261 5.30606) (xy -18.3134 5.02666)
(xy -18.30324 4.66598) (xy -18.29816 4.20624) (xy -18.29308 3.63728) (xy -18.29054 2.94386) (xy -18.29054 2.11328) (xy -18.29054 1.12776)
(xy -18.288 0.889) (xy -18.29054 -0.13208) (xy -18.29054 -0.99568) (xy -18.29308 -1.71958) (xy -18.29562 -2.31394) (xy -18.30324 -2.79654)
(xy -18.31086 -3.18008) (xy -18.32356 -3.47472) (xy -18.3388 -3.70078) (xy -18.35658 -3.86588) (xy -18.37944 -3.9878) (xy -18.40738 -4.08178)
(xy -18.4404 -4.15798) (xy -18.45056 -4.17322) (xy -18.61058 -4.48818) (xy -17.01038 -4.48818) (xy -16.51 -4.48564) (xy -16.07566 -4.48056)
(xy -15.73022 -4.4704) (xy -15.49908 -4.4577) (xy -15.41018 -4.44246) (xy -15.44574 -4.3434) (xy -15.53464 -4.16052) (xy -15.55496 -4.12496)
(xy -15.61084 -3.9878) (xy -15.65402 -3.7973) (xy -15.6845 -3.52806) (xy -15.70736 -3.15468) (xy -15.72514 -2.64922) (xy -15.73276 -2.37236)
(xy -15.75054 -1.70434) (xy -15.75816 -1.20396) (xy -15.748 -0.86106) (xy -15.70228 -0.6731) (xy -15.61084 -0.63754) (xy -15.46098 -0.74422)
(xy -15.24 -0.99314) (xy -14.93266 -1.37668) (xy -14.5288 -1.8923) (xy -14.51102 -1.91516) (xy -14.04112 -2.51714) (xy -13.67028 -3.00482)
(xy -13.39088 -3.39344) (xy -13.18768 -3.70078) (xy -13.0556 -3.94208) (xy -12.9794 -4.13004) (xy -12.95654 -4.28244) (xy -12.954 -4.29768)
(xy -12.954 -4.48818) (xy -11.23696 -4.48818) (xy -9.519920000000001 -4.48818) (xy -10.07364 -3.91668) (xy -10.25398 -3.7211) (xy -10.50544 -3.43154)
(xy -10.81278 -3.06832) (xy -11.1633 -2.64922) (xy -11.54176 -2.19202) (xy -11.93038 -1.71704) (xy -12.319 -1.23952) (xy -12.68476 -0.78232)
(xy -13.02004 -0.36068) (xy -13.30452 0.00254) (xy -13.5255 0.2921) (xy -13.66774 0.49022) (xy -13.716 0.57404) (xy -13.66774 0.66294)
(xy -13.53058 0.86868) (xy -13.31976 1.17348) (xy -13.04798 1.55702) (xy -12.7254 2.00406) (xy -12.3698 2.49428) (xy -11.99388 3.00736)
(xy -11.61034 3.5306) (xy -11.23442 4.0386) (xy -10.87628 4.51866) (xy -10.55116 4.95046) (xy -10.27176 5.31622) (xy -10.05332 5.59562)
(xy -9.91108 5.76834) (xy -9.4742 6.26364) (xy -9.4742 6.26364))
(pts (xy -5.75818 6.23316) (xy -5.83946 6.24332) (xy -6.06044 6.25094) (xy -6.39826 6.25856) (xy -6.82498 6.26364)
(xy -7.239 6.26364) (xy -7.71906 6.2611) (xy -8.135619999999999 6.25856) (xy -8.4582 6.25094) (xy -8.6614 6.24078) (xy -8.72236 6.23316)
(xy -8.691879999999999 6.14172) (xy -8.618220000000001 5.95376) (xy -8.595359999999999 5.89534) (xy -8.559799999999999 5.72262) (xy -8.52932 5.40512) (xy -8.503920000000001 4.9657)
(xy -8.483599999999999 4.42468) (xy -8.468360000000001 3.81) (xy -8.4582 3.14198) (xy -8.45566 2.44602) (xy -8.45566 1.74498) (xy -8.460739999999999 1.06172)
(xy -8.47344 0.42164) (xy -8.49122 -0.15494) (xy -8.51408 -0.64262) (xy -8.542020000000001 -1.01854) (xy -8.57504 -1.25984) (xy -8.59028 -1.31572)
(xy -8.712199999999999 -1.61036) (xy -7.36346 -1.61036) (xy -6.01218 -1.61036) (xy -6.01218 1.99136) (xy -6.01218 2.8956) (xy -6.00964 3.6449)
(xy -6.00456 4.2545) (xy -5.9944 4.74472) (xy -5.98424 5.12572) (xy -5.96646 5.41274) (xy -5.94614 5.6261) (xy -5.92074 5.77596)
(xy -5.89026 5.88264) (xy -5.88518 5.89534) (xy -5.8039 6.09854) (xy -5.76072 6.22046) (xy -5.75818 6.23316) (xy -5.75818 6.23316))
(pts (xy 8.635999999999999 3.4544) (xy 8.62838 3.80238) (xy 8.602980000000001 4.0259) (xy 8.54964 4.17322) (xy 8.45312 4.28752)
(xy 8.445499999999999 4.29514) (xy 8.08736 4.52628) (xy 7.66826 4.64058) (xy 7.24408 4.62788) (xy 7.05866 4.572) (xy 6.77672 4.37388)
(xy 6.5913 4.07924) (xy 6.5405 3.74142) (xy 6.54558 3.70078) (xy 6.60146 3.45186) (xy 6.68782 3.25882) (xy 6.70052 3.24104)
(xy 6.96468 3.03784) (xy 7.35076 2.88798) (xy 7.81812 2.8067) (xy 8.064500000000001 2.794) (xy 8.635999999999999 2.794) (xy 8.635999999999999 3.4544)
(xy 8.635999999999999 3.4544))
(pts (xy 17.018 4.04876) (xy 16.7259 4.2291) (xy 16.34744 4.3942) (xy 15.94358 4.46024) (xy 15.56766 4.4196)
(xy 15.35938 4.3307) (xy 15.13332 4.15544) (xy 14.9733 3.93192) (xy 14.86408 3.6322) (xy 14.80058 3.23342) (xy 14.77518 2.70764)
(xy 14.77264 2.45364) (xy 14.79296 1.77546) (xy 14.859 1.23952) (xy 14.97076 0.82296) (xy 15.1384 0.508) (xy 15.33652 0.29718)
(xy 15.66418 0.127) (xy 16.06042 0.08382000000000001) (xy 16.48714 0.17018) (xy 16.68018 0.254) (xy 17.018 0.42672) (xy 17.018 2.23774)
(xy 17.018 4.04876) (xy 17.018 4.04876))
)
)
@@ -36,11 +36,11 @@ popt = pctl.GetPlotOptions()
popt.SetOutputDirectory(plotDir)
# Set some important plot options:
popt.SetPlotFrameRef(False)
popt.SetPlotFrameRef(False) #do not change it
popt.SetLineWidth(FromMM(0.35))
popt.SetAutoScale(False)
popt.SetScale(1)
popt.SetAutoScale(False) #do not change it
popt.SetScale(1) #do not change it
popt.SetMirror(False)
popt.SetUseGerberAttributes(True)
popt.SetUseGerberProtelExtensions(False)
@@ -100,7 +100,10 @@ drlwriter.SetMapFileFormat( PLOT_FORMAT_PDF )
mirror = False
minimalHeader = False
offset = wxPoint(0,0)
drlwriter.SetOptions( mirror, minimalHeader, offset )
# False to generate 2 separate drill files (one for plated holes, one for non plated holes)
# True to generate only one drill file
mergeNPTH = False
drlwriter.SetOptions( mirror, minimalHeader, offset, mergeNPTH )
metricFmt = True
drlwriter.SetFormat( metricFmt )
+4
View File
@@ -153,6 +153,7 @@ set( EESCHEMA_SRCS
sch_sheet_path.cpp
sch_sheet_pin.cpp
sch_text.cpp
sch_validators.cpp
schedit.cpp
schematic_undo_redo.cpp
schframe.cpp
@@ -191,6 +192,8 @@ set( EESCHEMA_COMMON_SRCS
if( MINGW )
# EESCHEMA_RESOURCES variable is set by the macro.
mingw_resource_compiler( eeschema )
else()
set( EESCHEMA_RESOURCES eeschema.rc )
endif()
# Create a C++ compilable string initializer containing html text into a *.h file:
@@ -250,6 +253,7 @@ target_link_libraries( eeschema_kiface
common
bitmaps
polygon
gal
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}
)
+22 -8
View File
@@ -886,7 +886,7 @@ bool LIB_PART::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
{
p = strtok( line, " \t\n" );
if( stricmp( p, "ENDDEF" ) == 0 )
if( p && stricmp( p, "ENDDEF" ) == 0 )
break;
}
@@ -948,6 +948,9 @@ bool LIB_PART::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
if( *line == '#' ) // a comment
continue;
if( p == NULL ) // empty line
continue;
if( line[0] == 'T' && line[1] == 'i' )
result = LoadDateAndTime( aLineReader );
else if( *line == 'F' )
@@ -1036,7 +1039,12 @@ bool LIB_PART::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorMsg )
break;
case '#': // Comment
continue;
continue;
case '\n':
case '\r':
case 0: // empty line
continue;
default:
aErrorMsg.Printf( wxT( "undefined DRAW command %c" ), line[0] );
@@ -1664,6 +1672,8 @@ void LIB_PART::SetConversion( bool aSetConvert )
// Duplicate items to create the converted shape
if( aSetConvert )
{
std::vector< LIB_ITEM* > tmp; // Temporarily store the duplicated pins here.
BOOST_FOREACH( LIB_ITEM& item, drawings )
{
// Only pins are duplicated.
@@ -1674,9 +1684,13 @@ void LIB_PART::SetConversion( bool aSetConvert )
{
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
newItem->m_Convert = 2;
drawings.push_back( newItem );
tmp.push_back( newItem );
}
}
// Transfer the new pins to the LIB_PART.
for( unsigned i = 0; i < tmp.size(); i++ )
drawings.push_back( tmp[i] );
}
else
{
@@ -1746,16 +1760,16 @@ void LIB_PART::SetAliases( const wxArrayString& aAliasList )
}
// Remove names in the current component that are not in the new alias list.
LIB_ALIASES::iterator it;
LIB_ALIASES::iterator it = m_aliases.begin();
for( it = m_aliases.begin(); it < m_aliases.end(); it++ )
while( it != m_aliases.end() )
{
int index = aAliasList.Index( (*it)->GetName(), false );
if( index != wxNOT_FOUND || (*it)->IsRoot() )
continue;
it = m_aliases.erase( it );
++it;
else
it = m_aliases.erase( it );
}
}
+3 -3
View File
@@ -351,14 +351,14 @@ public:
bool LoadAliases( char* aLine, wxString& aErrorMsg );
bool LoadFootprints( LINE_READER& aReader, wxString& aErrorMsg );
bool IsPower() { return m_options == ENTRY_POWER; }
bool IsNormal() { return m_options == ENTRY_NORMAL; }
bool IsPower() const { return m_options == ENTRY_POWER; }
bool IsNormal() const { return m_options == ENTRY_NORMAL; }
void SetPower() { m_options = ENTRY_POWER; }
void SetNormal() { m_options = ENTRY_NORMAL; }
void LockUnits( bool aLockUnits ) { m_unitsLocked = aLockUnits; }
bool UnitsLocked() { return m_unitsLocked; }
bool UnitsLocked() const { return m_unitsLocked; }
/**
* Function SetFields
+31 -3
View File
@@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* 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
@@ -315,6 +315,32 @@ void NETLIST_OBJECT::ConvertBusToNetListItems( NETLIST_OBJECT_LIST& aNetListItem
}
}
bool NETLIST_OBJECT::IsLabelGlobal() const
{
// return true if the object is a global label
// * a actual global label
// * a pin label coming from a invisible power pin
return ( m_Type == NET_PINLABEL ) ||
( m_Type == NET_GLOBLABEL ) ||
( m_Type == NET_GLOBBUSLABELMEMBER );
}
bool NETLIST_OBJECT::IsLabelBusMemberType() const
{
// return true if the object is a bus label member build from a
// schematic bus label (like label[xx..yy)
// They are labels with very specific properties, especially for connection
// between them: 2 bus label members can be connected only
// if they have the same member value.
return ( m_Type == NET_SHEETBUSLABELMEMBER ) ||
( m_Type == NET_BUSLABELMEMBER ) ||
( m_Type == NET_HIERBUSLABELMEMBER ) ||
( m_Type == NET_GLOBBUSLABELMEMBER );
}
/*
* return the net name of the item
*/
@@ -373,7 +399,7 @@ wxString NETLIST_OBJECT::GetShortNetName() const
* Set m_netNameCandidate to a connected item which will
* be used to calcule the net name of the item
* Obviously the candidate can be only a label
* when there is no label on the net a pad which will
* If there is no label on the net, a pad name will be
* used to build a net name (something like Cmp<REF>_Pad<PAD_NAME>
* @param aCandidate = the connected item candidate
*/
@@ -385,6 +411,8 @@ void NETLIST_OBJECT::SetNetNameCandidate( NETLIST_OBJECT* aCandidate )
case NET_LABEL:
case NET_PINLABEL:
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER:
case NET_PIN:
m_netNameCandidate = aCandidate;
break;
+26 -8
View File
@@ -59,6 +59,8 @@ enum NETLIST_ITEM_T
* the bus label (like DATA[0..7] is
* converted to n single labels like
* DATA0, DATA1 ...
* These objects are living only in the current
* NETLIST_OBJECT_LIST, not in shematic.
*/
NET_GLOBBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
// global bus label is found
@@ -217,10 +219,19 @@ public:
* (i.e. an real global label or a pin label coming
* from a power pin invisible
*/
bool IsLabelGlobal() const
{
return ( m_Type == NET_PINLABEL ) || ( m_Type == NET_GLOBLABEL );
}
bool IsLabelGlobal() const;
/**
* Function IsLabelBusMemberType
* @return true if the object is a bus label member build from a
* schematic bus label (like label[xx..yy], xx and yy are the first and last
* bus member id)
* bus label members have specific properties:
* they do not live in schematic
* they have specific properties in connections:
* 2 bus label members can be connected connected only if they have the same member value.
*/
bool IsLabelBusMemberType() const;
/**
* Function IsLabelType
@@ -410,7 +421,7 @@ private:
return Objet1->m_SheetPath.Cmp( Objet2->m_SheetPath ) < 0;
}
/*
/**
* Propagate net codes from a parent sheet to an include sheet,
* from a pin sheet connection
*/
@@ -418,8 +429,8 @@ private:
void pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus, int start );
/*
* Search connections betweena junction and segments
/**
* Search connections between a junction and segments
* Propagate the junction net code to objects connected by this junction.
* The junction must have a valid net code
* The list of objects is expected sorted by sheets.
@@ -427,9 +438,16 @@ private:
*/
void segmentToPointConnect( NETLIST_OBJECT* aJonction, bool aIsBus, int aIdxStart );
/**
* Function connectBusLabels
* Propagate the net code (and create it, if not yet existing) between
* all bus label member objects connected by they name.
* Search is done in the entire list
*/
void connectBusLabels();
/*
/**
* Set the m_FlagOfConnection member of items in list
* depending on the connection type:
* UNCONNECTED, PAD_CONNECT or NOCONNECT_SYMBOL_PRESENT
+4 -2
View File
@@ -218,8 +218,10 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) :
m_config = Kiface().KifaceSettings();
installPluginsList();
GetSizer()->Fit( this );
Centre();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
DIALOG_BOM::~DIALOG_BOM()
@@ -46,6 +46,7 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
m_search_container->SetTree( m_libraryComponentTree );
m_searchBox->SetFocus();
m_componentDetails->SetEditable( false );
m_componentView->SetLayoutDirection( wxLayout_LeftToRight );
m_libraryComponentTree->ScrollTo( m_libraryComponentTree->GetFocusedItem() );
@@ -49,8 +49,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRA
initDlg();
GetSizer()->SetSizeHints( this );
Center();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 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
@@ -43,6 +43,8 @@
#include <class_library.h>
#include <sch_component.h>
#include <dialog_helpers.h>
#include <sch_validators.h>
#include <dialog_edit_component_in_schematic_fbp.h>
@@ -104,7 +106,12 @@ private:
void copyPanelToOptions();
void setRowItem( int aFieldNdx, const SCH_FIELD& aField );
void setRowItem( int aFieldNdx, const wxString& aName, const wxString& aValue );
void setRowItem( int aFieldNdx, const SCH_FIELD& aField )
{
setRowItem( aFieldNdx, aField.GetName( false ), aField.GetText() );
}
// event handlers
void OnCloseDialog( wxCloseEvent& event );
@@ -119,6 +126,13 @@ private:
void showButtonHandler( wxCommandEvent& event );
void OnTestChipName( wxCommandEvent& event );
void OnSelectChipName( wxCommandEvent& event );
void OnInitDlg( wxInitDialogEvent& event )
{
TransferDataToWindow();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
SCH_FIELD* findField( const wxString& aFieldName );
@@ -191,11 +205,11 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
m_staticTextUnitPosY->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
wxToolTip::Enable( true );
GetSizer()->SetSizeHints( this );
Center();
stdDialogButtonSizerOK->SetDefault();
FixOSXCancelButtonIssue();
Fit();
}
@@ -535,6 +549,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler( wxCommandEvent& even
{
// DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); )
fieldValueTextCtrl->SetValue( fpid );
setRowItem( fieldNdx, m_FieldsBuf[fieldNdx].GetName( false ), fpid );
}
frame->Destroy();
@@ -760,7 +776,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
}
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const SCH_FIELD& aField )
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const wxString& aName, const wxString& aValue )
{
wxASSERT( aFieldNdx >= 0 );
@@ -774,8 +790,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const SCH_FI
fieldListCtrl->SetItem( ndx, 1, wxEmptyString );
}
fieldListCtrl->SetItem( aFieldNdx, 0, aField.GetName( false ) );
fieldListCtrl->SetItem( aFieldNdx, 1, aField.GetText() );
fieldListCtrl->SetItem( aFieldNdx, 0, aName );
fieldListCtrl->SetItem( aFieldNdx, 1, aValue );
// recompute the column widths here, after setting texts
fieldListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
@@ -837,6 +853,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
// may only delete user defined fields
deleteFieldButton->Enable( fieldNdx >= MANDATORY_FIELDS );
fieldValueTextCtrl->SetValidator( SCH_FIELD_VALIDATOR( false, field.GetId() ) );
fieldValueTextCtrl->SetValue( field.GetText() );
m_show_datasheet_button->Enable( fieldNdx == DATASHEET || fieldNdx == FOOTPRINT );
@@ -894,6 +911,11 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
return true;
// Check for illegal field text.
if( fieldValueTextCtrl->GetValidator()
&& !fieldValueTextCtrl->GetValidator()->Validate( this ) )
return false;
SCH_FIELD& field = m_FieldsBuf[fieldNdx];
field.SetVisible( showCheckBox->GetValue() );
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version May 21 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -182,7 +182,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( fieldsSizer->GetStaticBox(), wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 3 );
m_StyleRadioBox->SetToolTip( _("The style of the currently selected field's text in the schemati") );
m_StyleRadioBox->SetToolTip( _("The style of the currently selected field's text in the schematic") );
bSizerStyle->Add( m_StyleRadioBox, 1, wxEXPAND|wxALL, 5 );
@@ -290,6 +290,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCloseDialog ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnInitDlg ) );
m_buttonTestChipName->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnTestChipName ), NULL, this );
m_buttonSelectChipName->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnSelectChipName ), NULL, this );
defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
@@ -307,6 +308,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCloseDialog ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnInitDlg ) );
m_buttonTestChipName->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnTestChipName ), NULL, this );
m_buttonSelectChipName->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnSelectChipName ), NULL, this );
defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
@@ -67,7 +67,7 @@
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnInitDialog">OnInitDlg</event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
@@ -112,6 +112,7 @@
<property name="minimum_size"></property>
<property name="name">optionsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@@ -740,6 +741,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerChipName</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@@ -777,7 +779,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@@ -1140,7 +1142,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@@ -1377,6 +1379,7 @@
<property name="minimum_size"></property>
<property name="name">fieldsSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
@@ -1389,6 +1392,7 @@
<property name="minimum_size"></property>
<property name="name">gridStaticBoxSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@@ -1981,6 +1985,7 @@
<property name="minimum_size"></property>
<property name="name">visibilitySizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@@ -2217,7 +2222,7 @@
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">The style of the currently selected field&apos;s text in the schemati</property>
<property name="tooltip">The style of the currently selected field&apos;s text in the schematic</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
@@ -2380,7 +2385,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@@ -2554,7 +2559,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@@ -2834,7 +2839,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@@ -3091,7 +3096,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@@ -3348,7 +3353,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version May 21 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -85,6 +85,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnTestChipName( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectChipName( wxCommandEvent& event ) { event.Skip(); }
virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); }
+4 -8
View File
@@ -110,12 +110,10 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
m_CurrentText = aTextItem;
InitDialog();
GetSizer()->SetSizeHints( this );
Layout();
Fit();
SetMinSize( GetBestSize() );
FixOSXCancelButtonIssue();
Centre();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
@@ -165,9 +163,6 @@ void DIALOG_LABEL_EDITOR::InitDialog()
default:
SetTitle( _( "Text Properties" ) );
m_textLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER,
wxCommandEventHandler ( DIALOG_LABEL_EDITOR::OnEnterKey ),
NULL, this );
break;
}
@@ -301,6 +296,7 @@ void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
m_CurrentText->SetSize( wxSize( value, value ) );
if( m_TextShape )
/// @todo move cast to widget
m_CurrentText->SetShape( m_TextShape->GetSelection() );
int style = m_TextStyle->GetSelection();
+2 -4
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Feb 26 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -36,7 +36,7 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
bSizeText->Add( m_textLabelSingleLine, 0, wxEXPAND|wxLEFT, 3 );
m_textLabelMultiLine = new wxTextCtrl( this, wxID_VALUEMULTI, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER );
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 );
@@ -104,7 +104,6 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
// Connect Events
m_textLabelSingleLine->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnEnterKey ), NULL, this );
m_textLabelMultiLine->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnEnterKey ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnOkClick ), NULL, this );
}
@@ -113,7 +112,6 @@ DIALOG_LABEL_EDITOR_BASE::~DIALOG_LABEL_EDITOR_BASE()
{
// Disconnect Events
m_textLabelSingleLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnEnterKey ), NULL, this );
m_textLabelMultiLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnEnterKey ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnOkClick ), NULL, this );
+2 -2
View File
@@ -342,7 +342,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_MULTILINE|wxTE_PROCESS_ENTER</property>
<property name="style">wxTE_MULTILINE</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@@ -377,7 +377,7 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter">OnEnterKey</event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
+1 -1
View File
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Feb 26 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -3,7 +3,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2007-2016 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
@@ -42,6 +42,7 @@
#include <sch_field.h>
#include <template_fieldnames.h>
#include <dialog_helpers.h>
#include <sch_validators.h>
#include <dialog_edit_libentry_fields_in_lib_base.h>
@@ -112,7 +113,12 @@ private:
* bad data into a field, and this value can be used to deny a row change.
*/
bool copyPanelToSelectedField();
void setRowItem( int aFieldNdx, const LIB_FIELD& aField );
void setRowItem( int aFieldNdx, const wxString& aName, const wxString& aValue );
void setRowItem( int aFieldNdx, const LIB_FIELD& aField )
{
setRowItem( aFieldNdx, aField.GetName(), aField.GetText() );
}
/**
* Function updateDisplay
@@ -165,9 +171,6 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(
m_parent = aParent;
m_libEntry = aLibEntry;
m_skipCopyFromPanel = false;
GetSizer()->SetSizeHints( this );
Centre();
}
@@ -192,6 +195,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event
copySelectedFieldToPanel();
stdDialogButtonSizerOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
@@ -240,7 +248,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
// test if reference prefix is acceptable
if( !SCH_COMPONENT::IsReferenceStringValid( m_FieldsBuf[REFERENCE].GetText() ) )
{
DisplayError( NULL, _( "Illegal reference prefix. A reference must start by a letter" ) );
DisplayError( NULL, _( "Illegal reference. References must start with a letter." ) );
return;
}
@@ -282,15 +290,6 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
++i;
}
#if defined(DEBUG)
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
{
printf( "save[%u].name:'%s' value:'%s'\n", i,
TO_UTF8( m_FieldsBuf[i].GetName() ),
TO_UTF8( m_FieldsBuf[i].GetText() ) );
}
#endif
// copy all the fields back, fully replacing any previous fields
m_libEntry->SetFields( m_FieldsBuf );
@@ -415,8 +414,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler( wxCommandEvent& even
if( frame->ShowModal( &fpid, this ) )
{
// DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); )
fieldValueTextCtrl->SetValue( fpid );
setRowItem( fieldNdx, m_FieldsBuf[fieldNdx].GetName( false ), fpid );
}
frame->Destroy();
@@ -486,13 +485,6 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
m_libEntry->GetFields( cmpFields );
#if defined(DEBUG)
for( unsigned i=0; i<cmpFields.size(); ++i )
{
printf( "cmpFields[%u].name:%s\n", i, TO_UTF8( cmpFields[i].GetName() ) );
}
#endif
/* We have 3 component related field lists to be aware of: 1) UI
presentation (m_FieldsBuf), 2) fields in component ram copy, and 3)
fields recorded with component on disk. m_FieldsBuf is the list of UI
@@ -517,7 +509,6 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
// fixed fields:
for( int i=0; i<MANDATORY_FIELDS; ++i )
{
DBG( printf( "add fixed:%s\n", TO_UTF8( cmpFields[i].GetName() ) ); )
m_FieldsBuf.push_back( cmpFields[i] );
}
@@ -543,8 +534,6 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
// values from the component will be set.
if( !libField )
{
DBG( printf( "add template:%s\n", TO_UTF8( it->m_Name ) ); )
fld.SetName( it->m_Name );
fld.SetText( it->m_Value ); // empty? ok too.
@@ -555,7 +544,6 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
}
else
{
DBG( printf( "match template:%s\n", TO_UTF8( libField->GetName() ) ); )
fld = *libField; // copy values from component, m_Name too
}
@@ -571,7 +559,6 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
if( !buf )
{
DBG( printf( "add cmp:%s\n", TO_UTF8( cmp->GetName() ) ); )
m_FieldsBuf.push_back( *cmp );
}
}
@@ -597,7 +584,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
}
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const LIB_FIELD& aField )
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const wxString& aName, const wxString& aValue )
{
wxASSERT( aFieldNdx >= 0 );
@@ -611,8 +598,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const LIB_FI
fieldListCtrl->SetItem( ndx, COLUMN_TEXT, wxEmptyString );
}
fieldListCtrl->SetItem( aFieldNdx, COLUMN_FIELD_NAME, aField.GetName() );
fieldListCtrl->SetItem( aFieldNdx, COLUMN_TEXT, aField.GetText() );
fieldListCtrl->SetItem( aFieldNdx, COLUMN_FIELD_NAME, aName );
fieldListCtrl->SetItem( aFieldNdx, COLUMN_TEXT, aValue );
// recompute the column widths here, after setting texts
fieldListCtrl->SetColumnWidth( COLUMN_FIELD_NAME, wxLIST_AUTOSIZE );
@@ -687,6 +674,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
// if fieldNdx == REFERENCE, VALUE, then disable delete button
deleteFieldButton->Enable( fieldNdx >= MANDATORY_FIELDS );
fieldValueTextCtrl->SetValidator( SCH_FIELD_VALIDATOR( true, field.GetId() ) );
fieldValueTextCtrl->SetValue( field.GetText() );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.GetSize().x ) );
@@ -739,6 +727,11 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
return true;
// Check for illegal field text.
if( fieldValueTextCtrl->GetValidator()
&& !fieldValueTextCtrl->GetValidator()->Validate( this ) )
return false;
LIB_FIELD& field = m_FieldsBuf[fieldNdx];
if( showCheckBox->GetValue() )
@@ -776,12 +769,9 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
if( field.GetId() >= MANDATORY_FIELDS )
{
wxString name = fieldNameTextCtrl->GetValue();
DBG( printf("name:%s\n", TO_UTF8( name ) ); )
field.SetName( name );
}
DBG( printf("setname:%s\n", TO_UTF8( field.GetName() ) ); )
setRowItem( fieldNdx, field ); // update fieldListCtrl
int tmp = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -23,9 +23,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
bSizerFiledsList = new wxBoxSizer( wxVERTICAL );
fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
fieldListCtrl->SetMinSize( wxSize( 220,-1 ) );
bSizerFiledsList->Add( fieldListCtrl, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
bSizerFiledsList->Add( fieldListCtrl, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 6 );
addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 );
addFieldButton->SetToolTip( _("Add a new custom field") );
@@ -68,7 +66,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxEXPAND|wxALL, 5 );
fieldEditBoxSizer->Add( bSizerJustify, 1, wxEXPAND|wxBOTTOM, 5 );
fieldEditBoxSizer->Add( bSizerJustify, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizerAspect;
bSizerAspect = new wxBoxSizer( wxHORIZONTAL );
@@ -96,7 +94,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fieldEditBoxSizer->Add( bSizerAspect, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
fieldEditBoxSizer->Add( bSizerAspect, 1, wxALL|wxEXPAND|wxTOP, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
@@ -124,13 +122,13 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
m_show_datasheet_button = new wxButton( this, wxID_ANY, _("Show in Browser"), wxDefaultPosition, wxDefaultSize, 0 );
m_show_datasheet_button->SetToolTip( _("If your datasheet is given as an http:// link, then pressing this button should bring it up in your webbrowser.") );
fieldNameBoxSizer->Add( m_show_datasheet_button, 0, wxBOTTOM|wxEXPAND, 5 );
fieldNameBoxSizer->Add( m_show_datasheet_button, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizerPosSize;
fgSizerPosSize = new wxFlexGridSizer( 3, 3, 0, 0 );
fgSizerPosSize = new wxFlexGridSizer( 3, 3, 5, 5 );
fgSizerPosSize->AddGrowableCol( 1 );
fgSizerPosSize->SetFlexibleDirection( wxBOTH );
fgSizerPosSize->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
@@ -143,25 +141,25 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
textSizeTextCtrl->SetMaxLength( 0 );
textSizeTextCtrl->SetToolTip( _("The vertical height of the currently selected field's text in the schematic") );
fgSizerPosSize->Add( textSizeTextCtrl, 0, wxEXPAND|wxBOTTOM, 5 );
fgSizerPosSize->Add( textSizeTextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextUnitSize = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitSize->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitSize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerPosSize->Add( m_staticTextUnitSize, 0, wxALIGN_CENTER_VERTICAL, 5 );
posXLabel = new wxStaticText( this, wxID_ANY, _("PosX"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel = new wxStaticText( this, wxID_ANY, _("X Position"), wxDefaultPosition, wxDefaultSize, 0 );
posXLabel->Wrap( -1 );
fgSizerPosSize->Add( posXLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
posXTextCtrl->SetMaxLength( 0 );
fgSizerPosSize->Add( posXTextCtrl, 0, wxEXPAND|wxTOP, 5 );
fgSizerPosSize->Add( posXTextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextUnitPosX = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosX->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerPosSize->Add( m_staticTextUnitPosX, 0, wxALIGN_CENTER_VERTICAL, 5 );
posYLabel = new wxStaticText( this, wxID_ANY, _("PosY"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel = new wxStaticText( this, wxID_ANY, _("Y Position"), wxDefaultPosition, wxDefaultSize, 0 );
posYLabel->Wrap( -1 );
fgSizerPosSize->Add( posYLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
@@ -169,14 +167,14 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
posYTextCtrl->SetMaxLength( 0 );
posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") );
fgSizerPosSize->Add( posYTextCtrl, 0, wxEXPAND, 5 );
fgSizerPosSize->Add( posYTextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextUnitPosY = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnitPosY->Wrap( -1 );
fgSizerPosSize->Add( m_staticTextUnitPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerPosSize->Add( m_staticTextUnitPosY, 0, wxALIGN_CENTER_VERTICAL, 5 );
fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxALL|wxEXPAND, 5 );
bSizerFieldsSetup->Add( fieldEditBoxSizer, 2, wxEXPAND, 5 );
@@ -194,11 +192,12 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel );
stdDialogButtonSizer->Realize();
mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 );
mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 6 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCloseDialog ) );
@@ -44,7 +44,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE</property>
<property name="pos"></property>
<property name="size">542,529</property>
<property name="size">-1,-1</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Field Properties</property>
@@ -106,13 +106,13 @@
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">3</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerFiledsList</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">8</property>
<property name="border">6</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxListCtrl" expanded="0">
@@ -148,7 +148,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">220,-1</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">fieldListCtrl</property>
<property name="pane_border">1</property>
@@ -493,7 +493,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -684,7 +684,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="flag">wxALL|wxEXPAND|wxTOP</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -1332,7 +1332,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -1422,20 +1422,20 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="hgap">5</property>
<property name="minimum_size"></property>
<property name="name">fgSizerPosSize</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">3</property>
<property name="vgap">0</property>
<property name="vgap">5</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
@@ -1521,7 +1521,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@@ -1612,7 +1612,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -1725,7 +1725,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">PosX</property>
<property name="label">X Position</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -1778,7 +1778,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@@ -1869,7 +1869,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -1982,7 +1982,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">PosY</property>
<property name="label">Y Position</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -2035,7 +2035,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@@ -2126,7 +2126,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -2295,7 +2295,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">8</property>
<property name="border">6</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -84,7 +84,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM
public:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Field Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 542,529 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Field Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE();
};
+171 -196
View File
@@ -7,7 +7,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com
* Copyright (C) 2004-2016 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
@@ -31,82 +32,122 @@
#include <common.h>
#include <base_units.h>
#include <kiway.h>
#include <confirm.h>
#include <general.h>
#include <sch_base_frame.h>
#include <sch_component.h>
#include <template_fieldnames.h>
#include <class_libentry.h>
#include <lib_field.h>
#include <sch_component.h>
#include <template_fieldnames.h>
#include <class_library.h>
#include <sch_validators.h>
#include <dialog_edit_one_field.h>
void DIALOG_EDIT_ONE_FIELD::initDlg_base()
// These should probably moved into some other file as helpers.
EDA_TEXT_HJUSTIFY_T IntToEdaTextHorizJustify( int aHorizJustify )
{
wxASSERT( aHorizJustify >= GR_TEXT_HJUSTIFY_LEFT && aHorizJustify <= GR_TEXT_HJUSTIFY_RIGHT );
if( aHorizJustify > GR_TEXT_HJUSTIFY_RIGHT )
return GR_TEXT_HJUSTIFY_RIGHT;
if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
return GR_TEXT_HJUSTIFY_LEFT;
return (EDA_TEXT_HJUSTIFY_T) aHorizJustify;
}
EDA_TEXT_VJUSTIFY_T IntToEdaTextVertJustify( int aVertJustify )
{
wxASSERT( aVertJustify >= GR_TEXT_VJUSTIFY_TOP && aVertJustify <= GR_TEXT_VJUSTIFY_BOTTOM );
if( aVertJustify > GR_TEXT_VJUSTIFY_BOTTOM )
return GR_TEXT_VJUSTIFY_BOTTOM;
if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
return GR_TEXT_VJUSTIFY_TOP;
return (EDA_TEXT_VJUSTIFY_T) aVertJustify;
}
DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
const EDA_TEXT* aTextItem ) :
DIALOG_LIB_EDIT_TEXT_BASE( aParent )
{
SetTitle( aTitle );
// The field ID and power status are Initialized in the derived object's ctor.
m_fieldId = VALUE;
m_isPower = false;
m_text = aTextItem->GetText();
m_style = aTextItem->IsItalic() ? 1 : 0;
m_style += aTextItem->IsBold() ? 2 : 0;
m_size = aTextItem->GetSize().x;
m_orientation = ( aTextItem->GetOrientation() == TEXT_ORIENT_VERT );
m_verticalJustification = aTextItem->GetVertJustify() + 1;
m_horizontalJustification = aTextItem->GetHorizJustify() + 1;
m_isVisible = aTextItem->IsVisible();
}
void DIALOG_EDIT_ONE_FIELD::init()
{
wxString msg;
m_TextValue->SetFocus();
SCH_BASE_FRAME* parent = static_cast<SCH_BASE_FRAME*>( GetParent() );
m_TextValue->SetValidator( SCH_FIELD_VALIDATOR(
parent->IsType( FRAME_SCH_LIB_EDITOR ),
m_fieldId, &m_text ) );
// Disable options for graphic text edition, not existing in fields
// Disable options for graphic text editing which are not needed for fields.
m_CommonConvert->Show( false );
m_CommonUnit->Show( false );
msg = StringFromValue( g_UserUnit, m_textsize );
m_TextSize->SetValue( msg );
if( m_textorient == TEXT_ORIENT_VERT )
m_Orient->SetValue( true );
m_Invisible->SetValue( m_text_invisible );
m_TextShapeOpt->SetSelection( m_textshape );
SetPowerWarning( false );
switch ( m_textHjustify )
// Show the footprint selection dialog if this is the footprint field.
if( m_fieldId == FOOTPRINT )
{
case GR_TEXT_HJUSTIFY_LEFT:
m_TextHJustificationOpt->SetSelection( 0 );
break;
case GR_TEXT_HJUSTIFY_CENTER:
m_TextHJustificationOpt->SetSelection( 1 );
break;
case GR_TEXT_HJUSTIFY_RIGHT:
m_TextHJustificationOpt->SetSelection( 2 );
break;
m_TextValueSelectButton->Show();
m_TextValueSelectButton->Enable();
}
switch ( m_textVjustify )
else
{
case GR_TEXT_VJUSTIFY_BOTTOM:
m_TextVJustificationOpt->SetSelection( 0 );
break;
case GR_TEXT_VJUSTIFY_CENTER:
m_TextVJustificationOpt->SetSelection( 1 );
break;
case GR_TEXT_VJUSTIFY_TOP:
m_TextVJustificationOpt->SetSelection( 2 );
break;
m_TextValueSelectButton->Hide();
m_TextValueSelectButton->Disable();
}
msg = m_TextSizeText->GetLabel() + ReturnUnitSymbol();
m_TextSizeText->SetLabel( msg );
// Value fields of power components cannot be modified. This will grey out
// the text box and display an explanation.
if( m_fieldId == VALUE && m_isPower )
{
m_PowerComponentValues->Show( true );
m_TextValue->Enable( false );
}
else
{
m_PowerComponentValues->Show( false );
m_TextValue->Enable( true );
}
m_sdbSizerButtonsOK->SetDefault();
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
void DIALOG_EDIT_ONE_FIELD::SetPowerWarning( bool aWarn )
{
m_PowerComponentValues->Show( aWarn );
m_TextValue->Enable( ! aWarn );
Fit();
}
void DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick( wxCommandEvent& aEvent )
{
@@ -117,7 +158,6 @@ void DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick( wxCommandEvent& aEvent
if( frame->ShowModal( &fpid, this ) )
{
// DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); )
m_TextValue->SetValue( fpid );
}
@@ -125,179 +165,114 @@ void DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick( wxCommandEvent& aEvent
}
void DIALOG_LIB_EDIT_ONE_FIELD::initDlg()
bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
{
m_textsize = m_field->GetSize().x;
m_TextValue->SetValue( m_field->GetText() );
m_textorient = m_field->GetOrientation();
m_text_invisible = m_field->IsVisible() ? false : true;
wxLogDebug( "In DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()" );
m_textshape = 0;
m_TextValue->SetValue( m_text );
m_Orient->SetValue( m_orientation );
m_TextSize->SetValue( StringFromValue( g_UserUnit, m_size ) );
m_TextHJustificationOpt->SetSelection( m_horizontalJustification );
m_TextVJustificationOpt->SetSelection( m_verticalJustification );
m_Invisible->SetValue( !m_isVisible );
m_TextShapeOpt->SetSelection( m_style );
if( m_field->IsItalic() )
m_textshape = 1;
if( m_field->IsBold() )
m_textshape |= 2;
m_textHjustify = m_field->GetHorizJustify();
m_textVjustify = m_field->GetVertJustify();
if( m_field->GetId() == FOOTPRINT )
{
m_TextValueSelectButton->Show();
m_TextValueSelectButton->Enable();
}
else
{
m_TextValueSelectButton->Hide();
m_TextValueSelectButton->Disable();
}
initDlg_base();
return true;
}
wxString DIALOG_LIB_EDIT_ONE_FIELD::GetTextField()
bool DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()
{
wxString line = m_TextValue->GetValue();
wxLogDebug( "In DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()" );
// Spaces are not allowed in reference or value
if( m_field->GetId() == REFERENCE || m_field->GetId() == VALUE )
m_text = m_TextValue->GetValue();
// There are lots of specific tests required to validate field text.
if( m_fieldId == REFERENCE )
{
if( line.Replace( wxT( " " ), wxT( "_" ) ) )
// Test if the reference string is valid:
if( !SCH_COMPONENT::IsReferenceStringValid( m_text ) )
{
wxString msg;
msg.Printf( _(
"Whitespace is not permitted inside references or values (symbol names in lib).\n"
"The text you entered has been converted to use underscores: %s" ),
line
);
wxMessageDialog dlg( this, msg );
dlg.ShowModal();
DisplayError( this, _( "Illegal reference field value!" ) );
return false;
}
}
// Prevent the message from appearing twice by restuffing the text box.
m_TextValue->SetValue( line );
m_orientation = m_Orient->GetValue();
m_size = ValueFromString( g_UserUnit, m_TextSize->GetValue() );
m_horizontalJustification = m_TextHJustificationOpt->GetSelection();
m_verticalJustification = m_TextVJustificationOpt->GetSelection();
m_isVisible = !m_Invisible->GetValue();
m_style = m_TextShapeOpt->GetSelection();
return line;
return true;
}
void DIALOG_EDIT_ONE_FIELD::TransfertDataToField( bool aIncludeText )
void DIALOG_EDIT_ONE_FIELD::updateText( EDA_TEXT* aText )
{
// This method doesn't transfer text anyway.
(void) aIncludeText;
aText->SetSize( wxSize( m_size, m_size ) );
aText->SetVisible( m_isVisible );
aText->SetOrientation( m_orientation ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ );
aText->SetItalic( (m_style & 1) != 0 );
aText->SetBold( (m_style & 2) != 0 );
aText->SetHorizJustify( IntToEdaTextHorizJustify( m_horizontalJustification - 1 ) );
aText->SetVertJustify( IntToEdaTextVertJustify( m_verticalJustification - 1 ) );
}
m_textorient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
wxString msg = m_TextSize->GetValue();
m_textsize = ValueFromString( g_UserUnit, msg );
switch( m_TextHJustificationOpt->GetSelection() )
DIALOG_LIB_EDIT_ONE_FIELD::DIALOG_LIB_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
const wxString& aTitle,
const LIB_FIELD* aField ) :
DIALOG_EDIT_ONE_FIELD( aParent, aTitle, dynamic_cast< const EDA_TEXT* >( aField ) )
{
m_fieldId = aField->GetId();
// When in the library editor, power components can be renamed.
m_isPower = false;
init();
}
DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
const wxString& aTitle,
const SCH_FIELD* aField ) :
DIALOG_EDIT_ONE_FIELD( aParent, aTitle, dynamic_cast< const EDA_TEXT* >( aField ) )
{
m_fieldId = aField->GetId();
const SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
wxASSERT_MSG( component != NULL && component->Type() == SCH_COMPONENT_T,
wxT( "Invalid schematic field parent item." ) );
const LIB_PART* part = GetParent()->Prj().SchLibs()->FindLibPart( component->GetPartName() );
wxASSERT_MSG( part, wxT( "Library part for component <" ) +
component->GetPartName() + wxT( "> could not be found." ) );
m_isPower = part->IsPower();
init();
}
void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath )
{
wxASSERT( aField != NULL || aField->Type() != SCH_FIELD_T );
if( aField->GetId() == REFERENCE )
{
case 0:
m_textHjustify = GR_TEXT_HJUSTIFY_LEFT;
break;
wxASSERT( aSheetPath != NULL );
case 1:
m_textHjustify = GR_TEXT_HJUSTIFY_CENTER;
break;
SCH_COMPONENT* component = dynamic_cast< SCH_COMPONENT* >( aField->GetParent() );
case 2:
m_textHjustify = GR_TEXT_HJUSTIFY_RIGHT;
break;
wxASSERT( component != NULL );
if( component != NULL )
component->SetRef( aSheetPath, m_text );
}
switch( m_TextVJustificationOpt->GetSelection() )
{
case 0:
m_textVjustify = GR_TEXT_VJUSTIFY_BOTTOM;
break;
case 1:
m_textVjustify = GR_TEXT_VJUSTIFY_CENTER;
break;
case 2:
m_textVjustify = GR_TEXT_VJUSTIFY_TOP;
break;
}
}
void DIALOG_LIB_EDIT_ONE_FIELD::TransfertDataToField( bool aIncludeText )
{
DIALOG_EDIT_ONE_FIELD::TransfertDataToField( aIncludeText );
if( aIncludeText )
m_field->SetText( GetTextField() );
m_field->SetSize( wxSize( m_textsize, m_textsize ) );
m_field->SetOrientation( m_textorient );
m_field->SetVisible( !m_Invisible->GetValue() );
m_field->SetItalic( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 );
m_field->SetBold( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 );
m_field->SetHorizJustify( m_textHjustify );
m_field->SetVertJustify( m_textVjustify );
}
void DIALOG_SCH_EDIT_ONE_FIELD::initDlg()
{
m_textsize = m_field->GetSize().x;
m_TextValue->SetValue( m_field->GetText() );
m_textorient = m_field->GetOrientation();
m_text_invisible = m_field->IsVisible() ? false : true;
m_textshape = 0;
if( m_field->IsItalic() )
m_textshape = 1;
if( m_field->IsBold() )
m_textshape |= 2;
m_textHjustify = m_field->GetHorizJustify();
m_textVjustify = m_field->GetVertJustify();
if( m_field->GetId() == FOOTPRINT )
{
m_TextValueSelectButton->Show();
m_TextValueSelectButton->Enable();
}
else
{
m_TextValueSelectButton->Hide();
m_TextValueSelectButton->Disable();
}
initDlg_base();
}
wxString DIALOG_SCH_EDIT_ONE_FIELD::GetTextField()
{
wxString line = m_TextValue->GetValue();
line.Trim( true );
line.Trim( false );
return line;
};
void DIALOG_SCH_EDIT_ONE_FIELD::TransfertDataToField( bool aIncludeText )
{
DIALOG_EDIT_ONE_FIELD::TransfertDataToField( aIncludeText );
if( aIncludeText )
m_field->SetText( GetTextField() );
m_field->SetSize( wxSize( m_textsize, m_textsize ) );
m_field->SetOrientation( m_textorient );
m_field->SetVisible( !m_Invisible->GetValue() );
m_field->SetItalic( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 );
m_field->SetBold( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 );
m_field->SetHorizJustify( m_textHjustify );
m_field->SetVertJustify( m_textVjustify );
aField->SetText( m_text );
updateText( aField );
}
+57 -117
View File
@@ -6,7 +6,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com
* Copyright (C) 2004-2016 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
@@ -28,80 +29,42 @@
#include <dialog_lib_edit_text_base.h>
class SCH_BASE_FRAME;
class LIB_FIELD;
class SCH_FIELD;
class EDA_TEXT;
/**
* Class DIALOG_EDIT_ONE_FIELD
* is a basic class to edit a field: a schematic or a lib component field
* is a base class to edit schematic and component library fields.
* <p>
* This class is setup in expectation of its children
* possibly using Kiway player so ShowQuasiModal is required when calling
* any subclasses.
*</p>
*/
class DIALOG_EDIT_ONE_FIELD : public DIALOG_LIB_EDIT_TEXT_BASE
{
protected:
SCH_BASE_FRAME* m_parent;
int m_textshape;
int m_textsize;
int m_textorient;
EDA_TEXT_HJUSTIFY_T m_textHjustify;
EDA_TEXT_VJUSTIFY_T m_textVjustify;
bool m_text_invisible;
public:
DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle ):
DIALOG_LIB_EDIT_TEXT_BASE( aParent )
{
m_parent = aParent;
SetTitle( aTitle );
DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
const EDA_TEXT* aTextItem );
// Avoid not initialized members:
m_textshape = 0;
m_textsize = 0;
m_textorient = 0;
m_textHjustify = GR_TEXT_HJUSTIFY_CENTER;
m_textVjustify = GR_TEXT_VJUSTIFY_CENTER;
m_text_invisible = false;
}
~DIALOG_EDIT_ONE_FIELD() {}
// ~DIALOG_EDIT_ONE_FIELD() {};
virtual bool TransferDataToWindow();
/**
* Function TransfertDataToField
* Converts fields from dialog window to variables to be used by child classes
*
* @param aIncludeText Whether the valies transferred should include the actual
* item text. If this is false, formatting will be transferred, but text will
* not.
*/
virtual void TransfertDataToField( bool aIncludeText = true );
virtual bool TransferDataFromWindow();
void SetTextField( const wxString& aText )
{
m_TextValue->SetValue( aText );
}
SCH_BASE_FRAME* GetParent() { return dynamic_cast< SCH_BASE_FRAME* >( wxDialog::GetParent() ); }
/**
* Function SetPowerWarning
* Disables the Text field and displays the "Power component values cannot
* be modified!" warning, if aWarn is true. Performs the inverse if aWarn
* is false (this, however, is the default).
*
* @param aWarn whether or not to produce the warning
*/
void SetPowerWarning( bool aWarn );
const wxString& GetText() const { return m_text; }
protected:
/**
* Function initDlg_base
* Common dialog option initialization for the subclasses to call
*/
void initDlg_base();
void init();
void updateText( EDA_TEXT* aText );
/**
* Function OnTextValueSelectButtonClick
@@ -114,106 +77,83 @@ protected:
*/
void OnTextValueSelectButtonClick( wxCommandEvent& aEvent );
/// @todo Update DIALOG_SHIM to handle this transparently so no matter what mode the
/// dialogs is shown, everything is handled without this ugliness.
void OnOkClick( wxCommandEvent& aEvent )
{
EndQuasiModal( wxID_OK );
if( IsQuasiModal() )
EndQuasiModal( wxID_OK );
else
EndDialog( wxID_OK );
}
void OnCancelClick( wxCommandEvent& event )
{
EndQuasiModal( wxID_CANCEL );
if( IsQuasiModal() )
EndQuasiModal( wxID_CANCEL );
else
EndDialog( wxID_CANCEL );
}
void OnCloseDialog( wxCloseEvent& aEvent )
{
EndQuasiModal( wxID_CANCEL );
if( IsQuasiModal() )
EndQuasiModal( wxID_CANCEL );
else
EndDialog( wxID_CANCEL );
}
int m_fieldId;
bool m_isPower;
wxString m_text;
int m_style;
int m_size;
bool m_orientation;
int m_verticalJustification;
int m_horizontalJustification;
bool m_isVisible;
};
/**
* Class DIALOG_LIB_EDIT_ONE_FIELD
* is a the class to handle editing a single component field
* in the library editor.
* is a the class to handle editing a single component field in the library editor.
* <p>
* Note: Use ShowQuasiModal when calling this class!
* @note Use ShowQuasiModal when calling this class!
* </p>
*/
class DIALOG_LIB_EDIT_ONE_FIELD : public DIALOG_EDIT_ONE_FIELD
{
private:
LIB_FIELD* m_field;
public:
DIALOG_LIB_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
LIB_FIELD* aField ):
DIALOG_EDIT_ONE_FIELD( aParent, aTitle )
const LIB_FIELD* aField );
~DIALOG_LIB_EDIT_ONE_FIELD() {}
void UpdateField( LIB_FIELD* aField )
{
m_field = aField;
initDlg();
GetSizer()->SetSizeHints( this );
Centre();
aField->SetText( m_text );
updateText( aField );
}
~DIALOG_LIB_EDIT_ONE_FIELD() {};
void TransfertDataToField( bool aIncludeText = true );
/**
* Function GetTextField
* Returns the dialog's text field value with spaces filtered to underscores
*/
wxString GetTextField();
private:
/**
* Function initDlg
* Initializes dialog data using the LIB_FIELD container of data, this function is
* otherwise identical to DIALOG_SCH_EDIT_ONE_FIELD::initDlg()
*/
void initDlg( );
};
/**
* Class DIALOG_SCH_EDIT_ONE_FIELD
* is a the class to handle editing a single component field
* in the schematic editor.
* is a the class to handle editing a single component field in the schematic editor.
* <p>
* Note: Use ShowQuasiModal when calling this class!
* @note Use ShowQuasiModal when calling this class!
* </p>
*/
class DIALOG_SCH_EDIT_ONE_FIELD : public DIALOG_EDIT_ONE_FIELD
{
private:
SCH_FIELD* m_field;
public:
DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
const wxString& aTitle, SCH_FIELD* aField ):
DIALOG_EDIT_ONE_FIELD( aParent, aTitle )
{
m_field = aField;
initDlg();
GetSizer()->SetSizeHints( this );
Centre();
}
DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
const SCH_FIELD* aField );
// ~DIALOG_SCH_EDIT_ONE_FIELD() {};
~DIALOG_SCH_EDIT_ONE_FIELD() {}
void TransfertDataToField( bool aIncludeText = true );
/**
* Function GetTextField
* Retrieves text field value from dialog with whitespaced on both sides trimmed
*/
wxString GetTextField();
private:
/**
* Function initDlg
* Initializes dialog data using the SCH_FIELD container of data, this function is
* otherwise identical to DIALOG_LIB_EDIT_ONE_FIELD::initDlg()
*/
void initDlg( );
void UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath );
};
#endif // DIALOG_EDIT_ONE_FIELD_H_
+5 -3
View File
@@ -39,9 +39,6 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) :
m_choiceUnits->SetFocus();
m_sdbSizerOK->SetDefault();
// Dialog should not shrink beyond it's minimal size.
GetSizer()->SetSizeHints( this );
wxListItem col0;
col0.SetId( 0 );
col0.SetText( _( "Field Name" ) );
@@ -76,6 +73,11 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( wxWindow* parent ) :
fieldDefaultValueTextCtrl->Connect( wxEVT_KILL_FOCUS,
wxFocusEventHandler( DIALOG_EESCHEMA_OPTIONS::OnEditControlKillFocus ), NULL, this );
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}

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