Compare commits

..

916 Commits

Author SHA1 Message Date
Branislav Stojkovic bb3b37f23b patched osx component loading issue, investigate further 2019-03-25 08:21:20 +01:00
Branislav Stojkovic fcea5975a8 change backup folder name 2019-03-24 21:38:27 +01:00
Branislav Stojkovic 2294ac45a2 copy loaded file as-is to backup folder 2019-03-24 21:37:37 +01:00
Branislav Stojkovic 5598f22b2f Added "Auto-Wrap Label" component
extracted string rendering function into a separate class
2019-03-24 08:34:28 +01:00
Branislav Stojkovic 812b7adb28 remove newPoints and reuse points for backward compatibility 2019-03-23 22:44:09 +01:00
Branislav Stojkovic 9fd5a8fe96 redo relaxed validation 2019-03-23 19:11:06 +01:00
Branislav Stojkovic 0b8952e354 relax validation of control point collision while dragging 2019-03-23 18:54:44 +01:00
Branislav Stojkovic 5c47ff1ef0 added ability to include or exclude switches from netlist analyzer 2019-03-23 18:05:28 +01:00
Branislav Stojkovic b85b93404b Added mini toolbar in the top-right corner of the screen with transform
actions exposed for quick access
2019-03-22 23:37:59 +01:00
Branislav Stojkovic b46f46aa99 When pasting a group of components that contain at least one "PCB Text"
instance, some of the other components get rendered mirrored while
position the pasted components
2019-03-22 22:29:05 +01:00
Branislav Stojkovic 48266d3b27 fix the 3rd control point when copy-pasting 2019-03-22 21:04:54 +01:00
Branislav Stojkovic eb6cc76f02 make autosave params configurable 2019-03-22 20:58:27 +01:00
Branislav Stojkovic a5d512ca37 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2019-03-22 16:39:23 +01:00
Branislav Stojkovic 1d038b5f8c better log 2019-03-22 16:39:08 +01:00
Branislav Stojkovic 9366f9c602 Auto-save plugin now works by periodically creating project backups in
user\.diylc\autoSave directory and maintains file history, keeping the
last X versions of the file. Maximum size for all backups is
configurable and pre-set to 64MB
2019-03-22 16:38:01 +01:00
bancika 23b4fcae02 Update README.md 2019-03-22 10:34:55 +01:00
Branislav Stojkovic 14a994e68f Improve "Expand Selection" feature to use the same algorithm as netlists
for better precision<
2019-03-22 00:47:28 +01:00
Branislav Stojkovic 894ff1a2cb Assign new name for pasted component if the project already contains
components under that name
2019-03-20 22:35:28 +01:00
Branislav Stojkovic 78dcd27e1d Some schematic symbols (transistors, potentiometer...) get into bad
state when rotated and flipped at the same time
2019-03-20 20:06:38 +01:00
Branislav Stojkovic 714db98afa deleted old file
fixed pin rendering on some components
2019-03-20 19:27:46 +01:00
Branislav Stojkovic 2faa2c6d61 reorganized "stretchable" property into more granular control at the
point level

added controlable label to pot symbol and transistor symbols
2019-03-20 19:21:31 +01:00
Branislav Stojkovic 3c45336afe rename a function 2019-03-19 21:26:03 +01:00
Branislav Stojkovic a0601cc83d better default label position on schematic symbols 2019-03-19 19:03:21 +01:00
Branislav Stojkovic 9925d58347 keep label oriantation the same between the two modes 2019-03-18 22:57:30 +01:00
Branislav Stojkovic 6c241b3180 added third control point to leaded components to set label position 2019-03-18 22:49:27 +01:00
Branislav Stojkovic 838adc9a51 reorganize netlist code, comment out unused functions 2019-03-14 22:36:43 +01:00
Branislav Stojkovic 41d2b73cca Merge switch configurations that yield with the same effective wiring
for "Analyze Guitar Wirings" module, for more compact report
2019-03-14 22:26:49 +01:00
Branislav Stojkovic 8d3789a0b0 update file 2019-03-14 11:19:15 +01:00
Branislav Stojkovic 95f65dcdf1 scan library folder for more jars 2019-03-14 11:14:32 +01:00
Branislav Stojkovic 3d0f9554b0 Honor all possible combinations of "DIP Switch" positions when creating
a netlist
2019-03-14 10:32:51 +01:00
Branislav Stojkovic 0c21e013b4 improve node display for single point componenets 2019-03-14 10:03:04 +01:00
Branislav Stojkovic f8e24b0937 Improve performance of netlist calculations 2019-03-14 00:08:39 +01:00
Branislav Stojkovic 37d5ce18fc Z-order of components sometimes gets wrong when importing a DIY file
into another file
2019-03-13 21:24:55 +01:00
Branislav Stojkovic e9a2785344 Honor "Terminal Strip" connectivity when creating a netlist 2019-03-13 20:54:24 +01:00
Branislav Stojkovic 4de3b6d97c Output SPICE node names in the "Nxxx" format
join all nodes connected to GND together
2019-03-13 19:23:35 +01:00
Branislav Stojkovic 92a2bb9809 fix "Ground Symbol" jumping 2019-03-10 22:58:36 +01:00
Branislav Stojkovic 440b953531 fix orientation parsing 2019-03-10 22:53:01 +01:00
Branislav Stojkovic 1bc11e09ab release 2019-03-10 22:36:09 +01:00
Branislav Stojkovic f20b896184 release 2019-03-10 22:32:34 +01:00
Branislav Stojkovic 49d93b42a4 update.xml 2019-03-10 17:51:21 +01:00
Branislav Stojkovic b279510e5c Detect when a file is created with a newer version of DIYLC and show a
warning

Force correct prefix for transistors in spice
2019-03-10 09:03:22 +01:00
Branislav Stojkovic a83cda9ecd custom XStream converters for more compact files 2019-03-09 21:45:34 +01:00
Branislav Stojkovic f63b422a8c Cleaner XML format for .DIY files with less cross-references
pinout update
2019-03-09 20:15:36 +01:00
Branislav Stojkovic 7af919b303 move section handling to base component interface
do analysis in background thread
2019-03-09 18:01:42 +01:00
Branislav Stojkovic 1c1ec2fcf5 refactor transistor packages with a base class, add pinouts 2019-03-09 17:24:34 +01:00
Branislav Stojkovic 8ccdd84a6f add support to map DIYLC pin indices to spice 2019-03-09 16:47:18 +01:00
Branislav Stojkovic 54ff518438 basic implementation of spice exporter 2019-03-09 14:46:00 +01:00
Branislav Stojkovic c893b37fdf don't show favorites for categories 2019-03-09 11:27:15 +01:00
Branislav Stojkovic 81e259bb62 fix the sorting for favorites 2019-03-09 11:24:44 +01:00
Branislav Stojkovic d5aac6b265 When in "Highlight Connected Area" mode, the status bar shows useful
information making it harder to forget what the mode does
2019-03-09 11:19:32 +01:00
Branislav Stojkovic d544797047 Ability to tag components and building blocks as favorites 2019-03-09 10:42:39 +01:00
Branislav Stojkovic 8ed2c0c9a5 "Mini Toggle Switch" doesn't reset body size after changing terminal
spacing
2019-03-08 18:36:37 +01:00
Branislav Stojkovic 2d1cf515d6 "Highlight Connected Areas" doesn't follow multiple chained wires and
jumpers
2019-03-06 00:15:53 +01:00
Branislav Stojkovic 2553ffbba7 z-order of building blocks 2019-03-04 10:34:53 +01:00
Branislav Stojkovic 04418f8101 fix update file 2019-03-02 21:02:24 +01:00
Branislav Stojkovic c548a35939 3.55 release 2019-03-02 20:59:38 +01:00
Branislav Stojkovic 777f4aa3fd protect PropertyWrapper writeTo call 2019-03-02 15:55:24 +01:00
Branislav Stojkovic c0c226c580 improve tree analysis 2019-03-02 12:48:10 +01:00
Branislav Stojkovic 40d234d1c4 <org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
					<description>Increase the range of zoom slider for images to
500%</description>
				</org.diylc.appframework.update.Change>
2019-03-02 12:32:42 +01:00
Branislav Stojkovic bc0d759d39 detect volume and tone pots 2019-03-02 12:31:02 +01:00
Branislav Stojkovic b3497cdca8 Fix lever switch rotation issue
Render pickup name instead of model

Netlist algorithm would sometimes create overlapping groups of nodes
which are supposed to be merged
2019-03-02 09:11:00 +01:00
Branislav Stojkovic cc0f698c8b detect humbucking or split mode 2019-03-01 20:49:07 +01:00
Branislav Stojkovic b0123db3e7 Fixed bug with "Highlight Continuity Areas" that makes random components
conductive
2019-03-01 09:51:55 +01:00
Branislav Stojkovic c9a32cc390 better handling for cold start without logs folder 2019-02-28 23:40:29 +01:00
Branislav Stojkovic 46d9e1f82a improve pickup label rendering 2019-02-28 23:34:02 +01:00
Branislav Stojkovic 9596d6ca8e "Analyze Guitar Wiring" can figure out if wiring is hum-cancelling and
in or out of phase for each position
2019-02-28 22:26:12 +01:00
Branislav Stojkovic 65315ed559 fix connectivity 2019-02-28 21:26:41 +01:00
Branislav Stojkovic 57bce6b8e5 Added 4-position Tele switch type to the "Lever Switch" component 2019-02-28 21:25:21 +01:00
Branislav Stojkovic 403d0ea433 Added two or four terminal hookup to bass pickups types 2019-02-28 19:11:02 +01:00
Branislav Stojkovic 595cfb3ed1 Increase the range of zoom slider for images to 500% 2019-02-28 17:36:04 +01:00
Branislav Stojkovic 2c689c584d Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2019-02-27 19:23:09 +01:00
Branislav Stojkovic 84eaa1bf29 reuse awg calcs 2019-02-27 19:20:37 +01:00
Branislav Stojkovic 20e01762b8 Show wire diameter in mm and in next to AWG gauge 2019-02-27 19:16:44 +01:00
Branislav Stojkovic 08aec6fa9b startup fix 2019-02-26 23:27:32 +01:00
bancika f51d19b39a Update README.md 2019-02-26 16:47:41 +01:00
Branislav Stojkovic 8bfb3ade55 fix array comparison for byte[] 2019-02-26 16:20:40 +01:00
bancika 3847813351 Update README.md 2019-02-26 15:38:31 +01:00
Branislav Stojkovic 67761b1027 error handling for analyzer 2019-02-26 10:25:20 +01:00
Branislav Stojkovic 7cca8f86b2 build 3.54 2019-02-26 10:10:42 +01:00
Branislav Stojkovic 39976ec3d6 tests 2019-02-25 15:28:10 +01:00
Branislav Stojkovic a155aef596 fix bom test 2019-02-25 11:10:36 +01:00
Branislav Stojkovic b24bfafb39 add unit tests for netlist 2019-02-25 11:05:15 +01:00
Branislav Stojkovic 31ce46f147 minor image update 2019-02-24 14:49:35 +01:00
Branislav Stojkovic ce43a5d2e6 Improve performance of "Image" component and greatly reduce file size
when images are present
2019-02-24 14:32:30 +01:00
Branislav Stojkovic 0d007e5737 tree construction improvement 2019-02-24 13:15:30 +01:00
Branislav Stojkovic c0dac1a1db generate connectivity tree 2019-02-23 17:40:15 +01:00
Branislav Stojkovic ec7244042d wiring analysis improvements 2019-02-17 09:31:42 +01:00
Branislav Stojkovic 88275e95e2 wiring analysys, ground work 2019-02-17 01:37:37 +01:00
Branislav Stojkovic add8566d4f netlist summarizer infrastructure added 2019-02-17 00:13:22 +01:00
Branislav Stojkovic c5495ad14f Version 3.53 would not start unless there was an older version running
on the same machine before
2019-02-16 23:04:38 +01:00
Branislav Stojkovic 94f1c68c7b pickup improvements 2019-02-16 22:14:08 +01:00
Branislav Stojkovic 3e67515f69 improved netlist display
minor component updates
2019-02-16 20:12:44 +01:00
Branislav Stojkovic 2091b8a03d add terminal labels to pickups 2019-02-16 18:41:22 +01:00
Branislav Stojkovic 235acf538f Added ability to mark common lugs on all "Lever Switch" types with a
different color

add switch logic to lever switch
2019-02-16 17:04:09 +01:00
Branislav Stojkovic 45404aaabd add center-off switch types 2019-02-16 16:05:15 +01:00
Branislav Stojkovic 2727276a09 minor rendering improvement for LP switch 2019-02-16 12:27:11 +01:00
Branislav Stojkovic cb6aa83269 better netlist html format 2019-02-16 12:15:52 +01:00
Branislav Stojkovic 39daa9e61f LP switch updates 2019-02-16 12:12:08 +01:00
Branislav Stojkovic 8313a62324 added netlist menu item and dialog 2019-02-16 12:11:54 +01:00
Branislav Stojkovic c1d718a0f9 add netlist support to LP switch 2019-02-16 11:46:47 +01:00
Branislav Stojkovic 6e5174750f rename graph-related stuff into netlists 2019-02-16 09:40:55 +01:00
Branislav Stojkovic 1cfb30f35e pickup graph improvements 2019-02-16 09:14:49 +01:00
Branislav Stojkovic ddfc615a6a graph improvmeents 2019-02-15 23:39:54 +01:00
Branislav Stojkovic f53ad8c206 Allow a file to be loaded if it references a missing component property,
but show a warning.
2019-02-15 23:23:12 +01:00
Branislav Stojkovic 20645fed13 fix switched jack point location
proper node names
2019-02-15 22:52:36 +01:00
Branislav Stojkovic d3c2e20359 new app-framework 2019-02-15 21:48:26 +01:00
Branislav Stojkovic 46f693addf ground work for graph analysis 2019-02-15 20:25:57 +01:00
Branislav Stojkovic 008ee8564b another build 2019-02-09 19:19:11 +01:00
Branislav Stojkovic b234015a32 build 2019-02-09 19:06:56 +01:00
Branislav Stojkovic bb69d8dd04 upgrade variants to new format on start
fix for variant export
2019-02-09 18:55:34 +01:00
Branislav Stojkovic b02eaf928d sort blocks and variants alphabetically 2019-02-09 17:53:38 +01:00
Branislav Stojkovic 2c4ff547fe spell 2019-02-09 17:45:56 +01:00
Branislav Stojkovic ca78cd030b add check list dialogs when exporting blocks and variants 2019-02-09 17:44:15 +01:00
Tim Savage 51a12d61e1 Allow the origin of co-ordinates on boards to be specified (#428)
* Added support to specific co-ordinate origin.

Added the Coordinate origin property to the AbstractBoard class,
this allows the user to specify the corner (TopLeft, TopRight,
BottomLeft, BottomRight) cordinates should increment from.

Updated rendering to reflect this change.

* Use the coordinate origin setter method

To safely handle the case when a project produced with an earlier
verison of the application is loaded and the coordinate origin attribute
is set to NULL.
2019-02-09 15:53:11 +01:00
Branislav Stojkovic 661e5e2403 jack variants 2019-02-09 12:48:37 +01:00
Branislav Stojkovic ae8d015a78 ground work for air-core inductors 2019-02-09 12:46:11 +01:00
Branislav Stojkovic 59096d69ed Do not allow zero for size and spacing properties that could lead to
crashes or unexpected behavior
2019-02-09 10:20:11 +01:00
Branislav Stojkovic 66e1227182 fix eyelet and turret not setting their own stroke 2019-02-09 10:09:48 +01:00
Branislav Stojkovic 19bdf41655 fix shortcuts 2019-02-09 10:02:32 +01:00
Branislav Stojkovic 0acca63ccd prettier variant and block display 2019-02-09 09:47:13 +01:00
Branislav Stojkovic 6d2e876381 Better rendering of TO-3 transformer package 2019-02-08 23:42:09 +01:00
Branislav Stojkovic 13f13191c4 Add switched type to "Open 1/4" Jack" component 2019-02-08 23:01:00 +01:00
Branislav Stojkovic 86500cb4a0 import/export variants and building blocks 2019-02-08 22:44:26 +01:00
Branislav Stojkovic f7e5421f18 flip rca pins 2019-02-08 17:25:40 +01:00
Branislav Stojkovic c7bc8360ba RCA Jack" added 2019-02-08 14:40:33 +01:00
Branislav Stojkovic d91527a91c improve coordinates 2019-02-08 11:26:57 +01:00
Branislav Stojkovic 9e760ba655 shade extra space 2019-02-08 11:24:22 +01:00
Branislav Stojkovic 9a2585d23f refine zero location 2019-02-08 11:23:02 +01:00
Branislav Stojkovic 83723dd416 align rulers with extra space 2019-02-08 11:09:24 +01:00
Branislav Stojkovic 7597143b1b "Select All" menu option from the component tree context menu doesn't
work
2019-02-08 10:29:23 +01:00
Branislav Stojkovic 0cb4377830 Show mouse position in the status bar 2019-02-08 09:56:48 +01:00
Branislav Stojkovic fbf2569a7e ground work for graph analysis 2019-02-08 09:21:32 +01:00
Branislav Stojkovic 290406609b ground work for potentiometer views 2019-02-08 09:20:11 +01:00
Branislav Stojkovic 417c389b0a Components do not load if the installation directory name contains a
special character, like '!'
2019-02-07 00:07:58 +01:00
Branislav Stojkovic 1af44eadfc fix zooming 2019-02-06 23:26:33 +01:00
Branislav Stojkovic 364010ae63 new variants for tubes 2019-02-06 00:12:53 +01:00
Branislav Stojkovic 7fb78237fb invoke later to make sure that scrolling to center is done properly 2019-02-05 17:48:16 +01:00
Branislav Stojkovic c120bc10ed Better rendering of guitar pickups when dragging and in outline mode 2019-02-05 17:23:44 +01:00
Branislav Stojkovic 9c81ad0eec show warning message when config file is bad 2019-02-05 16:54:21 +01:00
Branislav Stojkovic bb564248d9 fix selection bounds
increase extra area
2019-02-05 14:54:39 +01:00
Branislav Stojkovic 3deb988a06 allow extra space around the layout
introduced ability to render just the visible part of the layout for
better performance
2019-02-05 12:04:16 +01:00
Branislav Stojkovic ae3e698d9e track shaped components while dragging 2019-02-05 12:01:55 +01:00
Branislav Stojkovic 2735d7e343 optimize tube area tracking 2019-02-05 00:34:56 +01:00
Branislav Stojkovic f4cc0ca360 tube socket extract constants 2019-02-04 18:48:40 +01:00
Branislav Stojkovic 99b7dbb6f3 editable label color for tubes 2019-02-04 15:15:12 +01:00
Branislav Stojkovic e3ca5244fe libs 2019-02-03 19:55:05 +01:00
Branislav Stojkovic a0b78a5e3d better pin rendering 2019-02-03 19:45:29 +01:00
Branislav Stojkovic 81b299865c improve drag&drop 2019-02-03 19:37:38 +01:00
Branislav Stojkovic 3027753225 backup config file on error 2019-02-03 11:47:05 +01:00
Branislav Stojkovic 13997ee757 v3.52 release 2019-02-03 11:33:17 +01:00
Branislav Stojkovic 8c09fe72e6 optimize performance when rendering stripes 2019-02-03 10:40:55 +01:00
Branislav Stojkovic 6e9169242a dnd improvements 2019-02-03 09:58:19 +01:00
Branislav Stojkovic 91389ef09b cancel d&d when dropped back to the tree 2019-02-03 00:54:53 +01:00
Branislav Stojkovic 921b503057 add striped option for twisted pair 2019-02-02 23:24:06 +01:00
Branislav Stojkovic efceedc924 Added confirmation dialog before deleting a building block
Fix the exception on block delete
2019-02-02 21:31:38 +01:00
Branislav Stojkovic cad26211b3 add comments 2019-02-02 21:13:04 +01:00
Branislav Stojkovic 36259bc83b tighter twists 2019-02-02 20:49:04 +01:00
Branislav Stojkovic 024ede48a8 fix path decomposition 2019-02-02 20:46:12 +01:00
Branislav Stojkovic b44c3bad62 twisted leads added 2019-02-02 20:41:25 +01:00
Branislav Stojkovic 0741f4334b add null protection 2019-02-02 12:47:50 +01:00
Branislav Stojkovic 46f20a75ec better status bar text when dragging a component from the tree 2019-02-02 12:44:59 +01:00
Branislav Stojkovic 34ea20eedd Ability to drag components directly from the tree to the canvas for
faster process
2019-02-02 12:18:37 +01:00
Branislav Stojkovic 08a0e451e7 "Fuse Symbol" added 2019-02-01 22:54:47 +01:00
Branislav Stojkovic 53eb70e693 improve precision of exported files 2019-01-31 13:43:18 +01:00
Branislav Stojkovic 1b8a72d24a "PCB Text" components are not included in trace mask exports 2019-01-28 13:00:35 +01:00
Branislav Stojkovic 04840bac7b Update dialog doesn't show up when clicked on the light bulb icon in the
status bar
2019-01-28 11:49:06 +01:00
Branislav Stojkovic 0a97b53f60 3.51 release 2019-01-28 11:40:38 +01:00
Branislav Stojkovic 4d3f2968c1 Lead alignment sometimes gets rendered off by 1px for resistor and
capacitor schematic symbol
2019-01-28 11:32:34 +01:00
Branislav Stojkovic d5f3457c43 Jumper color switches to red on its own 2019-01-28 10:59:34 +01:00
Branislav Stojkovic 0c76b93db0 Reverted Ohm symbol changes that made it render wrong on some systems 2019-01-26 15:40:55 +01:00
Branislav Stojkovic 197f9ca216 Better selection rendering for a few components, mostly
electro-mechanical
2019-01-23 23:20:14 +01:00
Branislav Stojkovic c8af6dbbb2 fix release date 2019-01-23 11:28:59 +01:00
Branislav Stojkovic 0a444f5ee7 3.50 release 2019-01-23 10:57:23 +01:00
Branislav Stojkovic f0172f9adc 3.50 release 2019-01-23 10:56:59 +01:00
Branislav Stojkovic 5c9754baf4 Do not render various jack components as completely transparent while
dragging
2019-01-23 10:53:00 +01:00
Branislav Stojkovic ef5bde9091 Since 3.49, some capacitor variants have disappeared. The fix brings
them back
2019-01-23 10:51:51 +01:00
Branislav Stojkovic a4efb57452 added pilot lamp holder 2019-01-21 10:29:47 +01:00
Branislav Stojkovic 58aa0ab5be track board area while dragging 2019-01-20 10:47:27 +01:00
Branislav Stojkovic 32b2713732 board coordinate improvements 2019-01-20 10:30:19 +01:00
Branislav Stojkovic cb21392d1e more accurate pin spacing calc for radial components 2019-01-19 10:02:48 +01:00
Branislav Stojkovic 149cdbca48 added radial and toroidal inductor 2019-01-19 00:58:51 +01:00
Branislav Stojkovic 73e4d6fc93 log version at start 2019-01-19 00:53:20 +01:00
Branislav Stojkovic 08bc4f5170 apply hw acceleration preferences on start 2019-01-18 23:38:33 +01:00
Branislav Stojkovic 813baee504 fix: straight traces are rendered 1px thinner than curved traces of the
same thickness
2019-01-18 20:49:51 +01:00
Branislav Stojkovic 74e524e98c fix version loader 2019-01-18 12:55:34 +01:00
Branislav Stojkovic a8f5155acd better board coordinate placement 2019-01-18 11:00:54 +01:00
Branislav Stojkovic dd06195035 fix recent versions 2019-01-18 10:26:10 +01:00
Branislav Stojkovic 19ea23895b show recent updates, added to status bar and help menu 2019-01-18 09:58:35 +01:00
Branislav Stojkovic 61444db46d Ability to flip letters and numbers for board coordinates 2019-01-17 23:47:03 +01:00
Branislav Stojkovic 54e991891d transformer icon improvement 2019-01-17 22:24:51 +01:00
Branislav Stojkovic ba735dd350 added audio transformer 2019-01-17 22:21:30 +01:00
Branislav Stojkovic 6b1913fd5b better cursors for scroll 2019-01-17 16:26:33 +01:00
Branislav Stojkovic c6f6aa9186 improve enclosure variants 2019-01-17 15:30:42 +01:00
Branislav Stojkovic ef51c44e54 improve mouse scroll 2019-01-17 14:50:13 +01:00
Branislav Stojkovic 5dc911776c Configurable hw acceleration 2019-01-17 11:08:17 +01:00
Branislav Stojkovic 9757e81500 Chrome-style cursors for mouse scrolling with arrows showing the exact
scrolling direction
2019-01-17 10:45:31 +01:00
Branislav Stojkovic 46f8506c39 Added few pedal enclosure variants 2019-01-17 00:29:43 +01:00
Branislav Stojkovic f1ccfa86c0 Fixed the issue with Ohm symbol rendering with some fonts and changed
default project font back to "Square721 BT"
2019-01-17 00:01:51 +01:00
Branislav Stojkovic 5b2a9c0e43 Better color band rendering on resistors and smarter label positioning 2019-01-16 23:55:52 +01:00
Branislav Stojkovic 81a6cf282b move mouse scroll logic to RulerScrollPane 2019-01-15 23:57:25 +01:00
Branislav Stojkovic 984edc196b Middle mouse click activates mouse movement scroll mode, similar to web
browsers
2019-01-15 23:37:56 +01:00
Branislav Stojkovic e5fff0b538 mini recto update 2019-01-15 23:13:13 +01:00
Branislav Stojkovic 26c3c488e0 br3 improvements 2019-01-15 23:05:03 +01:00
Branislav Stojkovic 62bb6aac05 BR3 rectifier improvement 2019-01-15 22:57:54 +01:00
Branislav Stojkovic 1a1e8ae56f photo diode minor improvement 2019-01-15 22:53:10 +01:00
Branislav Stojkovic 7a8e25ab39 Ability to flip polarity of IC symbol 2019-01-15 22:43:20 +01:00
Branislav Stojkovic 7b47a747bf added BR-3 rectifier 2019-01-15 19:24:15 +01:00
Branislav Stojkovic c4b66f5995 added bridge rectifier 2019-01-15 00:55:07 +01:00
Branislav Stojkovic 97cc9ca6c8 sil ic alpha rendering 2019-01-14 21:18:17 +01:00
Branislav Stojkovic 252b9ef560 remove fuse param for IEC 2019-01-14 21:16:22 +01:00
Branislav Stojkovic 77d038cef9 Use transparency instead of rendering pins on top of transistor body 2019-01-14 21:11:12 +01:00
Branislav Stojkovic 6ce5d305f1 consolidate component names 2019-01-14 21:03:53 +01:00
Branislav Stojkovic 2d0eb136fe "Fuse Holder" added 2019-01-14 13:40:34 +01:00
Branislav Stojkovic 4c03d9f658 new fonts
cleaner lead rendering
3D shading for leaded components
2019-01-14 00:25:20 +01:00
Branislav Stojkovic c5c4d6c04e hardware acceleration enabled for canvas and ruler 2019-01-14 00:12:13 +01:00
Branislav Stojkovic c7f468a0bc Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2019-01-13 21:38:50 +01:00
Branislav Stojkovic 41b670616c Changed default project font again to "Lucida Console" because
"Square721 BT" doesn't render Ohm symbol properly
2019-01-13 21:38:42 +01:00
bancika f62de41a95 Merge pull request #400 from cjwatson/patch-1
Fix snapcraft.yaml indentation
2019-01-13 19:32:24 +01:00
Colin Watson e6bdedfaea Fix snapcraft.yaml indentation
The previous version of the file didn't parse as valid YAML.
2019-01-13 18:28:21 +00:00
Branislav Stojkovic e2e33a1b13 fix update file 2019-01-13 18:26:05 +01:00
Branislav Stojkovic 2266dadcba Added optional arrow to the "Line" component together with configurable
thickness
2019-01-13 18:24:04 +01:00
Branislav Stojkovic 149f05f20c spell fix 2019-01-13 12:04:26 +01:00
Branislav Stojkovic 539b3c68de 3.48 release 2019-01-13 12:01:36 +01:00
Branislav Stojkovic 185eb9d1d3 added IEC socket 2019-01-13 11:59:20 +01:00
Branislav Stojkovic 9525505865 dip updated 2019-01-12 13:33:45 +01:00
Branislav Stojkovic a91e8dd062 "DIP Switch" added 2019-01-12 13:31:28 +01:00
Branislav Stojkovic 5ce3d6d4b3 consolidate case for property labels 2019-01-12 10:46:50 +01:00
Branislav Stojkovic facf816458 Do not allow negative values for properties indicating a size 2019-01-12 10:21:55 +01:00
Branislav Stojkovic afadc5e171 "Logic Gate (symbol)" added with 8 main gate types 2019-01-11 23:45:00 +01:00
Branislav Stojkovic a91eb15837 separate splash into a separate class 2019-01-11 20:39:12 +01:00
Branislav Stojkovic cd74e417a9 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2019-01-11 20:11:22 +01:00
Branislav Stojkovic 7ca6eb0e2f Some actions do not register with Undo/Redo mechanism: project font,
layer settings, group/ungroup.
2019-01-11 20:10:25 +01:00
bancika 78600f1c24 Update snapcraft.yaml 2019-01-11 15:38:33 +01:00
bancika 7aa6f31e67 Update snapcraft.yaml 2019-01-11 15:37:58 +01:00
bancika e91dc72424 Create diylc.desktop 2019-01-11 15:36:32 +01:00
bancika f9e2c1f1fa Create diylc.sh 2019-01-11 15:35:44 +01:00
bancika bc49daf1be Update snapcraft.yaml 2019-01-11 15:35:11 +01:00
bancika dc07d2732b Update snapcraft.yaml 2019-01-11 15:33:07 +01:00
Branislav Stojkovic 2f76bb8446 Filtertron pickup type added within "Humbucker Pickup" as well as screw
pole pieces for all humbucker types

renamed Schematic category
2019-01-11 00:48:58 +01:00
Branislav Stojkovic cc286f9c41 default ctor 2019-01-10 23:31:26 +01:00
Branislav Stojkovic 42ca1926e1 fix 3-legged symbols 2019-01-10 19:53:34 +01:00
Branislav Stojkovic 007a52f0b5 When loaded from an existing file "Potentiometer Symbol" doesn't retain
the specified orientation
2019-01-10 19:47:22 +01:00
Branislav Stojkovic 7caadec1ec Added "Label Orientation" property to leaded components that can be used
to force labels to be rendered horizontally instead of following
component placement direction
2019-01-10 18:44:23 +01:00
Branislav Stojkovic 0f3f2a350b tantalum cap improvements 2019-01-10 18:22:14 +01:00
Branislav Stojkovic bfe044f3f6 add tantalum cap 2019-01-10 18:06:57 +01:00
Branislav Stojkovic 4eda278bc0 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2019-01-10 11:27:29 +01:00
Branislav Stojkovic 3379987a74 Project font gets reverted to "Square721 BT" on Undo 2019-01-10 11:26:34 +01:00
bancika c6b2cba3aa Update ISSUE_TEMPLATE.md 2019-01-09 16:43:53 +01:00
Branislav Stojkovic a6538947d0 Render capacitor polarity markings properly when zommed in 2019-01-09 16:09:07 +01:00
Branislav Stojkovic 54e97b9adc no poles for humbuckers 2019-01-09 16:00:21 +01:00
Branislav Stojkovic 4ebd1deed4 Ability to have "Single-coil Pickup" with no poles, similar to Lace
Sensors
2019-01-09 15:55:56 +01:00
Branislav Stojkovic af2195798f Render resistor color bands properly when zommed in 2019-01-09 15:52:30 +01:00
Branislav Stojkovic c7a04075f4 "P-Bass Pickup" added 2019-01-09 15:41:32 +01:00
Branislav Stojkovic ebf988eaba "Jazz Bass Pickup" added 2019-01-09 14:23:15 +01:00
Branislav Stojkovic 0cd9f97e70 re-arranged 2019-01-09 11:20:13 +01:00
Branislav Stojkovic 40d9b296da another spell 2019-01-09 11:19:14 +01:00
Branislav Stojkovic 3f8dee89bb spell fix 2019-01-09 11:18:49 +01:00
Branislav Stojkovic 82d265e457 release 2019-01-09 11:16:20 +01:00
Branislav Stojkovic 6aa63d3a7b Changed default font to "Square721 BT" that looks more techincal and is
packaged with the app
2019-01-09 11:08:09 +01:00
Branislav Stojkovic fdc76c80cf change default font for labels 2019-01-09 10:59:56 +01:00
Branislav Stojkovic a574eac4e6 add default fonts 2019-01-09 10:55:07 +01:00
Branislav Stojkovic beb6c4857d improve multi-section cap
add more variants
2019-01-09 10:41:38 +01:00
Branislav Stojkovic 8e5b4b0ecc sort variants alphabetically 2019-01-09 10:39:55 +01:00
Branislav Stojkovic a92c6de926 2w metal oxide resistor variant 2019-01-08 16:55:34 +01:00
Branislav Stojkovic e38f4121b9 added resistor variants 2019-01-08 16:26:58 +01:00
Branislav Stojkovic bd40ad7dda component renamed 2019-01-07 23:59:45 +01:00
Branislav Stojkovic 767df37286 Right-click rotate while placing components on the canvas now applies to
tube sockets as wel
2019-01-07 23:55:51 +01:00
Branislav Stojkovic fc33be65ab rename template->variant in the code 2019-01-07 23:51:22 +01:00
Branislav Stojkovic a4639d3f1a keep defaults for variants separate 2019-01-07 23:39:36 +01:00
Branislav Stojkovic 405f8367df Covered humbucker pickup throwing errors when rotated 2019-01-07 23:39:15 +01:00
Branislav Stojkovic dbf3a1e64d add "variants.xml" to builds 2019-01-07 11:39:04 +01:00
Branislav Stojkovic 82d5c4436e add a parameter to automatically store variants to variants.xml 2019-01-07 11:37:27 +01:00
Branislav Stojkovic e541026656 Made it possible for DIYLC to come with predefined component variants in
addition to user-specific variants
2019-01-07 10:50:59 +01:00
Branislav Stojkovic 8be8c23213 Added visual indicator to the component tree showing how many variants,
if any, exist for a component

Rename multi-section cap class
2019-01-07 10:35:55 +01:00
Branislav Stojkovic 54b0519f09 cap can improvements 2019-01-06 15:12:30 +01:00
Branislav Stojkovic 41a2f3ed78 include themes for windows 2019-01-06 14:23:04 +01:00
Branislav Stojkovic 8dd1b74f96 multi-section can caps 2019-01-06 14:16:50 +01:00
Branislav Stojkovic b9613fa72d add support for multi-line text drawing 2019-01-06 14:16:03 +01:00
Branislav Stojkovic 295504d7d9 measure array editor support 2019-01-03 17:21:54 +01:00
Branislav Stojkovic ea00c503ee Fix "Mouse Wheel Zoom" feature that got broken in 3.46.1 2019-01-01 20:46:07 +01:00
Branislav Stojkovic 162980da67 one more ctrl/command place 2018-12-26 22:32:25 +01:00
Branislav Stojkovic f2cd0f2a56 Revert unintentional change for MacOs for "command" and "control" keys
for zooming and selection
2018-12-26 22:28:21 +01:00
Branislav Stojkovic d38d2f9b1b doc 2018-12-26 12:16:18 +01:00
Branislav Stojkovic 22e59d991c release 2018-12-26 12:13:16 +01:00
Branislav Stojkovic 1ffd9b50a8 Oval solder pads 2018-12-25 23:56:25 +01:00
Branislav Stojkovic 1268f83f5e Rotate commands now apply to "Label" and "PCB Text" components 2018-12-25 23:47:44 +01:00
Branislav Stojkovic ce0ac2460c Ctrl + click doesn't add components to the selection in MacOS 2018-12-25 23:40:05 +01:00
Branislav Stojkovic e9615d4d64 don't group pasted components
fix: click twice on a building block makes components jump to top-left
various minor updates
2018-12-25 16:49:18 +01:00
Branislav Stojkovic 48a6857738 Better error handing in V2 file importer 2018-12-25 12:26:17 +01:00
Branislav Stojkovic b489adf7c7 Vastly improve performance of selection aree calculations, especially
with bigger layouts
2018-12-25 11:41:09 +01:00
Branislav Stojkovic 1cfe2ee99a release 2018-12-25 10:26:01 +01:00
Branislav Stojkovic 9888d5f4c8 release 3.45.0 2018-12-25 10:11:12 +01:00
Branislav Stojkovic ac1c68c7c1 "Recent Files" causes the whole menu to be rendered at two places under
MacOS
2018-12-24 22:54:35 +01:00
Branislav Stojkovic 4a3304a20e Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2018-12-24 22:44:59 +01:00
Branislav Stojkovic f8a9171e12 doc 2018-12-24 22:44:49 +01:00
bancika 79abef597b Update ISSUE_TEMPLATE.md 2018-12-24 14:38:00 +01:00
bancika 5593804a6f Update ISSUE_TEMPLATE.md 2018-12-24 14:37:46 +01:00
bancika abb6fabf39 Update ISSUE_TEMPLATE.md 2018-12-24 14:37:15 +01:00
bancika 1566fc07b4 Create ISSUE_TEMPLATE.md 2018-12-24 14:35:58 +01:00
Branislav Stojkovic b0e986b4f9 Changed the way fonts are initialized, hoping to reduce a chance of
dialogs hanging
2018-12-24 09:18:15 +01:00
Branislav Stojkovic fb0dc31b98 comment 2018-12-24 00:43:57 +01:00
Branislav Stojkovic 1188a2e3c6 Reverted undesired change for four-point curved traces and wires which
made them slightly more curved than before
2018-12-24 00:40:10 +01:00
Branislav Stojkovic 56a97f28b9 null area better log 2018-12-23 13:25:37 +01:00
Branislav Stojkovic 1c36acf6db Fixed selection issues on right click in OSX 2018-12-22 14:45:07 +01:00
Branislav Stojkovic f07fd9c5e6 version file 2018-12-21 20:45:10 +01:00
Branislav Stojkovic 27a24b45b3 fix OSX build error 2018-12-21 20:37:51 +01:00
Branislav Stojkovic c567342aaa libs 2018-12-19 09:38:25 +01:00
Branislav Stojkovic d9b7dda449 fix update file 2018-12-18 19:26:12 +01:00
Branislav Stojkovic 99f2482b39 Center visible area to the selection when using mouse wheel to zoom in
and out
2018-12-18 19:18:39 +01:00
Branislav Stojkovic aadc9e394d All file export actions (PNG, PDF, BOM...) take the current file name as
a default
2018-12-18 18:55:59 +01:00
Branislav Stojkovic 3fec176fc1 Added few chassis-related components under "Electromechanical" category
fixed thin line style when zoomed in
2018-12-18 18:38:39 +01:00
Branislav Stojkovic 680397b44f Change mouse cursor when in "Highlight Connected Areas" mode to avoid
confusion
2018-12-18 10:20:40 +01:00
Branislav Stojkovic f94691bb0e Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2018-12-18 00:20:43 +01:00
Branislav Stojkovic e1c30b93ec added dashed/dotted lines
added 5 and 7-point curves
2018-12-18 00:20:33 +01:00
bancika ec2a85f8d8 Update README.md 2018-12-17 14:14:45 +01:00
bancika a6e4edcb61 Update README.md 2018-12-17 14:13:35 +01:00
bancika 8559843f2d Update README.md 2018-12-17 14:13:03 +01:00
bancika c58b27b5a2 Update README.md 2018-12-17 14:10:54 +01:00
bancika 95687438f9 Update README.md 2018-12-17 14:10:02 +01:00
bancika 14de8ea270 Update README.md 2018-12-17 14:09:34 +01:00
Branislav Stojkovic ce64cb46e7 adding turret 2018-12-17 14:01:24 +01:00
Branislav Stojkovic 97babd38cc improve hint dialog 2018-12-17 00:45:23 +01:00
Branislav Stojkovic d8b7e99044 add usage tips 2018-12-17 00:18:14 +01:00
Branislav Stojkovic 2bf7de07f3 update.xml fix 2018-12-16 19:09:00 +01:00
Branislav Stojkovic fd75174d6d update file 2018-12-16 17:52:53 +01:00
Branislav Stojkovic 1cbb1b8200 show announcements for the whole day 2018-12-16 17:49:15 +01:00
Branislav Stojkovic 6c61b5219f enhance continuity highlight functionality
expand to more components
2018-12-16 17:33:37 +01:00
Branislav Stojkovic 7575ae29d9 go back to java 6 compatible code 2018-12-16 11:02:20 +01:00
Branislav Stojkovic 745901131e File chooser dialogs don't append file extension if folder path has a
dot character in it
2018-12-16 10:44:41 +01:00
Branislav Stojkovic 53b58ef35a Fixed BOM export to Excel 2018-12-16 10:36:42 +01:00
Branislav Stojkovic 2cc916c8c1 improve continuity highlighting
massively simplified outline tracing
2018-12-16 01:47:30 +01:00
Branislav Stojkovic 58a4ff987f Highlight connected areas through copper traces, leads, jumpers, etc... 2018-12-16 00:52:15 +01:00
Branislav Stojkovic d506feac27 code tidy 2018-12-15 19:57:19 +01:00
Branislav Stojkovic 4aeaa25d1a Components in the tree sometimes stop responding until deselected and
selected again
2018-12-15 19:47:21 +01:00
Branislav Stojkovic b9cf1b4aa8 trimmer label updated 2018-12-15 19:30:12 +01:00
Branislav Stojkovic ec7f195a2e another trimmer type 2018-12-15 19:27:41 +01:00
Branislav Stojkovic 1b7f24bae4 Two new trimmer potentiometer types 2018-12-15 19:19:05 +01:00
Branislav Stojkovic 3939d2c5a7 Preserve z-order of components when copy-pasting 2018-12-15 18:35:51 +01:00
Branislav Stojkovic 2ee81093a0 shift for horizontal scroll
fixed issue with size calculation when zoomed
2018-12-15 18:23:56 +01:00
Branislav Stojkovic ed6792800b fix cut line disappearing 2018-12-14 10:01:07 +01:00
Branislav Stojkovic bc5fc23f38 version update 2018-12-11 22:07:32 +01:00
Branislav Stojkovic 36f8674417 fix building blocks
auto-delete older logs
2018-12-11 22:06:13 +01:00
Branislav Stojkovic 153b374191 version date fix 2018-12-11 17:52:35 +01:00
Branislav Stojkovic f573930ddf v3.41.0 release 2018-12-11 17:49:26 +01:00
bancika d6ac3c4018 "cut line" added 2018-12-11 17:05:04 +01:00
bancika e9afbaecdb Merge pull request #378 from heuermh/apply-gpl-license
Apply GPL version 3 license
2018-12-04 10:17:17 +01:00
Michael L Heuer c761677bed Update readme per GPL version 3 license. 2018-12-03 12:11:18 -06:00
Michael L Heuer f188f239b5 Add GPL version 3 license text to About dialog. 2018-12-03 12:07:28 -06:00
Michael L Heuer 3c458b9f16 Add GPL version 3 license header to source files. 2018-12-03 11:51:25 -06:00
Michael L Heuer 5a269afd2f Add GPL version 3 license. 2018-12-03 11:16:55 -06:00
bancika 43b232ad45 Merge pull request #358 from wahajenius/drawing_fixes
Drawing fixes
2018-08-11 17:04:52 +02:00
Willem Alexander Hajenius e4b155b12f Leads are now flush to component body; fixed drawing bug in lead shading due to mismatching rounding 2018-08-11 16:30:04 +02:00
Willem Alexander Hajenius cf7692fa9a Excluded IntelliJ project files 2018-08-11 16:00:58 +02:00
bancika bff46cf6d5 Merge pull request #354 from N9XYP/master
update symbol shape
2018-05-27 22:10:31 +02:00
Michael 58a615b548 update symbol shape
updating the symbol shape and fixing a naming error from previously wrong file upload
2018-05-26 21:45:08 -05:00
bancika 870199398c Merge pull request #353 from N9XYP/master
Photo Diode
2018-05-25 22:49:13 +02:00
N9XYP c946e34144 Update for typo
Typo
2018-05-25 15:37:51 -05:00
N9XYP 7ccad5bf08 Add files via upload
Photo Diode schematic symbol
2018-05-25 15:26:39 -05:00
Branislav Stojkovic 6821718b8d jarbundler update 2018-02-19 11:26:27 +01:00
Branislav Stojkovic e6a56e8157 Merge branch 'master' of
https://github.com/bancika/diy-layout-creator.git

Conflicts:
	diylc/diylc-swing/lib/diylc-core.jar
	diylc/diylc-swing/library/main.jar
2018-02-13 11:44:16 +01:00
Branislav Stojkovic 71afe72f37 java 8 migration 2018-02-13 11:32:48 +01:00
bancika f9d22b3d6f Merge pull request #328 from AXington/master
Add Fender mustang style switch
2017-09-23 15:15:12 +02:00
Andrew Thomas 53e6b4014c remvoe accidentally added file 2017-09-01 20:16:06 -04:00
Andrew Thomas c05b1a2131 revert accidental changes 2017-09-01 20:14:40 -04:00
Andrew Thomas f6d6b9a370 add mustang DP3T switch 2017-09-01 20:11:46 -04:00
bancika 6c2bb797ad Left mouse click on a component in the component tree sometimes has no
effect
2017-05-16 14:01:31 +02:00
bancika ddd634c825 Better label position on resistors 2017-05-16 12:56:20 +02:00
bancika 1bcb630619 fixed copy-paste error in dialog for bring to front 2017-05-12 15:36:47 +02:00
bancika a75c9830e5 Increased padding between schematic symbols and their labels 2017-05-10 16:23:02 +02:00
bancika 0e04d168e7 auto-save improvement 2017-05-10 16:12:46 +02:00
bancika d1a7227f4c right click rectangle selection 2017-05-10 15:25:43 +02:00
bancika a8665271b0 3.40 release 2017-05-08 14:44:49 +02:00
bancika f7c19c4483 improve axial electrolytic 2017-05-08 12:09:50 +02:00
Branislav Stojkovic df1331811c window size 2017-05-08 11:56:41 +02:00
Branislav Stojkovic aa5b81d0e5 fix radial cap import from v2 2017-05-08 11:45:32 +02:00
Branislav Stojkovic 38aa6bf660 Import files created in DIYLC v2 2017-05-08 11:42:16 +02:00
Branislav Stojkovic c2be767df1 cap image 2017-05-07 22:59:42 +02:00
Branislav Stojkovic 9ba7b66d05 Changed border color oemory bar in bottom-right corner not to be red
under OSX
2017-05-07 21:14:14 +02:00
Branislav Stojkovic 48b8e10795 splash update 2017-05-07 20:01:53 +02:00
Branislav Stojkovic 2d0fbf40a8 can cap added 2017-05-07 09:56:12 +02:00
Branislav Stojkovic ebe680fb8b doc 2017-05-07 09:01:42 +02:00
Branislav Stojkovic 0c806022f2 Better axial electrolytic rendering. Changed default color of all
electrolytic capacitors
2017-05-07 09:00:09 +02:00
Branislav Stojkovic 9b0eac7617 improve duplication 2017-05-06 16:10:45 +02:00
Branislav Stojkovic d84f7dadf5 Duplicate selection option in Edit menu and popup menu (Ctrl+D) 2017-05-06 13:56:54 +02:00
Branislav Stojkovic c7d8e8e0f0 splash for OSX 2017-05-06 12:32:57 +02:00
Branislav Stojkovic 08882a5167 Merge branch 'master' of
https://github.com/bancika/diy-layout-creator.git

Conflicts:
	diylc/diylc-library/lib/diylc-core.jar
	diylc/diylc-swing/lib/diylc-core.jar
2017-05-06 12:19:42 +02:00
Branislav Stojkovic b745ae8e15 new splash screen 2017-05-06 12:11:07 +02:00
bancika 2a72c8380c Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-05-05 12:03:08 +02:00
bancika cc008568a0 Editable toggle switch color 2017-05-05 11:59:56 +02:00
bancika c5b5465bab Create README.md 2017-05-05 11:42:20 +02:00
bancika 0a7e5c7dc7 add donate button in the installer 2017-05-05 11:32:12 +02:00
bancika d62221b796 Update README.md 2017-05-03 19:34:37 +02:00
bancika 3e0a698d32 Update README.md 2017-05-03 19:34:07 +02:00
bancika c37b0f3071 Ability to change PCB board shape from rectangular to oval 2017-04-27 17:15:38 +02:00
bancika 0fcd523d6b DIL IC label improvements 2017-04-27 13:56:24 +02:00
bancika ccf6e7bb7e improve bring to front/back 2017-04-27 13:17:14 +02:00
bancika d211ea6ffc Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-04-27 12:48:16 +02:00
bancika a5bd532e47 force components to go to front or back 2017-04-27 12:05:34 +02:00
bancika ddfb64f1a4 do not block the UI at startup 2017-04-27 11:40:18 +02:00
bancika 5198c9e2b5 Update README.md 2017-04-26 20:06:57 +02:00
bancika b39f685a90 Update README.md 2017-04-26 19:56:09 +02:00
bancika b2501ccba1 Tilde to repeat last added component 2017-04-26 16:30:02 +02:00
bancika 3f4b0475bc pot icon improvement 2017-04-26 15:42:45 +02:00
bancika f43cd8d90a Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-04-26 14:03:46 +02:00
bancika 66bdd41b29 Potentiometers can show an optional shaft, can have either solder lugs
or PCB pins and rendering includes the wafer
2017-04-26 14:03:36 +02:00
bancika c84fc3a200 Update README.md 2017-04-26 10:55:00 +02:00
bancika 1f44d63865 release 2017-04-26 10:52:44 +02:00
bancika c4b329744e moved log location
v39 release
2017-04-25 12:37:25 +02:00
bancika dda588b28f Use balloon to show announcements and update notifications 2017-04-25 12:09:10 +02:00
bancika 283232630c added font box padding 2017-04-24 13:35:11 +02:00
bancika cd5d5011c6 added nudge
fixed ctrl/meta handling
2017-04-24 12:59:56 +02:00
bancika 217c0b1b67 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-04-24 10:49:13 +02:00
bancika 4f0018d655 fix resistor changing shape 2017-04-24 10:48:24 +02:00
bancika 5ac8379693 Update README.md 2017-04-23 15:25:59 +02:00
bancika 72d0ab0d94 Update README.md 2017-04-23 15:24:08 +02:00
bancika 3e05634713 Update README.md 2017-04-23 15:22:56 +02:00
bancika 87e0997377 doc 2017-04-21 17:21:47 +02:00
bancika d1b29ec228 standardize ctrl to command on mac 2017-04-21 17:19:17 +02:00
bancika aad6cef831 tree tweak 2017-04-21 17:16:10 +02:00
bancika 2bd78110a7 assign keyboard shortcuts to components 2017-04-21 17:04:11 +02:00
bancika 6458dfd39b Use Mac "command" key for menu shortcuts under OSX 2017-04-21 13:29:42 +02:00
bancika e342ed1c2c Show and hide each individual layer 2017-04-21 11:55:40 +02:00
bancika f6ad118044 improve precision of copper traces 2017-04-21 10:49:36 +02:00
bancika 5dc090828c Show selection size in both inches and centimeters 2017-04-20 16:19:22 +02:00
bancika f1611bbf0f Solder Pad size shouldn't be rounded up or down to the nearest integer
to allow better precision
2017-04-20 15:43:14 +02:00
bancika d65609b3d2 fix IC pin alignment issue 2017-04-20 15:25:17 +02:00
bancika b3d63e9f22 show selection bounds on rulers 2017-04-20 14:12:00 +02:00
bancika dc8612a167 release 3.38 2017-04-20 11:33:25 +02:00
bancika 1fbd3c1dae change recent file count to 10 2017-04-20 11:09:04 +02:00
bancika fba2ecc384 Added 'Recent Files' 2017-04-20 11:07:08 +02:00
bancika 3048127024 Tooltip doesn't cover buttons in the right side of the status bar 2017-04-19 18:16:16 +02:00
bancika 017afda5a4 Ability to edit color of copper trace, curved trace and solder pad at
the same time
2017-04-19 15:32:13 +02:00
bancika 54bcd99d17 unicode characters in JAR file paths 2017-04-19 14:03:55 +02:00
bancika 7ba7afe680 libs 2017-04-19 13:37:12 +02:00
bancika d9cffc1a34 added doc icon 2017-04-19 13:34:17 +02:00
bancika 781a8389d0 added windows installer
moved config file location
2017-04-19 13:26:00 +02:00
bancika 32e273df6e Do not allow creating zero-length components 2017-04-19 10:36:06 +02:00
bancika cbd58a1dd8 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-04-18 17:43:32 +02:00
bancika beb574c38f change project font 2017-04-18 17:41:36 +02:00
bancika 8e05394203 Update README.md 2017-04-13 11:25:29 +02:00
bancika e2c0723a23 Update README.md 2017-04-13 11:25:13 +02:00
bancika 7973549819 Update README.md 2017-04-13 11:24:35 +02:00
bancika 8e6f7a07e5 Solder pads can be sent behind copper traces to allow creating white
border around traces on top of a ground plane
2017-04-12 17:09:12 +02:00
bancika aadeac3f34 zoom scroll improvement 2017-04-12 14:33:14 +02:00
bancika 422545ffe2 Zooming tracks mouse cursor position 2017-04-11 17:49:39 +02:00
bancika 649caea538 Hookup wire can be sent to back behind boards 2017-04-10 16:02:27 +02:00
bancika e7260a24e4 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-04-10 13:37:19 +02:00
bancika 08e1a371b7 rel 3.37 2017-04-10 13:37:00 +02:00
bancika 105f38e97f Update README.md 2017-04-10 13:33:50 +02:00
bancika ff1d26b75b release 3.37 2017-04-10 13:24:58 +02:00
bancika 43bc49303c Thumbnail sometimes gets very small when uploading a project to the
cloud
2017-04-10 12:28:54 +02:00
bancika 5c7143b1a0 rotate breadboard 2017-04-07 17:52:07 +02:00
bancika 900fea58a1 Ability to change resistor shape (tubular or standard "dog bone") 2017-04-07 13:54:05 +02:00
bancika 3f8582df78 Added more control over Breadboard size and appearance 2017-04-07 13:50:54 +02:00
bancika bbcc196e9f Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-01-26 16:31:27 +01:00
bancika 3423f00c15 Ability to change resistor shape (tubular or standard "dog bone") 2017-01-26 16:31:08 +01:00
bancika 42fe174a69 Update README.md 2017-01-26 12:59:31 +01:00
bancika c1c87a2454 prepare the release 2017-01-26 12:31:40 +01:00
bancika d35566cdf5 color editor improvement 2017-01-25 13:13:36 +01:00
bancika c2aa863c2a Ability to type in hex value in color editor 2017-01-25 13:02:04 +01:00
bancika aa1a327ac1 pickup improvements 2017-01-25 12:19:11 +01:00
bancika b7a1ef6664 darker/lighter logic
single coil improvement
2017-01-25 11:48:07 +01:00
bancika fc7fd2aed8 single coil improvement 2017-01-25 11:24:47 +01:00
bancika 2c4aba1557 Select single coil pickup pole pieces (rods or rails) and pole piece
color
2017-01-24 12:04:16 +01:00
bancika 703ec78974 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-01-17 18:08:41 +01:00
bancika fc36f9d632 Component type gets selected while expanding folders in component tree 2017-01-17 18:08:29 +01:00
bancika 44797477ba Improved resistor rendering to look more realistic 2017-01-17 15:43:42 +01:00
bancika a739e2c51b Renamed "template" to "variant" 2017-01-16 16:10:17 +01:00
bancika 1160286bc7 Rename eclipse-java-google-style.xml to diylc/eclipse-java-google-style.xml 2017-01-14 01:54:30 +01:00
bancika e4cf9d5fda trimmer display improvement 2017-01-12 17:39:10 +01:00
bancika 58bf48d8ac building blocks improvement 2017-01-12 17:30:29 +01:00
bancika 57a9577016 improve building blocks 2017-01-12 17:02:51 +01:00
bancika 7c26b7aa94 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-01-12 15:51:27 +01:00
bancika 0555d4b86e building blocks 2017-01-12 15:50:54 +01:00
bancika c59597d8f0 Delete Project History.md 2017-01-11 16:11:50 +01:00
bancika 0286894338 Rename Project History to Project History.md 2017-01-11 16:10:44 +01:00
bancika ec06e03641 Create Project History 2017-01-11 16:10:29 +01:00
bancika 5f466110ad Update README.md 2017-01-11 16:10:06 +01:00
bancika 579eaccf50 Update README.md 2017-01-11 16:08:18 +01:00
bancika a86ff5c6e4 Update README.md 2017-01-11 16:06:48 +01:00
bancika c64c9fb5b2 change tube color 2017-01-11 15:57:15 +01:00
bancika c945dc89ad Ability to rotate tube sockets for arbitrary angle 2017-01-11 15:33:41 +01:00
bancika a9f177b980 jack transformer 2017-01-11 13:58:35 +01:00
bancika b85bd09778 show/hide rulers and grid 2017-01-11 12:31:18 +01:00
bancika 62cc726070 added transformers
don't apply template points
2017-01-11 11:48:32 +01:00
bancika 959c5be424 added more transformers 2017-01-10 14:20:53 +01:00
bancika 5daa7c7bc9 transformers for to92, dilIC and pot. 2017-01-09 12:50:43 +01:00
bancika 43262cea6a Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-01-06 15:25:27 +01:00
bancika af39da27aa refactor component transformation 2017-01-06 15:24:55 +01:00
bancika 06b56e57ad Update README.md 2017-01-05 18:41:07 +01:00
bancika 545df1b1fa Update README.md 2017-01-05 16:16:19 +01:00
bancika 8a3f017468 Cannot type "q" letter in any of the boxes around the app 2017-01-05 16:10:52 +01:00
bancika 980055d4c0 added default templates 2017-01-05 12:36:04 +01:00
bancika 53f09e6143 default focus on text when editing JLabel 2017-01-05 10:35:20 +01:00
bancika 23d702eeb5 rename actions for renumbering 2017-01-04 17:08:03 +01:00
bancika 3a419c0959 consolidated menus 2017-01-04 16:53:38 +01:00
bancika 97e44fba1e Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2017-01-04 15:34:16 +01:00
bancika ac93a97e85 added mirror 2017-01-04 15:24:10 +01:00
bancika 34bc347140 Update README.md 2016-12-30 12:13:13 +01:00
bancika e8b1258f09 release 2016-12-30 11:26:28 +01:00
bancika caa92e973d open jack improvement 2016-12-30 10:49:42 +01:00
bancika 95c8ee3bf6 consolidate component names 2016-12-30 10:19:56 +01:00
Branislav Stojkovic 0af2d068ea improve colors 2016-12-29 21:43:54 +01:00
Branislav Stojkovic f12402e024 improve colors 2016-12-29 21:41:36 +01:00
Branislav Stojkovic 6ec5c165f5 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-12-29 21:34:51 +01:00
Branislav Stojkovic 686754faa0 changed colors 2016-12-29 21:34:42 +01:00
bancika 2f97b39f18 Update README.md 2016-12-29 21:27:37 +01:00
Branislav Stojkovic 0e62f97ed7 tree improvement 2016-12-29 21:24:06 +01:00
Branislav Stojkovic ea210d816d improve line zoom 2016-12-29 21:18:27 +01:00
bancika c200a2ffbf improve jack 2016-12-29 18:12:45 +01:00
bancika 10905a7f0a cleanup 2016-12-29 18:07:18 +01:00
bancika fad005cccf added open jack 2016-12-29 18:06:54 +01:00
bancika 7bb1a86f48 pickup improvement 2016-12-29 14:03:33 +01:00
bancika a3f8910268 improve pickups 2016-12-29 13:58:05 +01:00
bancika 1bf2825f80 moved rounded path 2016-12-29 13:22:29 +01:00
bancika ab64e8bb14 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-12-29 13:11:49 +01:00
bancika c1ed488b7c pickup improvements 2016-12-29 13:11:38 +01:00
bancika 00c9744c40 added rounded path
added tele pickup
2016-12-29 13:00:45 +01:00
bancika f73e8197ce Update README.md 2016-12-28 23:24:03 +01:00
bancika d953c75b33 pickup change 2016-12-28 17:18:27 +01:00
bancika 191e82caf3 improved single coil look 2016-12-28 17:16:11 +01:00
bancika 8b0af57c35 tree improvements
perfboard improvements
trace cut improvements
2016-12-28 13:58:32 +01:00
bancika 7a5de6bad0 UTF-8 encoding for configs 2016-12-28 12:45:09 +01:00
bancika 2a0da6e794 folded both P90 under the same component 2016-12-28 10:13:05 +01:00
bancika 38b057888f tree improvements
LP switch added
2016-12-27 17:08:16 +01:00
bancika b14b7afd39 P-90 dogear icon fixed 2016-12-27 12:40:30 +01:00
bancika fb6b1464a3 tree improvements 2016-12-27 12:19:58 +01:00
bancika 328cf0e9b7 improved tree 2016-12-26 17:46:35 +01:00
bancika ebb6a57ee8 added searchable component tree 2016-12-26 17:29:42 +01:00
bancika 62893ffb7c Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-12-26 12:32:57 +01:00
bancika 0e1db4ddb1 added P90 pickups, mini humbuckers, fixed links 2016-12-26 12:32:46 +01:00
bancika 699762707a Update README.md 2016-12-24 16:25:37 +01:00
bancika efc92dfc71 Update README.md 2016-12-24 16:23:42 +01:00
bancika 321995a704 Update README.md 2016-12-24 14:06:40 +01:00
bancika d1ff654fc6 release 2016-12-23 15:32:03 +01:00
bancika 842d056fd7 undo relay - was already there (doh!) 2016-12-23 15:26:01 +01:00
bancika 58a794e8a7 cleanup relay 2016-12-23 13:22:24 +01:00
bancika 3fbec7fb13 Subminiature DIL relay added 2016-12-23 13:12:40 +01:00
bancika 81194fbcab Glass diode component added 2016-12-22 15:51:06 +01:00
bancika f79498bc22 transistor and potentiometer symbols can be rotated 2016-12-22 15:21:01 +01:00
bancika a32105e156 backward compatible fix 2016-12-21 17:16:49 +01:00
bancika 65a6e30986 improve pentode symbol. remove unused code 2016-12-21 16:09:45 +01:00
bancika 2eeb05e7af Tube symbols can be rotated 2016-12-21 15:58:57 +01:00
bancika ef07d109cf added text editor next to slider 2016-12-21 15:23:22 +01:00
bancika d27b049110 show SMD labels 2016-12-06 18:04:54 +01:00
bancika ba9924cc99 improved zoom 2016-12-06 15:24:42 +01:00
bancika 5a57c58563 added SMD capacitor and resistor 2016-12-06 12:20:51 +01:00
bancika 66e29aa275 added terminal strip 2016-12-05 17:44:56 +01:00
bancika 9d465b3156 added battery symbol 2016-12-05 13:17:35 +01:00
bancika 127ea2b84c Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-11-18 13:11:09 +01:00
bancika db1950621e server code 2016-11-18 13:10:56 +01:00
bancika b134c8f2d9 update server code 2016-11-18 13:10:35 +01:00
Branislav Stojkovic fc9988f682 release 2016-11-12 21:10:35 +01:00
Branislav Stojkovic f259604274 release 2016-11-12 20:58:39 +01:00
Branislav Stojkovic 32053fb2a8 fix paging issue 2016-11-12 18:53:33 +01:00
Branislav Stojkovic 97d7d51fae preparing for the release of 3.32 2016-11-12 18:35:31 +01:00
bancika 327a30215e improve icons 2016-11-08 17:52:27 +01:00
bancika 9c0784d59f improve conversion 2016-11-08 13:13:55 +01:00
bancika f63b6e5c0d improve V1 parsing 2016-11-08 11:33:19 +01:00
bancika 606d6a50be work on transformer symbols 2016-11-07 12:51:14 +01:00
bancika 6abea34d56 don't show templates at startup by default 2016-11-07 10:14:58 +01:00
Branislav Stojkovic 744e6a2576 refactor editably property
add transformer coil and core
2016-11-06 23:42:48 +01:00
Branislav Stojkovic dff7860002 update text 2016-11-04 11:32:50 +01:00
Branislav Stojkovic 0ac2c5bd9d flip potentiometer symbol horizontally 2016-11-04 11:21:30 +01:00
Branislav Stojkovic adfedf11ce improve trimmer and V1 import for trimmer and wire 2016-11-04 10:10:01 +01:00
bancika 8fc5fe4c18 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-11-02 11:39:48 +01:00
bancika 02b2c036ba add libs to repository so the app can run 2016-11-02 11:39:40 +01:00
bancika 9ac8f9d966 Update README.md 2016-11-02 11:23:00 +01:00
Branislav Stojkovic ad6e45da23 code cleanup
V1 file import - added support for more component types
minor improvements
2016-11-02 01:04:52 +01:00
bancika 94c8512c11 code cleanup 2016-11-01 16:43:24 +01:00
Branislav Stojkovic 3776955d7b change messages 2016-10-31 22:04:06 +01:00
Branislav Stojkovic 5981f96916 edit cloud project 2016-10-31 22:00:02 +01:00
bancika ad5bdbe22d manage cloud uploads 2016-10-31 17:53:56 +01:00
bancika fc717870f1 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-10-31 13:16:06 +01:00
bancika f9a32ebce3 simplified auto-create logic
cloud management work
2016-10-31 13:11:53 +01:00
bancika 271b38c51c Update README.md 2016-10-31 11:41:22 +01:00
Branislav Stojkovic a74f00a5fd simplify code 2016-10-30 12:30:30 +01:00
Branislav Stojkovic 98087d8889 upload manager work 2016-10-30 12:26:45 +01:00
Branislav Stojkovic 1849eec874 optimize the code 2016-10-30 10:29:50 +01:00
Branislav Stojkovic 85cb01b0d5 add support for update/delete project
move some code to background threads
2016-10-30 10:18:41 +01:00
Branislav Stojkovic f6e5078028 move some code to framework lib 2016-10-30 09:11:20 +01:00
Branislav Stojkovic 22b06e2a3b improve auto-generated keywords 2016-10-30 08:04:39 +01:00
Branislav Stojkovic 5e00e3128b keyword auto-generation 2016-10-30 01:04:26 +02:00
Branislav Stojkovic 5de31dd7bb auto-create component framework improvement 2016-10-30 00:31:09 +02:00
Branislav Stojkovic 06e2342d36 add doc
component tag reorg
2016-10-29 20:27:49 +02:00
Branislav Stojkovic 287157016f upgrade swing-framework for dialog improvement 2016-10-29 12:43:33 +02:00
bancika 5f020414a0 fix the link in About 2016-10-28 16:52:56 +02:00
bancika 1eeed9174a refactor old version parsing
remove dependency from core to library
validate SolderPad size
2016-10-28 13:24:25 +02:00
bancika abb9c5ce6f bugfix: trimmer display should not be static
code cleanup
2016-10-28 12:03:45 +02:00
bancika 6312e251f6 code cleanup 2016-10-28 12:02:50 +02:00
bancika 2131f9fe44 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-10-28 11:49:53 +02:00
bancika 997afc0e84 code cleanup 2016-10-28 11:48:41 +02:00
bancika eff81b718d Update README.md 2016-10-28 11:27:03 +02:00
bancika 76cb664d5d Update README.md 2016-10-28 11:26:42 +02:00
bancika 5a998c9dc0 Update README.md 2016-10-28 11:11:55 +02:00
bancika dfc14c26f9 update lib 2016-10-28 10:48:39 +02:00
bancika fccd4b481a Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-10-28 10:48:05 +02:00
bancika 5d5aa05f08 update back-end code 2016-10-28 10:47:55 +02:00
bancika dc42dd8bd4 Update README.md 2016-10-28 10:32:24 +02:00
bancika c24d186476 Update README.md 2016-10-28 09:56:17 +02:00
bancika c68d91997f Update README.md 2016-10-28 09:49:51 +02:00
Branislav Stojkovic f571992692 renamed lib 2016-10-28 00:44:03 +02:00
Branislav Stojkovic 21815584ac announcement fix 2016-10-28 00:37:06 +02:00
Branislav Stojkovic ad4716cd79 switched compiler to janino 2016-10-28 00:34:13 +02:00
Branislav Stojkovic e67c879472 fix minor issues 2016-10-27 20:24:58 +02:00
bancika 6977d97332 send comments functionality 2016-10-27 17:53:10 +02:00
bancika d1279ccc9a added comment support 2016-10-27 13:07:23 +02:00
bancika 0da4375857 view/download/comment count 2016-10-27 12:39:11 +02:00
bancika 3e695a37f0 view and download counter added 2016-10-27 10:51:18 +02:00
Branislav Stojkovic 377d8c4ed5 added to the top 2016-10-26 23:00:29 +02:00
Branislav Stojkovic e48b94c91b minor improvements 2016-10-26 21:32:25 +02:00
bancika 8c85e7351c add announcements 2016-10-26 18:04:52 +02:00
bancika d510483f31 improve search looks 2016-10-26 13:10:56 +02:00
bancika 54e9797566 search paging improvement 2016-10-26 12:04:04 +02:00
Branislav Stojkovic 5ffb223a0d code improvement 2016-10-26 08:26:24 +02:00
bancika f65b43b578 lazy loading 2016-10-25 18:16:21 +02:00
bancika 727d46e8d3 remove dashboard for now 2016-10-25 17:05:06 +02:00
bancika 04016ff879 change main window title 2016-10-25 12:06:49 +02:00
bancika 2105391c89 improve search results 2016-10-25 12:00:04 +02:00
Branislav Stojkovic 71c0bacf9c resize 2016-10-25 09:00:04 +02:00
Branislav Stojkovic af5080b422 label change 2016-10-25 08:58:36 +02:00
Branislav Stojkovic 70edab78a4 renamed cloud 2016-10-25 08:37:17 +02:00
Branislav Stojkovic 47eaf46bb4 minor change 2016-10-24 21:30:54 +02:00
Branislav Stojkovic 5ea18aa018 label change 2016-10-24 21:28:33 +02:00
Branislav Stojkovic ac4ec9c390 use volatile image to optimize 2016-10-24 21:26:28 +02:00
bancika 04a0d6bea9 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-10-24 17:56:24 +02:00
bancika be334165ba search rework 2016-10-24 17:56:13 +02:00
bancika 13f7116552 Update README.md 2016-10-24 16:43:10 +02:00
bancika b529adefcb Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-10-24 16:18:04 +02:00
bancika 3afd1add40 added bitchin' cloud animation 2016-10-24 16:17:56 +02:00
bancika 6a232fee94 Add files via upload
eclipse coding standard used in the project
2016-10-24 12:18:54 +02:00
bancika a9df82cbab cloud search work 2016-10-24 11:55:40 +02:00
bancika a197bbc21a fix build 2016-10-24 10:13:00 +02:00
Branislav Stojkovic 0610229157 move folders 2016-10-23 17:29:23 +02:00
Branislav Stojkovic 5ec0616a1e change format to ggl 2016-10-23 17:17:46 +02:00
Branislav Stojkovic 81a0ff1d44 download and open files from the cloud 2016-10-23 17:06:28 +02:00
Branislav Stojkovic 3c4b4adfb4 cloud browser - show search results 2016-10-23 11:40:02 +02:00
Branislav Stojkovic 545e483397 work on cloud browser 2016-10-23 09:56:45 +02:00
Branislav Stojkovic 309973e37f add cloud browser frame 2016-10-22 23:13:54 +02:00
Branislav Stojkovic 71534e065b create user functionality 2016-10-22 20:58:53 +02:00
Branislav Stojkovic ff019542f8 cloud user management 2016-10-22 19:12:34 +02:00
Branislav Stojkovic a7a99cc4ec git ignore 2016-10-22 15:11:30 +02:00
Branislav Stojkovic 5b5b75142f cloud work - user management 2016-10-22 15:09:10 +02:00
Branislav Stojkovic d8b915f8a5 improve auto save/restore logic 2016-10-22 15:07:23 +02:00
Branislav Stojkovic 83e7c0b077 add back end PHP code to the repository 2016-10-22 12:45:49 +02:00
Branislav Stojkovic 4738a23fc6 minor code improvement 2016-10-22 12:43:20 +02:00
Branislav Stojkovic 7c6bd1804b project upload is functional! 2016-10-22 12:31:32 +02:00
Branislav Stojkovic f949fa5087 cloud work 2016-10-22 02:27:12 +02:00
Branislav Stojkovic 700a09ed86 code improvement 2016-10-22 01:49:11 +02:00
Branislav Stojkovic 1b3d6fb2fc cloud work 2016-10-22 01:41:45 +02:00
bancika 3446505c27 changed lib name 2016-10-21 18:25:15 +02:00
bancika 34c2c736ad update http-proxy 2016-10-21 18:20:07 +02:00
bancika c75711642a cloud work 2016-10-21 18:02:10 +02:00
bancika eef4988177 refactor drop down button to avoid 3 libs
service API
2016-10-21 17:08:27 +02:00
bancika 05207700fe renamed interface 2016-10-21 13:24:19 +02:00
bancika 0c75ab2b5a remove MySql references
switch to DIYLC php-based service
2016-10-21 12:35:35 +02:00
bancika 8850616584 Merge branch 'master' of https://github.com/bancika/diy-layout-creator.git 2016-10-20 12:26:36 +02:00
Branislav Stojkovic e6b782ee64 delete extra projects 2016-10-19 23:14:37 +02:00
bancika 3003ca4ed2 Update README.md 2016-10-07 13:19:01 +02:00
bancika d2b6584ef0 osx zip file access fixed 2016-05-12 18:08:38 +02:00
bancika 1ac18b3819 Update README.md 2016-05-11 16:55:37 +02:00
bancika 3d69e259be Update README.md 2016-05-11 16:52:58 +02:00
bancika 021bac8f83 Update README.md 2016-05-11 16:51:50 +02:00
bancika 2f98f0c75d Merge branch 'master' of
https://github.com/bancika/diy-layout-creator.git
2016-05-09 16:05:50 +02:00
bancika e7945df218 fix undo error
improve ant builder to package zip files for deployment
2016-05-09 16:05:29 +02:00
bancika 8694606441 Update README.md 2016-04-28 13:47:38 +02:00
bancika 468f482db9 Update README.md 2016-04-28 13:46:42 +02:00
bancika e2fb415a59 switch to java 1.6.x 2016-04-28 13:44:52 +02:00
bancika 34720db33a Update README.md 2016-04-25 15:03:26 +02:00
bancika 146634f75d improved potentiometer symbol 2016-04-25 15:00:25 +02:00
bancika 6f19985c73 Merge remote-tracking branch 'origin/master' 2016-04-21 18:05:08 +02:00
bancika 0507812178 add missing files 2016-04-21 18:04:25 +02:00
bancika 368ec6a30d 3.29.0 add missing files 2016-04-21 18:01:05 +02:00
bancika c1268afb68 Update README.md 2016-04-20 12:27:35 +02:00
bancika 1c1703d606 Update README.md
3.29.0 release
2016-04-20 12:25:50 +02:00
bancika 3e18c5e1db 3.29.0 release
[Bug Fix] Issue with losing saved user configuration
[Bug Fix] Issue with disabled "Save as Template" context menu item
problem, as well as issue with strange rotation and probably few more
[Bug Fix] Undo steps kept after opening a new file
[New Feature] Transistors can be rotated and flipped vertically
[New Feature] DIL ICs can show pin numbers
[New Feature] Display both component value and name or neither of them
[New Feature] Potentiometer schematic symbol added
2016-04-20 11:46:00 +02:00
bancika fbc3c4bfc4 Update README.md 2015-09-04 11:36:09 +02:00
bancika 0b8a3d6f9f Update README.md 2015-09-04 11:35:31 +02:00
bancika f0a2473763 Update README.md 2015-09-04 11:34:39 +02:00
bancika 91f21c1896 Update README.md 2015-09-04 11:34:03 +02:00
bancika 9808e672c5 Update README.md 2015-09-04 11:31:45 +02:00
bancika 7e310a9a9c Update README.md 2015-09-04 11:28:57 +02:00
bancika 4843cc729f Update README.md 2015-05-19 12:55:52 +02:00
bancika 335e2a572f Create README.md 2015-05-19 12:52:51 +02:00
bancika 12e49ceabf 2013-08-15 12:00:13 +00:00
bancika f23f396c0a use lib 2013-08-15 11:48:04 +00:00
bancika 94b92cc0d7 selection & multi d&d fix 2013-08-15 11:47:59 +00:00
bancika 448f87666d selection & multi d&d fix 2013-08-15 11:47:52 +00:00
bancika 8c0cec70de undo 2013-05-01 09:49:41 +00:00
bancika 05eba5195e 3.28 2013-05-01 09:45:12 +00:00
bancika e5c54242bc Select all within a layer 2013-04-30 14:12:42 +00:00
bancika f7f669bff3 Select all within a layer 2013-04-30 14:12:34 +00:00
bancika 0a490d148a 2013-04-30 10:07:14 +00:00
bancika bee14895d7 Right click rotation during component creation throws an error 2013-04-30 10:06:49 +00:00
bancika 8def96d03c Right click rotation during component creation throws an error 2013-04-30 10:06:43 +00:00
bancika dab4e76f44 redo shape class hierarchy 2013-04-30 09:06:21 +00:00
bancika ac81b30e8e Trace cuts can be placed between two holes for tighter layouts 2013-04-29 14:16:25 +00:00
bancika 689ddebdb8 Trace cuts can be placed between two holes for tighter layouts 2013-04-29 10:58:44 +00:00
bancika 2b0d9dd9d3 Trace cuts can be placed between two holes for tighter layouts 2013-04-29 10:58:38 +00:00
bancika b335f0aabe fix ctrl selection 2013-04-29 10:31:29 +00:00
bancika bdfa255439 fix ctrl selection 2013-04-29 10:30:58 +00:00
bancika bc3875ecbf fix ctrl selection 2013-04-29 10:30:55 +00:00
bancika 59f516df9c Allow grid spacing as little as 0.1mm 2013-04-29 10:19:06 +00:00
bancika 0c86f60752 Allow grid spacing as little as 0.1mm 2013-04-29 10:19:03 +00:00
bancika 91deb1d7da apply template to existing components
do not mess up selection on right click
popup menu improvements
2013-04-29 10:08:36 +00:00
bancika 1714ddb444 apply template to existing components
do not mess up selection on right click
popup menu improvements
2013-04-29 10:08:26 +00:00
bancika 35326e7d17 apply template to existing components
do not mess up selection on right click
popup menu improvements
2013-04-29 10:08:19 +00:00
bancika b2dc050c32 added tri-pad board 2013-04-29 09:17:53 +00:00
bancika eb58f1786a Moving multiple components doesn't honor snap to grid OFF setting 2013-04-26 14:19:32 +00:00
bancika 16ce229b57 Moving multiple components doesn't honor snap to grid OFF setting 2013-04-26 14:19:29 +00:00
bancika 93954f60c7 Moved all schematic symbols to a dedicated category 2013-04-26 12:34:07 +00:00
bancika dc533368a8 Moved all schematic symbols to a dedicated category 2013-04-26 12:33:52 +00:00
bancika e9a54d1fe2 Ability to import existing DIY files into a project 2013-04-26 12:05:34 +00:00
bancika cfd7af2793 Added primitive shapes - ellipse, polygon and (rounded) rectangle 2013-04-25 16:32:14 +00:00
bancika f8310b1fac Added primitive shapes - ellipse, polygon and (rounded) rectangle 2013-04-25 16:32:06 +00:00
bancika 8a125e8a4f transparent icons 2013-04-25 15:00:28 +00:00
bancika b975cc79b1 2013-04-25 14:51:05 +00:00
bancika 171ebf4473 Ability to rotate selection 2013-04-25 14:37:19 +00:00
bancika 5cb9824da4 Ability to rotate selection 2013-04-25 14:37:00 +00:00
bancika 6ef5ad5854 Ability to rotate selection 2013-04-25 14:36:50 +00:00
bancika 18edd60763 More predictable movement of multiple components at the same time 2013-04-23 16:11:31 +00:00
bancika ea1da54202 More predictable movement of multiple components at the same time 2013-04-23 16:11:28 +00:00
bancika 7497e89afd Large components disappear when none of the edges is in the visible area 2013-04-23 15:45:24 +00:00
bancika 8ed165766f Large components disappear when none of the edges is in the visible area 2013-04-23 15:45:17 +00:00
bancika 8c98e9dece Large components disappear when none of the edges is in the visible area 2013-04-23 15:45:11 +00:00
bancika a082e0be63 added breadboard component 2013-04-22 10:22:51 +00:00
bancika 6f0df4fdc9 added breadboard component 2013-04-22 10:22:15 +00:00
bancika d85f496702 added breadboard component 2013-04-22 10:22:10 +00:00
bancika ef24664eac added breadboard component 2013-04-22 10:22:04 +00:00
bancika bfb554a930 copy paste error 2013-03-04 12:21:35 +00:00
bancika 0ff52979ea copy paste error 2013-03-04 12:21:30 +00:00
bancika eb1c4a6688 3.24 build 2013-03-04 10:14:58 +00:00
bancika 47d42c5456 3.24 build 2013-03-04 10:14:42 +00:00
bancika 297a4f3518 Potentiometer doesn't update when size only is changed 2013-03-04 10:14:05 +00:00
bancika d678f6fed1 Potentiometer doesn't update when size only is changed 2013-03-04 10:13:37 +00:00
bancika 3583d6e5f5 Snap to grid after releasing Ctrl button and creating a new component 2013-03-04 09:59:59 +00:00
bancika e84e0c10e1 Snap to grid after releasing Ctrl button and creating a new component 2013-03-04 09:59:55 +00:00
bancika b6c1ebd079 Faster startup when using image component templates 2012-11-02 16:13:39 +00:00
bancika 42190d3498 Faster startup when using image component templates 2012-11-02 16:13:34 +00:00
bancika 00bc6808d8 Faster startup when using image component templates 2012-11-02 16:13:27 +00:00
bancika 1e90621545 icon 2012-10-11 08:42:07 +00:00
bancika 06b204fc38 SIP IC 2012-10-10 15:52:18 +00:00
bancika ac95d45f95 SIP IC 2012-10-10 15:52:10 +00:00
bancika 16e3241a94 icon 2012-10-10 15:51:55 +00:00
bancika 1760161aa3 Editable colors for DIP IC 2012-10-10 15:51:48 +00:00
bancika c57e5f837c Editable lead color; changed default lead color 2012-10-10 14:49:51 +00:00
bancika 024884d85d Editable lead color; changed default lead color 2012-10-10 14:49:39 +00:00
bancika 50562ae901 Editable lead color; changed default lead color 2012-10-10 14:49:30 +00:00
bancika c8d0711889 Editable lead color; changed default lead color 2012-10-09 09:47:58 +00:00
bancika 4338200088 Editable lead color; changed default lead color 2012-10-09 09:47:45 +00:00
bancika 5ea4ed44a4 Ctrl + right click on component type in toolbox appends components of that type to selection 2012-10-09 09:14:55 +00:00
bancika b1a1611a3a Right click shouldn't change selection 2012-10-09 09:12:19 +00:00
bancika 9af88002b0 Pasted components are placed below traces 2012-10-09 08:39:50 +00:00
bancika a6386dda96 Pasted components are placed below traces 2012-10-09 08:39:44 +00:00
bancika 352b3aeb6f Clearer standing component (mainly diode) reversion 2012-10-09 08:28:10 +00:00
bancika 5d6b787404 TO-3 transistor rotation is wrong for 180 degrees 2012-10-09 08:27:20 +00:00
bancika 3e36bce7ad TO-3 transistor rotation is wrong for 180 degrees 2012-10-09 08:27:14 +00:00
bancika 5d4cbadf6e Clearer standing component (mainly diode) reversion 2012-10-08 16:20:07 +00:00
bancika 6d10c45a18 Clearer standing component (mainly diode) reversion 2012-10-08 16:19:58 +00:00
bancika 4c04b72d44 do not hard-code version in presenter 2012-10-08 14:31:18 +00:00
bancika dd15702ca6 do not hard-code version in presenter 2012-10-08 14:31:03 +00:00
bancika c6bfb5a562 2012-10-08 10:23:16 +00:00
bancika bfa71e93d5 osx build 2012-10-08 10:21:58 +00:00
bancika 1a048d0b7c 2012-10-08 09:45:45 +00:00
bancika 6039f85631 Two Voltage properties for ceramic capacitors 2012-10-06 09:18:57 +00:00
bancika c843d8c28d Component templates save shape of the component (for wires and such) 2012-10-04 13:51:22 +00:00
bancika e7b05f109f Component templates save shape of the component (for wires and such) 2012-10-04 13:50:42 +00:00
bancika 5d2c4e0fc9 Component templates save shape of the component (for wires and such) 2012-10-04 13:50:35 +00:00
bancika ac0da8667c copy-paste improvement 2012-10-04 11:15:06 +00:00
bancika cc81fa1a56 copy-paste improvement 2012-10-04 11:14:58 +00:00
bancika 954bf200d2 copy-paste improvement 2012-10-04 11:14:49 +00:00
bancika 7bf8ff9347 saving config bug 2012-10-01 09:17:03 +00:00
bancika 1eba691750 saving config bug 2012-10-01 09:16:57 +00:00
bancika c20b17b12e saving config bug 2012-10-01 09:16:50 +00:00
bancika b734c87946 removed deps 2012-10-01 09:15:16 +00:00
bancika 5e25f25fc7 xstream update 2012-10-01 09:12:05 +00:00
bancika 80582f61ec xstream update 2012-10-01 09:11:56 +00:00
bancika 9a43597f6f xstream update 2012-10-01 09:11:51 +00:00
bancika 2993900cc6 Do not show exception for config.properties 2012-10-01 08:14:16 +00:00
bancika 39efdca0b8 bring back default boxes 2012-09-30 11:27:33 +00:00
bancika 2dcaabf3f2 bring back default boxes 2012-09-30 11:26:56 +00:00
bancika af9798772f diode value fix 2012-09-30 11:23:29 +00:00
bancika 4ddcea7bc7 BOM and multi-edit doesn't work when there's a component without a value set 2012-09-30 10:28:59 +00:00
bancika 6087b39ccd LED symbol 2012-09-29 16:26:25 +00:00
bancika b77120f742 cascade build files 2012-09-29 12:24:54 +00:00
bancika 0acae7c28d Schottky diode 2012-09-28 15:51:19 +00:00
bancika 0cb0e950f7 Schottky diode 2012-09-28 15:51:11 +00:00
bancika 951dc3861a Zener diode symbol 2012-09-28 15:29:14 +00:00
bancika 0483656258 Zener diode symbol 2012-09-28 15:29:09 +00:00
bancika 34a0000d3c Diode symbol 2012-09-28 15:20:19 +00:00
bancika 426eb3c6c2 Diode symbol 2012-09-28 15:17:35 +00:00
bancika 4c8cae36c1 Diode symbol 2012-09-28 15:16:45 +00:00
bancika 5cd2ceeac3 Diode symbol 2012-09-28 15:16:34 +00:00
bancika 979eb7a9cf Diode symbol 2012-09-28 15:16:19 +00:00
bancika c9d60e4d4f classpath util method 2012-09-27 16:18:34 +00:00
bancika 948d8e7b4a classpath util method 2012-09-27 16:18:28 +00:00
bancika 2f06f00d2f classpath util method 2012-09-27 16:18:18 +00:00
bancika 45841657a0 Mirrored text for PCB artwork 2012-09-27 16:17:56 +00:00
bancika e481fdb986 Mirrored text for PCB artwork 2012-09-27 14:33:40 +00:00
bancika 44c358af2b Mirrored text for PCB artwork 2012-09-27 14:33:32 +00:00
bancika d57ce6dc4a classpath debug 2012-09-25 20:30:15 +00:00
bancika e9b81795b7 allow null values 2012-09-25 20:24:03 +00:00
bancika 6c7e149c93 inductor symbol
allow empty values
2012-09-25 14:45:37 +00:00
bancika db173acf77 inductor symbol
allow empty values
2012-09-25 14:45:22 +00:00
bancika deae73f6be inductor symbol
allow empty values
2012-09-25 14:45:11 +00:00
bancika 7ac43b5e1e classpath util method 2012-09-25 08:50:22 +00:00
bancika 514b659677 classpath util method 2012-09-25 08:50:11 +00:00
bancika 06d642b494 classpath util method 2012-09-25 08:48:18 +00:00
bancika 12b46bdfc8 classpath util method 2012-09-25 08:47:44 +00:00
bancika e98f61ae6f classpath 2012-09-24 16:24:46 +00:00
bancika 44cc3f1dd5 2012-09-24 14:29:32 +00:00
bancika 6e510c56a2 2012-09-24 14:29:04 +00:00
bancika b181a86fa9 Diode symbol 2012-09-24 14:23:30 +00:00
bancika fbb28d74cd Diode symbol 2012-09-24 14:23:09 +00:00
bancika bf9bf70761 Pentode symbol 2012-09-24 13:34:30 +00:00
bancika f7a5038912 Pentode symbol 2012-09-24 13:34:05 +00:00
bancika f62df8d58e Triode symbol 2012-09-24 10:49:01 +00:00
bancika d0f6302038 Triode symbol 2012-09-24 10:48:55 +00:00
bancika d7198e4705 jack outline 2012-09-21 13:42:07 +00:00
bancika 8ea4ba6aab jack outline 2012-09-21 13:42:00 +00:00
bancika e604a54dd8 switch outline 2012-09-21 12:31:20 +00:00
bancika 85207733d5 switch outline 2012-09-21 12:31:14 +00:00
bancika 3385d04d95 Outline mode for trimmers, potentiometers and transistors 2012-09-21 11:32:34 +00:00
bancika ec597d964c Outline mode for trimmers, potentiometers and transistors 2012-09-21 11:32:28 +00:00
bancika abf9faa05a Editable label color for leaded components 2012-09-21 10:42:33 +00:00
bancika e2412c223a Editable label color for leaded components 2012-09-21 10:42:26 +00:00
bancika edc4bd4928 2012-09-18 10:29:43 +00:00
bancika 90be75db5e 2012-09-18 10:29:35 +00:00
bancika ee0a503bbb OSX build 2012-09-18 10:25:20 +00:00
bancika eed1d9601c OSX build 2012-09-18 10:25:12 +00:00
bancika ce3d5fc808 update.xml 2012-09-17 10:58:58 +00:00
bancika 09db593d28 Added connector dot component
Zero-sized holes on pads
2012-09-13 15:12:41 +00:00
bancika 25cdfd199a Added connector dot component
Zero-sized holes on pads
2012-09-13 15:12:36 +00:00
bancika 92495b1cf0 Ability to flip standing diodes 2012-09-13 15:05:29 +00:00
bancika 039fabc916 Ability to flip standing diodes 2012-09-13 15:05:21 +00:00
bancika f7a73f2bcb Ability to flip standing diodes 2012-09-13 15:05:15 +00:00
bancika a6731fd284 Ability to rotate text 2012-09-07 14:48:12 +00:00
bancika 5db8288b0a Ability to rotate text 2012-09-07 14:48:04 +00:00
bancika aea4c434dd Radial components become transparent by themself 2012-09-07 09:13:40 +00:00
bancika 35dfe799c0 Radial components become transparent by themself 2012-09-07 09:13:35 +00:00
bancika 5087a84dc1 right click improvement 2012-09-03 08:41:16 +00:00
bancika bda92b6982 added template menu option 2012-09-03 08:38:38 +00:00
bancika 732cb102a3 fixed building 2012-08-31 16:34:32 +00:00
bancika cf7dc0778b 2012-08-31 15:27:33 +00:00
bancika 75b2afad09 Added support for component templates 2012-08-31 15:26:34 +00:00
bancika e85ffd1483 Ability to rotate toggle switch 2012-08-31 13:49:48 +00:00
bancika 5abf2ebaa3 Ability to rotate toggle switch 2012-08-31 13:49:42 +00:00
bancika b0164a1ddd Ability to rotate toggle switch 2012-08-31 13:49:34 +00:00
bancika 371fee0614 2012-08-31 13:17:46 +00:00
bancika 28f56693a9 icon rendering 2012-08-31 13:17:02 +00:00
bancika 9ebfad7d05 icon rendering 2012-08-31 13:16:43 +00:00
bancika acbd3d8378 Added support for component templates 2012-08-31 13:12:24 +00:00
bancika 4997e5b3bf render quality 2012-08-31 12:49:13 +00:00
bancika 5e86621f37 Hidden "default" checkboxes from the editor 2012-08-31 12:34:00 +00:00
bancika 84f2da5313 Added support for component templates 2012-08-31 11:23:08 +00:00
bancika f164473d25 Added support for component templates 2012-08-31 11:10:22 +00:00
bancika 8804295df6 Added support for component templates 2012-08-31 11:10:08 +00:00
bancika 8c3c6ea56e selection rect 2012-08-30 15:04:08 +00:00
bancika 7f5f61f5b0 back compatibility 2012-08-30 09:44:11 +00:00
bancika 6d79b453de back compatibility 2012-08-30 09:42:42 +00:00
bancika 894f070fee 2012-08-30 09:38:39 +00:00
bancika e115f87f65 v1 pot and label import bug 2012-08-30 09:38:15 +00:00
bancika 6068619c43 v1 pot and label import bug 2012-08-30 09:38:08 +00:00
bancika cb547e40fb v1 pot and label import bug 2012-08-30 09:37:59 +00:00
bancika 502186b1e3 Fixed ruler jumping issue 2012-08-29 16:08:07 +00:00
bancika a051382e6c better quality icon rendering 2012-08-29 15:53:34 +00:00
bancika 4e3451bdf9 TO-3 transistors 2012-08-29 15:52:27 +00:00
bancika 9f891d19c2 Label vertical and horizontal alignment can be changed 2012-08-29 13:29:46 +00:00
bancika 923107e3ea Label vertical and horizontal alignment can be changed 2012-08-29 13:23:03 +00:00
bancika a1d39c047e Label vertical and horizontal alignment can be changed 2012-08-29 13:22:58 +00:00
bancika 5b439c1603 TO-3 transistors 2012-08-29 12:53:35 +00:00
bancika c3308fa6e9 TO-3 transistors 2012-08-29 12:53:26 +00:00
bancika 19e1a3576a Miniature and ultra-miniature PCB mount relays 2012-08-28 15:03:46 +00:00
bancika 532b482fed Miniature and ultra-miniature PCB mount relays 2012-08-28 15:03:20 +00:00
bancika 6c34a4cd8d label fix 2012-08-28 15:01:45 +00:00
bancika de348acff7 Folded TO-220 transistor 2012-08-27 17:26:12 +00:00
bancika ce63423c66 Folded TO-220 transistor 2012-08-27 17:26:07 +00:00
bancika 293c3096b0 Editable pin spacing for all radial components
Folded elytics
2012-08-27 15:45:20 +00:00
bancika 3db2a06f52 Exception fix for java 7 2012-08-27 15:45:03 +00:00
bancika 064d83d2c4 2012-08-27 15:34:22 +00:00
bancika a1a9171c7c Editable pin spacing for all radial components
Folded elytics
2012-08-27 15:31:31 +00:00
bancika b0ce8242be Editable pin spacing for all radial components
Folded elytics
2012-08-27 15:31:25 +00:00
bancika c08e52b994 Editable pin spacing for all radial components
Folded elytics
2012-08-27 14:34:59 +00:00
bancika b454c017a2 Editable pin spacing for all radial components
Folded elytics
2012-08-27 14:34:50 +00:00
bancika 9a6a8cc646 Editable pin spacing for all radial components
Folded elytics
2012-08-27 14:34:45 +00:00
bancika 28cbc39b5f Added TO-1
Added folded TO-92
2012-08-27 10:31:23 +00:00
bancika 1b24c8eb16 Added TO-1
Added folded TO-92
2012-08-24 15:58:44 +00:00
bancika 80bd386564 Added TO-1
Added folded TO-92
2012-08-24 15:58:37 +00:00
bancika ddfac76b58 Component naming bug fix 2012-08-24 15:58:14 +00:00
bancika bb22ef61ff BOM backward compatibility 2012-08-24 14:09:09 +00:00
bancika 4b9349fbcb BOM backward compatibility 2012-08-24 14:08:01 +00:00
bancika 7d13dd647a BOM exception fix 2012-08-24 14:05:43 +00:00
bancika a1a290671d Show voltage and power ratings in the BOM where applicable 2012-08-24 13:43:07 +00:00
bancika 0c99b2b6a6 Show voltage and power ratings in BOM where applicable 2012-08-24 13:42:37 +00:00
bancika cce34c9d9a Show voltage and power ratings in BOM where applicable 2012-08-24 13:42:22 +00:00
bancika 1e34913d1a Show voltage and power ratings in BOM where applicable 2012-08-24 13:42:10 +00:00
bancika f419c1afb9 Multi-layer PCB support 2012-08-24 11:12:46 +00:00
bancika 4b2242336a Multi-layer PCB support 2012-08-24 11:12:35 +00:00
bancika 30ab42a47b Multi-layer PCB support 2012-08-24 11:12:30 +00:00
bancika 34c9648b47 Editable BOM color 2012-08-23 16:00:50 +00:00
bancika 0aea4c6eed Editable BOM color 2012-08-23 16:00:46 +00:00
bancika ff43225f11 Block user operations 2012-08-23 15:44:40 +00:00
bancika 585351bb11 Block user operations 2012-08-23 15:44:33 +00:00
bancika 58ac3d8148 Polygon Ground Fill component 2012-08-23 15:12:10 +00:00
bancika 00a05f6f15 Polygon Ground Fill component 2012-08-23 15:12:01 +00:00
bancika a800542a14 2012-08-23 09:49:20 +00:00
bancika 65a5775d5d better logging 2012-08-23 09:34:04 +00:00
bancika 2001015f9e Image fixes 2012-08-22 13:19:44 +00:00
bancika cd3b03433f Image fixes 2012-08-22 13:19:38 +00:00
bancika 547fb9b44f Undo-redo repeated several times messes up selection 2012-08-22 11:14:08 +00:00
bancika 78d76197cf Undo-redo repeated several times messes up selection 2012-08-22 11:14:03 +00:00
bancika e351d2669d Two components are created instead of one 2012-08-22 10:25:53 +00:00
bancika 9209782401 Better sorting in the BOM (e.g. R2 should go before R10)
Better Audo-Edit
2012-08-22 10:16:44 +00:00
bancika c406632299 Better sorting in the BOM (e.g. R2 should go before R10)
Better Audo-Edit
2012-08-22 10:16:19 +00:00
bancika 23fc091667 Better sorting in the BOM (e.g. R2 should go before R10)
Better Audo-Edit
2012-08-22 10:16:07 +00:00
bancika 6e6d70fcd3 Rectangle selection triggers file (modified) state 2012-08-21 21:53:21 +00:00
1239 changed files with 154786 additions and 24418 deletions
+8
View File
@@ -0,0 +1,8 @@
Thank you for reporting issues and contributing ideas and features to DIYLC repository!
Before you proceed, please read the following:
* If you are reporting a bug, please attach the latest application log file together with description of steps that lead to the issue. They can be found in the user directory under `.diylc/logs` directory. On Windows 7 and later, it's located in `c:/Users/<your username>/.diylc/logs`. On Linux and MacOS, it's typically in `/Users/<your username>/.diylc/logs`.
* If you are having issues starting the application under MacOS, make sure that 3rd party apps are allowed on your Mac. This document covers how to do it - https://support.apple.com/en-us/HT202491.
* Try to look for similar unresolved issues that are already reported to avoid duplicates.
* Make sure that you are running the latest version of DIYLC.
+3
View File
@@ -0,0 +1,3 @@
.idea
*.iml
*.eml
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+50
View File
@@ -0,0 +1,50 @@
<p align="justify"><strong>DIYLC is provided free of charge and can be used and redistributed freely. Please note that it takes a lot of time and effort to build, test and maintain it and to interact with the growing community of users. If you find DIYLC useful and want to support further development, please consider making a small PayPal donation. Every little bit counts! If you have some extra parts, transistors, tubes, ICs, caps...anything useful for a fellow DIYer, I'll gladly accept a donation in parts.</strong></p>
<p align="center"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=U6GLS8HLTSU88" rel="nofollow"><img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif"></a> </p>
<a href="https://github.com/bancika/diy-layout-creator/releases/latest">Click here</a> to get the latest version for all platforms.</a><br>
<a href="https://github.com/bancika/diy-layout-creator/tree/wiki">Click here</a> to read the user documentation as well as developer documentation.<br>
<b>OSX users</b>: make sure that <i>3rd party apps are allowed</i> on your Mac before installing DIYLC. <a href="https://support.apple.com/en-us/HT202491">This document</a> covers how to do it.
<h3><a name="News"></a>Introduction<a href="#Introduction" class="section_anchor"></a></h3>
<p align="justify">DIY Layout Creator (DIYLC in short) is a freeware drawing tool developed with help of the large online community of DIY electronics enthusiasts. It incorporates many ideas that came from people using older versions of the application. The goal is to provide a simple interface and enough power to let the user draw schematics, board/chassis layouts and guitar wiring diagrams quickly and without a steep learning curve. Also, it is buitd around a flexible open source framework that may be used to draw pretty much anything. Below is a sample board layout drawn in DIYLC3. </p>
<p></p>
<p align="center"><a href="http://diy-fever.com/wordpress/wp-content/gallery/diylc/diylc_3_36_rangemaster.png" rel="nofollow"><img src="http://diy-fever.com/nextgen-image/833/480x0x90/a93c6f7598bc16fce4f4aad480631523"></a></p>
<p></p>
<h3><a name="Key Features"></a>Features<a href="#Features" class="section_anchor"></a></h3>
<ul>
<li>platform independence, will run on any machine having Java JRE/JDK 1.6.0_45 or newer </li>
<li>easy to use interface, most of the operations can be done using mouse </li>
<li>draw PCB, perfboard, stripboard or point-to-point circuit layouts layouts, schematics and guitar wiring diagrams </li>
<li>high flexibility, has the API to allow plug-ins and new components to be added</li>
<li>improved performance and reduced memory consumption compared to the previous versions </li>
<li>save default values for each property of a component individually </li>
<li>group components together and treat them as one, e.g. move, edit or delete </li>
<li>export the output to image, PDF or printer </li>
<li>export PCB trace mask suitable for toner transfer </li>
<li>export the circuit to a SPICE compatible netlist (beta) </li>
<li>create a Bill of Materials as a part of the project or export it to few different file formats </li>
<li>analyze guitar wirings and show detailed pickup configuration in each switch configuration</li>
<li>zoom in/out feature </li>
<li>configurable grid spacing on the project level </li>
<li>auto update checks for new versions </li>
<li>import files created with older versions of the application </li>
<li>cloud feature - share your projects, search through the cloud and download other users' projects </li>
<li>highlight connected areas to simplify validation and circuit debugging</li>
</ul>
<p>To report bugs or request a new feature go to <a href="https://github.com/bancika/diy-layout-creator/issues" rel="nofollow">Issues</a> page and create a new issue describing your problem or request. </p>
<p>To join the discussion or request technical assistance, use the dedicated <a href="http://groups.google.com/group/diy-layout-creator" rel="nofollow">Discussion Group</a>. </p>
<h3><a name="Want_to_contribute?"></a>Want to contribute?<a href="#Want_to_contribute?" class="section_anchor"></a></h3>
<p>If you want to help the DIYLC project, there are several things you can do: </p>
<ul>
<li>Help with adding the information to the <a href="https://github.com/bancika/diy-layout-creator/blob/wiki/Manual.md">user manual</a>. </li>
<li>Extend the component base, read <a href="https://github.com/bancika/diy-layout-creator/blob/wiki/ComponentAPI.md" rel="nofollow">this wiki</a> to learn how to create new components. </li>
<li>Add a new functionality though plug-ins, read <a href="https://github.com/bancika/diy-layout-creator/blob/wiki/PluginAPI.md" rel="nofollow">this wiki</a> to learn how to create new plug-ins. </li>
<li>If you are good with design, DIYLC could use a fancy splash screen and/or a new application icon in 16x16, 32x32 and 48x48 formats. </li>
<li>Consider making a small <a href="http://diy-fever.com/donate" rel="nofollow">PayPal donation</a>. </li>
</ul>
<h3><a name="License_information"></a>License information<a href="#License_information" class="section_anchor"></a></h3>
<p>Source code is released under <a href="https://www.gnu.org/licenses/gpl-3.0.txt">GNU General Public License version 3</a>. Contact the project owner to obtain a license in case you plan to use the source code, or any part of it, in commercial purposes. </p>
<p></p>
<h3><a name="Credits"></a>Credits<a href="#Credits" class="section_anchor"></a></h3>
<ul>
<li>Big thanks goes to folks from the following online communities for contributing ideas and helped test the app: <a href="http://www.diystompboxes.com/smfforum/" rel="nofollow">DIY Stompboxes</a>, <a href="http://ax84.com/bbs" rel="nofollow">AX84</a> and <a href="http://freestompboxes.org" rel="nofollow">Free Stompboxes</a>. </li>
<li>I'm happy to report that DIYLC 3 is the fastest version ever. <a href="http://www.yourkit.com/java/profiler/index.jsp" rel="nofollow">YourKit Java Profiler</a> helped tremendously with memory and performance profiling and pointed me to places in the code that took longer to run or consumed more memory than I'd like them to. I strongly recommend this tool to anyone developing Java or .NET applications because it helps finding bottlenecks and allocation hot-spots very fast.<br><br>YourKit is kindly supporting open source projects with its full-featured Java Profiler.<br>YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications.<br>Take a look at YourKit's leading software products: <a href="http://www.yourkit.com/java/profiler/index.jsp" rel="nofollow">YourKit Java Profiler</a> and <a href="http://www.yourkit.com/.net/profiler/index.jsp" rel="nofollow">YourKit .NET Profiler</a> </li>
</ul>
Binary file not shown.
@@ -1,7 +0,0 @@
package org.diylc.common;
public class BadPositionException extends Exception {
private static final long serialVersionUID = 1L;
}
@@ -1,102 +0,0 @@
package org.diylc.common;
import javax.swing.Icon;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.BomPolicy;
/**
* Entity class used to describe a component type.
*
* @author Branislav Stojkovic
*
* @see IDIYComponent
*/
public class ComponentType {
private String name;
private String description;
private CreationMethod creationMethod;
private String category;
private String namePrefix;
private String author;
private Icon icon;
private Class<? extends IDIYComponent<?>> instanceClass;
private double zOrder;
private boolean flexibleZOrder;
private boolean stretchable;
private BomPolicy bomPolicy;
public ComponentType(String name, String description, CreationMethod creationMethod,
String category, String namePrefix, String author, Icon icon,
Class<? extends IDIYComponent<?>> instanceClass, double zOrder, boolean flexibleZOrder,
boolean stretchable, BomPolicy bomPolicy) {
super();
this.name = name;
this.description = description;
this.creationMethod = creationMethod;
this.category = category;
this.namePrefix = namePrefix;
this.author = author;
this.icon = icon;
this.instanceClass = instanceClass;
this.zOrder = zOrder;
this.flexibleZOrder = flexibleZOrder;
this.stretchable = stretchable;
this.bomPolicy = bomPolicy;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public CreationMethod getCreationMethod() {
return creationMethod;
}
public String getCategory() {
return category;
}
public String getNamePrefix() {
return namePrefix;
}
public String getAuthor() {
return author;
}
public Icon getIcon() {
return icon;
}
public Class<? extends IDIYComponent<?>> getInstanceClass() {
return instanceClass;
}
public double getZOrder() {
return zOrder;
}
public boolean isFlexibleZOrder() {
return flexibleZOrder;
}
public boolean isStretchable() {
return stretchable;
}
public BomPolicy getBomPolicy() {
return bomPolicy;
}
@Override
public String toString() {
return name;
}
}
@@ -1,11 +0,0 @@
package org.diylc.common;
public enum Display {
NAME, VALUE;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
@@ -1,40 +0,0 @@
package org.diylc.common;
import java.awt.Graphics;
/**
* Enumerates all options that can be used when drawing a project.
*
* @see IPlugInPort#draw(java.awt.Graphics2D, java.util.Set, IComponentFiler)
*
* @author Branislav Stojkovic
*/
public enum DrawOption {
/**
* Selection rectangle will be drawn when needed and selected components may
* be rendered differently.
*/
SELECTION,
/**
* Selected zoom level will be applied to scale the {@link Graphics} before
* drawing.
*/
ZOOM,
/**
* Grid lines are drawn.
*/
GRID,
/**
* Control points are drawn.
*/
CONTROL_POINTS,
/**
* Anti-aliasing is used when drawing.
*/
ANTIALIASING,
/**
* Draw components in outline mode.
*/
OUTLINE_MODE;
}
@@ -1,83 +0,0 @@
package org.diylc.common;
import java.awt.Rectangle;
import java.awt.geom.Point2D;
import org.diylc.core.Project;
/**
* Enumerates all possible events between {@link IPlugInPort} and
* {@link IPlugIn}. Some events overlap so be careful which ones you subscribe
* for and how you process them.
*
* @author Branislav Stojkovic
*/
public enum EventType {
/**
* Called when zoom level changes. Typically only one parameter of type
* {@link Double} is passed with new zoom level.
*/
ZOOM_CHANGED,
/**
* Called when a new project is loaded. New {@link Project} is the first
* parameter. Boolean flag is the second parameter and it's true when new
* project is loaded, false when the same project has been either reloaded
* or loaded with undo/redo operations.
*/
PROJECT_LOADED,
/**
* Called when either current file name or modified flag are changed. The
* first parameter is the current file name, the second one is a boolean
* modified flag.
*/
FILE_STATUS_CHANGED,
/**
* Called when selection rectangle is changed. Object of type
* {@link Rectangle} is the only parameter and it contains the new selection
* rectangle.
*/
SELECTION_RECT_CHANGED,
/**
* Called when component selection is changed. New
* {@link ComponentSelection} is attached as a parameter.
*/
SELECTION_CHANGED,
/**
* Called when selection size changes, together with a {@link Point2D}
* object containing selection size (x = width, y = height). Size is
* expressed in the default measure (cm for metric, inches for imperial).
*/
REPAINT,
/**
* Called when new component slot has been changed. The only parameter is
* {@link ComponentType} and may be null.
*/
SLOT_CHANGED,
/**
* Called when the current project has been modified. Two instances of
* {@link Project} are passed as parameters, one before and one after the
* change. The third parameter is a string containing change description.
*/
PROJECT_MODIFIED,
/**
* Called when control points under the cursor are changed. A single
* parameter is passed, an instance of
* <code>Map<IDIYComponent<?>, Set<Integer>></code> containing all the
* components and indices of their control points that are under the cursor.
*/
AVAILABLE_CTRL_POINTS_CHANGED,
/**
* Called when mouse cursor is moved. Point object is passed, containing the
* current cursor location (not taking zoom into account).
*/
MOUSE_MOVED,
/**
* Called when a layer status is changed. The first parameter is a set of indices of locked layers. All layers not included are considered unlocked.
*/
LAYER_STATE_CHANGED,
/**
* Called to update the status message. New status message is passed as a first parameter.
*/
STATUS_MESSAGE_CHANGED;
}
@@ -1,6 +0,0 @@
package org.diylc.common;
public enum GridType {
LINES, CROSSHAIR, DOT, NONE;
}
@@ -1,5 +0,0 @@
package org.diylc.common;
public enum HorizontalAlignment {
LEFT, CENTER, RIGHT
}
@@ -1,8 +0,0 @@
package org.diylc.common;
import org.diylc.core.IDIYComponent;
public interface IComponentFiler {
boolean testComponent(IDIYComponent<?> component);
}
@@ -1,22 +0,0 @@
package org.diylc.common;
public interface IKeyProcessor {
public static final int VK_LEFT = 0x25;
public static final int VK_UP = 0x26;
public static final int VK_RIGHT = 0x27;
public static final int VK_DOWN = 0x28;
/**
* Notifies the presenter that a key hes been pressed on the canvas.
*
* @param key
* @param ctrlDown
* @param shiftDown
* @param altDown
*
* @return true if the event should be consumed
*/
boolean keyPressed(int key, boolean ctrlDown, boolean shiftDown,
boolean altDown);
}
@@ -1,69 +0,0 @@
package org.diylc.common;
import java.awt.Point;
public interface IMouseProcessor {
/**
* Notifies the presenter that mouse is clicked.
*
* Note: point coordinates are display based, i.e. scaled for zoom factor.
*
* @param point
* @param button
* @param ctrlDown
* @param shiftDown
* @param altDown
* @param clickCount
*/
void mouseClicked(Point point, int button, boolean ctrlDown, boolean shiftDown, boolean altDown,
int clickCount);
/**
* Notifies the presenter that mouse is moved.
*
* Note: point coordinates are display based, i.e. scaled for zoom factor.
*
* @param point
* @param ctrlDown
* @param shiftDown
* @param altDown
*/
void mouseMoved(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown);
/**
* Notification that drag has been started from the specified point.
*
* Note: point coordinates are scaled for zoom factor.
*
* @param point
* @param dragAction
*/
void dragStarted(Point point, int dragAction);
/**
* Checks if it's possible to drop over the specified point.
*
* Note: point coordinates are scaled for zoom factor.
*
* @param point
* @return
*/
boolean dragOver(Point point);
/**
* Changes the current drag action during the dragging.
*
* @param dragAction
*/
void dragActionChanged(int dragAction);
/**
* Notification that drag has been ended in the specified point.
*
* Note: point coordinates are scaled for zoom factor.
*
* @param point
*/
void dragEnded(Point point);
}
@@ -1,19 +0,0 @@
package org.diylc.common;
import org.diylc.appframework.simplemq.IMessageListener;
/**
* Interface for plug-ins.
*
* @author Branislav Stojkovic
*/
public interface IPlugIn extends IMessageListener<EventType> {
/**
* Method that connects the plug-in with {@link IPlugInPort}. Called by the
* application when plug-in is installed.
*
* @param plugInPort
*/
void connect(IPlugInPort plugInPort);
}
@@ -1,311 +0,0 @@
package org.diylc.common;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.Point2D;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.diylc.appframework.simplemq.IMessageListener;
import org.diylc.appframework.simplemq.MessageDispatcher;
import org.diylc.appframework.update.VersionNumber;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.Theme;
/**
* Interface for communication between plug-ins and the application. Plug-ins
* may acquire information or make changes through this interface. Application
* events are dispatched to plug-ins through {@link MessageDispatcher}
*
* @author Branislav Stojkovic
*
* @see IPlugIn
* @see MessageDispatcher
* @see IMessageListener
* @see EventType
*/
public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyProcessor {
public static final String ANTI_ALIASING_KEY = "antiAliasing";
public static final String HI_QUALITY_RENDER_KEY = "hiQualityRender";
public static final String EXPORT_GRID_KEY = "exportGrid";
public static final String STICKY_POINTS_KEY = "stickyPoints";
public static final String METRIC_KEY = "metric";
public static final String SNAP_TO_GRID_KEY = "snapToGrid";
public static final String AUTO_PADS_KEY = "autoCreatePads";
public static final String CONTINUOUS_CREATION_KEY = "continuousCreation";
public static final String AUTO_EDIT_KEY = "autoEdit";
public static final String ABNORMAL_EXIT_KEY = "abnormalExit";
public static final String WHEEL_ZOOM_KEY = "wheelZoom";
public static final String OUTLINE_KEY = "outline";
public static final String THEME_KEY = "theme";
public static final String RECENT_COMPONENTS_KEY = "recentComponents";
public static final int DND_TOGGLE_STICKY = 0x1;
public static final int DND_TOGGLE_SNAP = 0x40000000;
/**
* Mouse button constants.
*/
public static final int NOBUTTON = 0;
public static final int BUTTON1 = 1;
public static final int BUTTON2 = 2;
public static final int BUTTON3 = 3;
/**
* Returns size of the canvas that takes project dimensions into account as
* well as zoom level. Each dimension is calculated as the product of the
* actual size and the number of pixels per unit. If <code>useZoom</code> is
* set to true, the result is scaled by zoom factor.
*
* @param useZoom
*
* @return canvas dimensions
*/
Dimension getCanvasDimensions(boolean useZoom);
/**
* Returns an instance of {@link Cursor} that should be used at the
* specified location.
*
* Note: point coordinates are scaled for zoom factor.
*
* @param point
* @return cursor
*/
Cursor getCursorAt(Point point);
/**
* Returns an instance of currently loaded project.
*
* @return
*/
Project getCurrentProject();
/**
* Loads specified {@link Project}.
*
* @param project
* @param freshStart
*/
void loadProject(Project project, boolean freshStart);
/**
* Creates a new project.
*/
void createNewProject();
/**
* Loads a project from the specified file.
*
* @param fileName
*/
void loadProjectFromFile(String fileName);
/**
* Saves the current project into the specified file.
*
* @param fileName
* @param isBackup
*/
void saveProjectToFile(String fileName, boolean isBackup);
/**
* @return the current file name.
*/
String getCurrentFileName();
/**
* @return true if the current project is modified.
*/
boolean isProjectModified();
/**
* Shows a user dialog if there are changes to confirm that it's safe to
* proceed.
*
* @return true, if file actions (new, open, close) can be taken
*/
boolean allowFileAction();
/**
* Returns all available {@link ComponentType}s classified by category.
* Result is a {@link Map} between category name to a {@link List} of all
* {@link ComponentType}s that share that category name.
*
* @return
*/
Map<String, List<ComponentType>> getComponentTypes();
/**
* Draws project on the provided {@link Graphics2D}. If the provided filter
* is not null, it will be used to filter the components that are shown.
*
* @param g2d
* @param drawOptions
* specific drawing options
* @param filter
*/
void draw(Graphics2D g2d, Set<DrawOption> drawOptions, IComponentFiler filter);
Double[] getAvailableZoomLevels();
/**
* Returns current zoom level where <code>zoomLevel = 1.0d</code> means
* 100%.
*
* @return current zoom level
*/
double getZoomLevel();
/**
* Changes current zoom level where <code>zoomLevel = 1.0d</code> means 100%
*
* @param zoomLevel
* new zoom leve
*/
void setZoomLevel(double zoomLevel);
/**
* Returns current version number.
*
* @return
*/
VersionNumber getCurrentVersionNumber();
/**
* Adds a list of components to the project.
*
* @param components
*/
void pasteComponents(List<IDIYComponent<?>> components);
/**
* Deletes all the selected components from the project.
*/
void deleteSelectedComponents();
/**
* Sets default value for the specified property name for currently selected
* component types.
*
* @param propertyName
* display name for property
* @param value
* new default value, must not be null
*/
void setSelectionDefaultPropertyValue(String propertyName, Object value);
/**
* Sets default value for the specified property name for projects.
*
* @param propertyName
* display name for property
* @param value
* new default value, must not be null
*/
void setProjectDefaultPropertyValue(String propertyName, Object value);
/**
* @return a list of properties that are mutual for all the selected
* components. Resulting list may be empty if selected components do
* not have mutual properties or can be null if the selection is
* empty.
*/
List<PropertyWrapper> getMutualSelectionProperties();
void editSelection();
/**
* @return a list of editable properties of the current project.
*/
List<PropertyWrapper> getProjectProperties();
/**
* Applies specified properties to the current project.
*
* @param properties
*/
void applyPropertiesToProject(List<PropertyWrapper> properties);
/**
* Gets the current new component slot.
*/
ComponentType getNewComponentTypeSlot();
/**
* Sets the new component slot. Specified component type will be used to
* instantiate new component.
*/
void setNewComponentTypeSlot(ComponentType componentType);
/**
* Changes default size notation, true for metric, false for imperial.
*
* @param isMetric
*/
void setMetric(boolean isMetric);
/**
* Groups all selected components.
*/
void groupSelectedComponents();
/**
* Ungroups all selected components.
*/
void ungroupSelectedComponents();
/**
* Locks or unlocks the specified layer. All components within +- 0.5 range
* will be affected by the change as well.
*
* @param layerZOrder
* @param locked
*/
void setLayerLocked(int layerZOrder, boolean locked);
/**
* @return selection size expressed in either inches or centimeters, based
* on the user preference.
*/
Point2D calculateSelectionDimension();
/**
* Sends each of the selected components one step back.
*/
void sendSelectionToBack();
/**
* Brings each of the selected components one step to front.
*/
void bringSelectionToFront();
/**
* Causes the display to refresh.
*/
void refresh();
/**
* @return currently selected theme.
*/
Theme getSelectedTheme();
/**
* Changes the current theme.
*
* @param theme
*/
void setSelectedTheme(Theme theme);
/**
* Renumbers all the selected components.
*
* @param xAxisFirst
*/
void renumberSelectedComponents(boolean xAxisFirst);
}
@@ -1,48 +0,0 @@
package org.diylc.common;
import java.awt.Point;
import java.util.List;
import org.diylc.core.ExpansionMode;
import org.diylc.core.IDIYComponent;
public interface ISelectionProcessor {
/**
* Returns the current {@link ComponentTransferable}.
*
* @return
*/
List<IDIYComponent<?>> getSelectedComponents();
/**
* Updates the selection with the specified list of component. Also, updates
* control point map with all components that are stuck to the newly
* selected components.
*
* @param newSelection
*/
void updateSelection(List<IDIYComponent<?>> newSelection);
/**
* Finds all components at the specified location, sorted by z-index from
* top to bottom.
*
* @param point
* @return
*/
List<IDIYComponent<?>> findComponentsAt(Point point);
/**
* Expands the current selection to include surrounding components.
* Options are controlled with <code>expansionMode</code> flag.
*
* @param expansionMode
*/
void expandSelection(ExpansionMode expansionMode);
/**
* Selects all components in the project.
*/
void selectAll();
}
@@ -1,34 +0,0 @@
package org.diylc.common;
/**
* Abstract layer between the app and platform worker thread implementation.
*
* @author Branislav Stojkovic
*
* @param <T>
*/
public interface ITask<T> {
/**
* Runs in background thread.
*
* @return
* @throws Exception
*/
T doInBackground() throws Exception;
/**
* Called if background thread fails.
*
* @param e
*/
void failed(Exception e);
/**
* Called if background thread is executed correctly, the result is passed
* as a parameter.
*
* @param result
*/
void complete(T result);
}
@@ -1,11 +0,0 @@
package org.diylc.common;
public enum LabelPosition {
ABOVE, BELOW;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
@@ -1,39 +0,0 @@
package org.diylc.common;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Stroke;
import java.util.HashMap;
import java.util.Map;
/**
* Repository for object that may be reused, such as {@link Stroke} or
* {@link AlphaComposite}.
*
* @author Branislav Stojkovic
*/
public class ObjectCache {
private static ObjectCache instance;
public static ObjectCache getInstance() {
if (instance == null) {
instance = new ObjectCache();
}
return instance;
}
private ObjectCache() {
}
private Map<Integer, Stroke> basicStrokeMap = new HashMap<Integer, Stroke>();
public Stroke fetchBasicStroke(int width) {
if (basicStrokeMap.containsKey(width)) {
return basicStrokeMap.get(width);
}
Stroke stroke = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
basicStrokeMap.put(width, stroke);
return stroke;
}
}
@@ -1,15 +0,0 @@
package org.diylc.common;
public enum Orientation {
DEFAULT, _90, _180, _270;
@Override
public String toString() {
if (this == DEFAULT) {
return "Default";
} else {
return name().replace("_", "") + " degrees clockwise";
}
}
}
@@ -1,11 +0,0 @@
package org.diylc.common;
public enum OrientationHV {
VERTICAL, HORIZONTAL;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
@@ -1,167 +0,0 @@
package org.diylc.common;
import java.lang.reflect.InvocationTargetException;
import org.diylc.core.IPropertyValidator;
/**
* Entity class for editable properties extracted from component objects.
* Represents a single editable property together with it's current value.
*
* @author Branislav Stojkovic
*/
public class PropertyWrapper implements Cloneable {
private String name;
private Class<?> type;
private Object value;
private String setter;
private String getter;
private boolean defaultable;
private IPropertyValidator validator;
private boolean unique = true;
private boolean changed = false;
public PropertyWrapper(String name, Class<?> type, String getter,
String setter, boolean defaultable, IPropertyValidator validator) {
super();
this.name = name;
this.type = type;
this.getter = getter;
this.setter = setter;
this.defaultable = defaultable;
this.validator = validator;
}
public void readFrom(Object object) throws IllegalArgumentException,
IllegalAccessException, InvocationTargetException,
SecurityException, NoSuchMethodException {
this.value = object.getClass().getMethod(getter).invoke(object);
}
// public void readUniqueFrom(IDIYComponent component)
// throws IllegalArgumentException, IllegalAccessException,
// InvocationTargetException {
// Object newValue = getter.invoke(component);
// if (!newValue.equals(value)) {
// this.value = null;
// }
// }
public void writeTo(Object object) throws IllegalArgumentException,
IllegalAccessException, InvocationTargetException,
SecurityException, NoSuchMethodException {
object.getClass().getMethod(setter, type).invoke(object, this.value);
}
public String getName() {
return name;
}
public Class<?> getType() {
return type;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public boolean isDefaultable() {
return defaultable;
}
public IPropertyValidator getValidator() {
return validator;
}
public boolean isUnique() {
return unique;
}
public void setUnique(boolean unique) {
this.unique = unique;
}
public boolean isChanged() {
return changed;
}
public void setChanged(boolean changed) {
this.changed = changed;
}
// @Override
// public Object clone() throws CloneNotSupportedException {
// // Try to invoke clone method on value if possible.
// try {
// Method cloneMethod = value.getClass().getMethod("clone");
// return new Property(name, type, cloneMethod.invoke(value));
// } catch (Exception e) {
// }
// return new Property(name, type, value);
// }
@Override
public Object clone() throws CloneNotSupportedException {
PropertyWrapper clone = new PropertyWrapper(this.name, this.type, this.getter,
this.setter, this.defaultable, this.validator);
clone.value = this.value;
clone.changed = this.changed;
clone.unique = this.unique;
return clone;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (defaultable ? 1231 : 1237);
result = prime * result + ((getter == null) ? 0 : getter.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((setter == null) ? 0 : setter.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PropertyWrapper other = (PropertyWrapper) obj;
if (defaultable != other.defaultable)
return false;
if (getter == null) {
if (other.getter != null)
return false;
} else if (!getter.equals(other.getter))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (setter == null) {
if (other.setter != null)
return false;
} else if (!setter.equals(other.setter))
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
return true;
}
@Override
public String toString() {
return name + " = " + value;
}
}
@@ -1,14 +0,0 @@
package org.diylc.common;
public enum ResistorColorCode {
NONE, _4_BAND, _5_BAND;
@Override
public String toString() {
if (name().startsWith("_")) {
return name().substring(1).replace("_", " ").toLowerCase();
}
return name().substring(0, 1).toUpperCase() + name().substring(1).toLowerCase();
}
}
@@ -1,5 +0,0 @@
package org.diylc.common;
public enum VerticalAlignment {
TOP, CENTER, BOTTOM
}
@@ -1,181 +0,0 @@
package org.diylc.components;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import org.diylc.common.HorizontalAlignment;
import org.diylc.common.VerticalAlignment;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.EditableProperty;
/**
* Abstract implementation of {@link IDIYComponent} that contains component name
* and toString.
*
* IMPORTANT: to improve performance, all fields except for <code>Point</code>
* and <code>Point</code> arrays should be immutable. Failing to comply with
* this can result in annoying and hard to trace bugs.
*
* @author Branislav Stojkovic
*
* @param <T>
*/
public abstract class AbstractComponent<T> implements IDIYComponent<T> {
private static final long serialVersionUID = 1L;
protected String name = "";
public static Color SELECTION_COLOR = Color.red;
public static Color LABEL_COLOR = Color.black;
public static Color LABEL_COLOR_SELECTED = Color.red;
public static Font LABEL_FONT = new Font("Tahoma", Font.PLAIN, 14);
public static Color METAL_COLOR = Color.decode("#236B8E");
@EditableProperty(defaultable = false)
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public boolean canControlPointOverlap(int index) {
return false;
}
@Override
public String toString() {
return name;
}
/**
* Returns the closest odd number, i.e. x when x is odd, or x + 1 when x is
* even.
*
* @param x
* @return
*/
protected int getClosestOdd(double x) {
return ((int) x / 2) * 2 + 1;
}
/**
* @param clip
* @return true if none of the control points lie in the clip rectangle.
*/
protected boolean checkPointsClipped(Shape clip) {
for (int i = 0; i < getControlPointCount(); i++) {
if (clip.contains(getControlPoint(i))) {
return false;
}
}
return true;
}
protected void drawCenteredText(Graphics2D g2d, String text, int x, int y,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment) {
FontMetrics fontMetrics = g2d.getFontMetrics();
Rectangle stringBounds = fontMetrics.getStringBounds(text, g2d)
.getBounds();
Font font = g2d.getFont();
FontRenderContext renderContext = g2d.getFontRenderContext();
GlyphVector glyphVector = font.createGlyphVector(renderContext, text);
Rectangle visualBounds = glyphVector.getVisualBounds().getBounds();
int textX = 0;
switch (horizontalAlignment) {
case CENTER:
textX = x - stringBounds.width / 2;
break;
case LEFT:
textX = x;
break;
case RIGHT:
textX = x - stringBounds.width;
break;
}
int textY = 0;
switch (verticalAlignment) {
case TOP:
textY = y + stringBounds.height;
break;
case CENTER:
textY = y - visualBounds.height / 2 - visualBounds.y;
break;
case BOTTOM:
textY = y - visualBounds.y;
break;
}
g2d.drawString(text, textX, textY);
}
@SuppressWarnings("unchecked")
public IDIYComponent<T> clone() throws CloneNotSupportedException {
try {
// Instantiate object of the same type
AbstractComponent<T> newInstance = (AbstractComponent<T>) this
.getClass().getConstructors()[0].newInstance();
Class<?> clazz = this.getClass();
while (AbstractComponent.class.isAssignableFrom(clazz)) {
Field[] fields = clazz.getDeclaredFields();
clazz = clazz.getSuperclass();
// fields = this.getClass().getDeclaredFields();
// Copy over all non-static, non-final fields that are declared
// in
// AbstractComponent or one of it's child classes
for (Field field : fields) {
if (!Modifier.isStatic(field.getModifiers())
&& !Modifier.isFinal(field.getModifiers())) {
field.setAccessible(true);
Object value = field.get(this);
// Deep copy point arrays.
// TODO: something nicer
if (value != null
&& value.getClass().isArray()
&& value.getClass().getComponentType()
.isAssignableFrom(Point.class)) {
Object newArray = Array.newInstance(value
.getClass().getComponentType(), Array
.getLength(value));
for (int i = 0; i < Array.getLength(value); i++) {
Point p = (Point) Array.get(value, i);
Array.set(newArray, i, new Point(p));
}
value = newArray;
}
// Deep copy points.
// TODO: something nicer
if (value != null && value instanceof Point) {
value = new Point((Point) value);
}
field.set(newInstance, value);
}
}
}
return newInstance;
} catch (Exception e) {
throw new CloneNotSupportedException("Could not clone the component. Reason: " + e.getMessage());
}
}
}
@@ -1,249 +0,0 @@
package org.diylc.components;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.CubicCurve2D;
import org.diylc.common.ObjectCache;
import org.diylc.core.ComponentState;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComponent<T> {
private static final long serialVersionUID = 1L;
public static Color GUIDELINE_COLOR = Color.blue;
public static Size DEFAULT_SIZE = new Size(1d, SizeUnit.in);
protected Point[] controlPoints = new Point[] {
new Point(0, 0),
new Point((int) (DEFAULT_SIZE.convertToPixels() / 2), 0),
new Point((int) (DEFAULT_SIZE.convertToPixels() / 2), (int) (DEFAULT_SIZE
.convertToPixels())),
new Point((int) DEFAULT_SIZE.convertToPixels(), (int) DEFAULT_SIZE.convertToPixels()) };
protected Color color = getDefaultColor();
protected PointCount pointCount = PointCount.FOUR;
/**
* Draws the specified curve onto graphics.
*
* @param curve
* @param g2d
* @param componentState
* @param theme
*/
protected abstract void drawCurve(CubicCurve2D curve, Graphics2D g2d,
ComponentState componentState);
/**
* @return default color.
*/
protected abstract Color getDefaultColor();
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(getDefaultColor().darker());
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(3));
CubicCurve2D curve = new CubicCurve2D.Double(1, height - 1, width / 4, height / 3,
3 * width / 4, 2 * height / 3, width - 1, 1);
g2d.draw(curve);
g2d.setColor(getDefaultColor());
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.draw(curve);
}
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
if (checkPointsClipped(g2d.getClip())) {
return;
}
if (componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING) {
// Do not track guidelines.
drawingObserver.stopTracking();
g2d.setStroke(Constants.DASHED_STROKE);
g2d.setColor(GUIDELINE_COLOR);
g2d.drawLine(controlPoints[0].x, controlPoints[0].y, controlPoints[1].x,
controlPoints[1].y);
g2d.drawLine(controlPoints[1].x, controlPoints[1].y, controlPoints[2].x,
controlPoints[2].y);
g2d.drawLine(controlPoints[2].x, controlPoints[2].y, controlPoints[3].x,
controlPoints[3].y);
drawingObserver.startTracking();
}
CubicCurve2D curve = new CubicCurve2D.Double(controlPoints[0].x, controlPoints[0].y,
controlPoints[1].x, controlPoints[1].y, controlPoints[2].x, controlPoints[2].y,
controlPoints[3].x, controlPoints[3].y);
Composite oldComposite = g2d.getComposite();
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
// g2d.setColor(color.darker());
// g2d.setStroke(new BasicStroke(thickness));
// g2d.draw(path);
// g2d.setColor(color);
// g2d.setStroke(new BasicStroke(thickness - 2));
// g2d.draw(path);
drawCurve(curve, g2d, componentState);
g2d.setComposite(oldComposite);
}
@EditableProperty(name = "Point Count")
public PointCount getPointCount() {
if (pointCount == null) {
pointCount = PointCount.FOUR;
}
return pointCount;
}
public void setPointCount(PointCount pointCount) {
this.pointCount = pointCount;
// Reset control points.
for (int i = 0; i < getControlPointCount(); i++) {
setControlPoint(getControlPoint(i), i);
}
}
@Override
public int getControlPointCount() {
switch (getPointCount()) {
case TWO:
return 2;
case THREE:
return 3;
case FOUR:
return 4;
}
return 0;
}
@Override
public boolean isControlPointSticky(int index) {
return index == 0 || index == getControlPointCount() - 1;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.WHEN_SELECTED;
}
@Override
public boolean canControlPointOverlap(int index) {
// Only shape control points may overlap.
switch (getPointCount()) {
case TWO:
return false;
case THREE:
return index == 1;
case FOUR:
return index == 1 || index == 2;
}
return false;
}
@Override
public Point getControlPoint(int index) {
if (index == 0) {
return controlPoints[0];
}
switch (getPointCount()) {
case TWO:
switch (index) {
case 1:
return controlPoints[3];
}
case THREE:
switch (index) {
case 1:
return controlPoints[1];
case 2:
return controlPoints[3];
}
case FOUR:
switch (index) {
case 1:
return controlPoints[1];
case 2:
return controlPoints[2];
case 3:
return controlPoints[3];
}
}
return controlPoints[index];
}
@Override
public void setControlPoint(Point point, int index) {
if (index == 0) {
controlPoints[0].setLocation(point);
} else {
switch (getPointCount()) {
case TWO:
switch (index) {
case 1:
Point center = new Point((point.x + controlPoints[0].x) / 2,
(point.y + controlPoints[0].y) / 2);
controlPoints[1].setLocation(center);
controlPoints[2].setLocation(center);
controlPoints[3].setLocation(point);
break;
}
break;
case THREE:
switch (index) {
case 1:
controlPoints[1].setLocation(point);
controlPoints[2].setLocation(point);
break;
case 2:
controlPoints[3].setLocation(point);
break;
}
break;
case FOUR:
switch (index) {
case 1:
controlPoints[1].setLocation(point);
break;
case 2:
controlPoints[2].setLocation(point);
break;
case 3:
controlPoints[3].setLocation(point);
break;
}
break;
}
}
}
@EditableProperty
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
enum PointCount {
TWO, THREE, FOUR;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
}
@@ -1,350 +0,0 @@
package org.diylc.components;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
import org.diylc.appframework.miscutils.ConfigurationManager;
import org.diylc.common.Display;
import org.diylc.common.IPlugInPort;
import org.diylc.common.ObjectCache;
import org.diylc.core.ComponentState;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
/**
* Base class for all leaded components such as resistors or capacitors. Has two
* control points and draws leads between them. Also, it positions and draws the
* shape of the component as specified by a child class.
*
* @author Branislav Stojkovic
*/
public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComponent<T> {
private static final long serialVersionUID = 1L;
public static Color LEAD_COLOR = Color.decode("#236B8E");
public static Size LEAD_THICKNESS = new Size(0.6d, SizeUnit.mm);
public static Size DEFAULT_SIZE = new Size(1d, SizeUnit.in);
protected Size length;
protected Size width;
protected Point[] points = new Point[] {
new Point((int) (-DEFAULT_SIZE.convertToPixels() / 2), 0),
new Point((int) (DEFAULT_SIZE.convertToPixels() / 2), 0) };
protected Color bodyColor = Color.white;
protected Color borderColor = Color.black;
protected Color labelColor = LABEL_COLOR;
protected Display display = Display.VALUE;
protected AbstractLeadedComponent() {
super();
try {
this.length = getDefaultLength().clone();
this.width = getDefaultWidth().clone();
} catch (CloneNotSupportedException e) {
// This should never happen because Size supports cloning.
} catch (NullPointerException e) {
// This will happen if components do not have any shape.
}
}
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
double distance = points[0].distance(points[1]);
Shape shape = getBodyShape();
// If there's no body, just draw the line connecting the ending points.
if (shape == null) {
drawLead(g2d, componentState);
} else if (supportsStandingMode()
&& length.convertToPixels() > points[0].distance(points[1])) {
// When ending points are too close draw the component in standing
// mode.
int width = getClosestOdd(this.width.convertToPixels());
Shape body = new Ellipse2D.Double(points[0].x - width / 2, points[0].y - width / 2,
width, width);
Composite oldComposite = g2d.getComposite();
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
g2d.fill(body);
g2d.setComposite(oldComposite);
Color finalBorderColor;
if (outlineMode) {
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
finalBorderColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : theme
.getOutlineColor();
} else {
finalBorderColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: borderColor;
}
g2d.setColor(finalBorderColor);
g2d.draw(body);
if (!outlineMode) {
drawLead(g2d, componentState);
}
} else {
// Normal mode with component body in the center and two lead parts.
Rectangle shapeRect = shape.getBounds();
Double theta = Math.atan2(points[1].y - points[0].y, points[1].x - points[0].x);
// Transform graphics to draw the body in the right place and at the
// right angle.
AffineTransform oldTransform = g2d.getTransform();
g2d.translate((points[0].x + points[1].x - shapeRect.width) / 2, (points[0].y
+ points[1].y - shapeRect.height) / 2);
g2d.rotate(theta, shapeRect.width / 2, shapeRect.height / 2);
// Draw body.
Composite oldComposite = g2d.getComposite();
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
if (bodyColor != null) {
if (bodyColor != null) {
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
g2d.fill(shape);
}
}
decorateComponentBody(g2d, outlineMode);
g2d.setComposite(oldComposite);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
Color finalBorderColor;
if (outlineMode) {
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
finalBorderColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : theme
.getOutlineColor();
} else {
finalBorderColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: borderColor;
}
g2d.setColor(finalBorderColor);
g2d.draw(shape);
// Go back to the original transformation to draw leads.
if (!outlineMode) {
AffineTransform textTransform = g2d.getTransform();
g2d.setTransform(oldTransform);
if (length.convertToPixels() > points[0].distance(points[1])) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
}
int leadThickness = getClosestOdd(getLeadThickness());
double leadLength = (distance - shapeRect.width) / 2 - leadThickness / 2;
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness));
Color leadColor = shouldShadeLeads() ? getLeadColor(componentState).darker()
: getLeadColor(componentState);
g2d.setColor(leadColor);
int endX = (int) (points[0].x + Math.cos(theta) * leadLength);
int endY = (int) Math.round(points[0].y + Math.sin(theta) * leadLength);
g2d.drawLine(points[0].x, points[0].y, endX, endY);
endX = (int) (points[1].x + Math.cos(theta - Math.PI) * leadLength);
endY = (int) Math.round(points[1].y + Math.sin(theta - Math.PI) * leadLength);
g2d.drawLine(points[1].x, points[1].y, endX, endY);
if (shouldShadeLeads()) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness - 2));
leadColor = getLeadColor(componentState);
g2d.setColor(leadColor);
g2d.drawLine(points[0].x, points[0].y, (int) (points[0].x + Math.cos(theta)
* leadLength), (int) (points[0].y + Math.sin(theta) * leadLength));
g2d.drawLine(points[1].x, points[1].y, (int) (points[1].x + Math.cos(theta
- Math.PI)
* leadLength), (int) (points[1].y + Math.sin(theta - Math.PI)
* leadLength));
}
g2d.setComposite(oldComposite);
g2d.setTransform(textTransform);
}
// Draw label.
g2d.setFont(LABEL_FONT);
Color finalLabelColor;
if (outlineMode) {
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
finalLabelColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED : theme
.getOutlineColor();
} else {
finalLabelColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
: labelColor;
}
g2d.setColor(finalLabelColor);
FontMetrics fontMetrics = g2d.getFontMetrics();
String label = display == Display.NAME ? getName() : getValue().toString();
Rectangle2D textRect = fontMetrics.getStringBounds(label, g2d);
// Don't offset in outline mode.
int offset = outlineMode ? 0 : getLabelOffset((int) shapeRect.getWidth(), (int) textRect.getWidth());
// Adjust label angle if needed to make sure that it's readable.
if ((theta >= Math.PI / 2 && theta <= Math.PI)
|| (theta < -Math.PI / 2 && theta > -Math.PI)) {
g2d.rotate(Math.PI, shapeRect.width / 2, shapeRect.height / 2);
offset = -offset;
}
g2d.drawString(label, (int) (shapeRect.width - textRect.getWidth()) / 2 + offset,
calculateLabelYCoordinate(shapeRect, textRect, fontMetrics));
g2d.setTransform(oldTransform);
}
}
private void drawLead(Graphics2D g2d, ComponentState componentState) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness()));
Color leadColor = shouldShadeLeads() ? getLeadColor(componentState).darker()
: getLeadColor(componentState);
g2d.setColor(leadColor);
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
if (shouldShadeLeads()) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness() - 2));
leadColor = getLeadColor(componentState);
g2d.setColor(leadColor);
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
}
}
protected void decorateComponentBody(Graphics2D g2d, boolean outlineMode) {
// Do nothing.
}
protected int calculateLabelYCoordinate(Rectangle2D shapeRect, Rectangle2D textRect,
FontMetrics fontMetrics) {
return (int) (shapeRect.getHeight() - textRect.getHeight()) / 2 + fontMetrics.getAscent();
}
protected boolean shouldShadeLeads() {
return true;
}
protected boolean supportsStandingMode() {
return false;
}
protected int getLabelOffset(int bodyWidth, int labelWidth) {
return 0;
}
/**
* @return default component length.
*/
protected abstract Size getDefaultLength();
/**
* Returns default component width.
*
* @return
*/
protected abstract Size getDefaultWidth();
/**
* @return shape that represents component body. Shape should not be
* transformed and should be referenced to (0, 0).
*/
protected abstract Shape getBodyShape();
/**
* @return default lead thickness. Override this method to change it.
*/
protected int getLeadThickness() {
return (int) LEAD_THICKNESS.convertToPixels();
}
/**
* @return default lead color. Override this method to change it.
*/
protected Color getLeadColor(ComponentState componentState) {
return componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : LEAD_COLOR;
}
@Override
public int getControlPointCount() {
return points.length;
}
@Override
public Point getControlPoint(int index) {
return (Point) points[index];
}
@Override
public boolean isControlPointSticky(int index) {
return true;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.ALWAYS;
}
@Override
public void setControlPoint(Point point, int index) {
points[index].setLocation(point);
}
@EditableProperty(name = "Color")
public Color getBodyColor() {
return bodyColor;
}
public void setBodyColor(Color bodyColor) {
this.bodyColor = bodyColor;
}
@EditableProperty(name = "Border")
public Color getBorderColor() {
return borderColor;
}
public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}
@EditableProperty(name = "Length", defaultable = true)
public Size getLength() {
return length;
}
public void setLength(Size length) {
this.length = length;
}
@EditableProperty(name = "Width", defaultable = true)
public Size getWidth() {
return width;
}
public void setWidth(Size width) {
this.width = width;
}
@EditableProperty
public Display getDisplay() {
return display;
}
public void setDisplay(Display display) {
this.display = display;
}
}
@@ -1,72 +0,0 @@
package org.diylc.components;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.geom.Rectangle2D;
import org.diylc.common.LabelPosition;
import org.diylc.core.ComponentState;
import org.diylc.core.annotations.EditableProperty;
public abstract class AbstractSchematicLeadedSymbol<T> extends AbstractLeadedComponent<T> {
private static final long serialVersionUID = 1L;
public static Color COLOR = Color.blue;
public static Color LEAD_COLOR = Color.black;
protected LabelPosition labelPosition = LabelPosition.ABOVE;
public AbstractSchematicLeadedSymbol() {
super();
// We don't want to fill the body, so use null.
this.bodyColor = null;
this.borderColor = COLOR;
}
@Override
public Color getBodyColor() {
return super.getBodyColor();
}
@Override
protected boolean shouldShadeLeads() {
return false;
}
@Override
protected int getLeadThickness() {
return 1;
}
@Override
protected int calculateLabelYCoordinate(Rectangle2D shapeRect, Rectangle2D textRect,
FontMetrics fontMetrics) {
if (labelPosition == LabelPosition.ABOVE) {
return -1;
} else {
return (int) (shapeRect.getHeight() + textRect.getHeight() - 1);
}
}
@EditableProperty(name = "Label position")
public LabelPosition getLabelPosition() {
return labelPosition;
}
@Override
@EditableProperty(name = "Color")
public Color getBorderColor() {
return super.getBorderColor();
}
public void setLabelPosition(LabelPosition labelPosition) {
this.labelPosition = labelPosition;
}
@Override
protected Color getLeadColor(ComponentState componentState) {
return componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : LEAD_COLOR;
}
}
@@ -1,21 +0,0 @@
package org.diylc.components;
import org.diylc.core.annotations.EditableProperty;
public abstract class AbstractTransparentComponent<T> extends AbstractComponent<T> {
private static final long serialVersionUID = 1L;
public static byte MAX_ALPHA = 127;
protected byte alpha = MAX_ALPHA;
@EditableProperty
public Byte getAlpha() {
return alpha;
}
public void setAlpha(Byte alpha) {
this.alpha = alpha;
}
}
@@ -1,13 +0,0 @@
package org.diylc.core;
/**
* Validator that allows all values.
*
* @author Branislav Stojkovic
*/
public class AllowAllValidator implements IPropertyValidator {
@Override
public void validate(Object value) throws ValidationException {
}
}
@@ -1,11 +0,0 @@
package org.diylc.core;
/**
* Enumerates all possible states that a component can be in.
*
* @author Branislav Stojkovic
*/
public enum ComponentState {
NORMAL, SELECTED, LOCKED, DRAGGING
}
@@ -1,6 +0,0 @@
package org.diylc.core;
public enum CreationMethod {
SINGLE_CLICK, POINT_BY_POINT;
}
@@ -1,8 +0,0 @@
package org.diylc.core;
public enum ExpansionMode {
ALL,
SAME_TYPE,
IMMEDIATE,
}
@@ -1,130 +0,0 @@
package org.diylc.core;
import java.awt.Graphics2D;
import java.awt.Point;
import java.io.Serializable;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
/**
* Interface for component instance. Implementation classes of this interface
* will be instantiated by the application when component is added to the
* canvas. <br>
* <br>
* <b>Implementing classes should meet the following: </b>
* <ul>
* <li>Must have an empty constructor.</li>
* <li>Class should be annotated with {@link ComponentDescriptor}.</li>
* <li>Getters for properties editable by users should be annotated with
* {@link EditableProperty}.</li>
* <li>Component configuration should be stored int <code>public static</code>
* fields so they can be set through config file.</li>
* </ul>
*
* @author Branislav Stojkovic
*
* @param <T>
* type of component values, e.g. Resistance for resistors or String
* for transistors.
*/
public interface IDIYComponent<T> extends Serializable {
public static final int CHASSIS = 1;
public static final int BOARD = 2;
public static final int TRACE = 3;
public static final int COMPONENT = 4;
public static final int TEXT = 5;
/**
* @return component instance name.
*/
String getName();
/**
* Updates component instance name.
*
* @param name
*/
void setName(String name);
/**
* @return component value.
*/
T getValue();
/**
* Updates component value.
*
* @param value
*/
void setValue(T value);
/**
* @return number of control points for this component instance. May vary
* between two instances of the same type, e.g. DIL IC with 8 and 16
* pins will have 8 or 16 pins although they are of the same type.
*/
int getControlPointCount();
/**
* @param index
* @return control point at the specified index.
*/
Point getControlPoint(int index);
/**
* Updates the control point at the specified index.
*
* @param point
* @param index
*/
void setControlPoint(Point point, int index);
/**
* @param index
* @return true, if the specified control point may stick to control points
* of other components.
*/
boolean isControlPointSticky(int index);
/**
* @param index
* @return true, if the specified control point may overlap with other
* control points <b>of the same component</b>. The other control
* point must be able to overlap too.
*/
boolean canControlPointOverlap(int index);
VisibilityPolicy getControlPointVisibilityPolicy(int index);
/**
* Draws the component onto the {@link Graphics2D}.
*
* @param g2d
* @param componentState
* @param outlineMode
* @param project
* @param drawingObserver
*/
void draw(Graphics2D g2d, ComponentState componentState,
boolean outlineMode, Project project,
IDrawingObserver drawingObserver);
/**
* Draws icon representation of the component. This should not depend on
* component state, i.e. it should be treated as a static method.
*
* @param g2d
* @param width
* @param height
*/
void drawIcon(Graphics2D g2d, int width, int height);
/**
* Clones the component.
*
* @return
*/
IDIYComponent<T> clone() throws CloneNotSupportedException;
}
@@ -1,15 +0,0 @@
package org.diylc.core;
/**
* Interface for tracking component drawing process. Components may use it to
* stop or restart tracking. Anything drawn while tracking is stopped will not
* be added to the mouse hot-spot area.
*
* @author Branislav Stojkovic
*/
public interface IDrawingObserver {
void stopTracking();
void startTracking();
}
@@ -1,16 +0,0 @@
package org.diylc.core;
/**
* Interface for validating property value changes.
*
* @author Branislav Stojkovic
*/
public interface IPropertyValidator {
/**
* @param value
* @throws ValidationException
* if validation fails. Message will contain the reason.
*/
void validate(Object value) throws ValidationException;
}
-41
View File
@@ -1,41 +0,0 @@
package org.diylc.core;
import java.io.File;
import java.util.List;
import java.util.Set;
import org.diylc.common.PropertyWrapper;
/**
* Base interface for the main GUI component.
*
* @author Branislav Stojkovic
*/
public interface IView {
public static final int ERROR_MESSAGE = 0;
public static final int INFORMATION_MESSAGE = 1;
public static final int WARNING_MESSAGE = 2;
public static final int QUESTION_MESSAGE = 3;
public static final int PLAIN_MESSAGE = -1;
public static final int DEFAULT_OPTION = -1;
public static final int YES_NO_OPTION = 0;
public static final int YES_NO_CANCEL_OPTION = 1;
public static final int OK_CANCEL_OPTION = 2;
public static final int YES_OPTION = 0;
public static final int NO_OPTION = 1;
public static final int CANCEL_OPTION = 2;
public static final int OK_OPTION = 0;
public static final String CHECK_BOX_MENU_ITEM = "org.diylc.checkBoxMenuItem";
public static final String RADIO_BUTTON_GROUP_KEY = "org.diylc.radioButtonGroup";
void showMessage(String message, String title, int messageType);
int showConfirmDialog(String message, String title, int optionType, int messageType);
boolean editProperties(List<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties);
File promptFileSave();
}
-248
View File
@@ -1,248 +0,0 @@
package org.diylc.core;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.diylc.appframework.update.VersionNumber;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.annotations.PositiveMeasureValidator;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
/**
* Entity class that defines a project. Contains project properties and a
* collection of components.This class is serialized to file. Some filed getters
* are tagged with {@link EditableProperty} to enable for user to edit them.
*
* @author Branislav Stojkovic
*/
public class Project implements Serializable {
private static final long serialVersionUID = 1L;
public static String DEFAULT_TITLE = "New Project";
public static Size DEFAULT_WIDTH = new Size(29d, SizeUnit.cm);
public static Size DEFAULT_HEIGHT = new Size(21d, SizeUnit.cm);
public static Size DEFAULT_GRID_SPACING = new Size(0.1d, SizeUnit.in);
private VersionNumber fileVersion;
private String title;
private String author;
private String description;
private Size width;
private Size height;
private Size gridSpacing;
private List<IDIYComponent<?>> components;
private Set<Set<IDIYComponent<?>>> groups;
private Set<Integer> lockedLayers;
public Project() {
components = new ArrayList<IDIYComponent<?>>();
groups = new HashSet<Set<IDIYComponent<?>>>();
lockedLayers = new HashSet<Integer>();
title = DEFAULT_TITLE;
author = System.getProperty("user.name");
width = DEFAULT_WIDTH;
height = DEFAULT_HEIGHT;
gridSpacing = DEFAULT_GRID_SPACING;
}
@EditableProperty(defaultable = false)
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@EditableProperty
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
@EditableProperty(defaultable = false)
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@EditableProperty
public Size getWidth() {
return width;
}
public void setWidth(Size width) {
this.width = width;
}
@EditableProperty
public Size getHeight() {
return height;
}
public void setHeight(Size height) {
this.height = height;
}
@EditableProperty(name = "Grid spacing", validatorClass = SpacingValidator.class)
public Size getGridSpacing() {
return gridSpacing;
}
public void setGridSpacing(Size gridSpacing) {
this.gridSpacing = gridSpacing;
}
/**
* List of components sorted by z-order ascending.
*
* @return
*/
public List<IDIYComponent<?>> getComponents() {
return components;
}
/**
* Set of grouped components.
*
* @return
*/
public Set<Set<IDIYComponent<?>>> getGroups() {
return groups;
}
public Set<Integer> getLockedLayers() {
return lockedLayers;
}
public VersionNumber getFileVersion() {
return fileVersion;
}
public void setFileVersion(VersionNumber fileVersion) {
this.fileVersion = fileVersion;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((author == null) ? 0 : author.hashCode());
result = prime * result + ((components == null) ? 0 : components.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((height == null) ? 0 : height.hashCode());
result = prime * result + ((title == null) ? 0 : title.hashCode());
result = prime * result + ((width == null) ? 0 : width.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Project other = (Project) obj;
if (author == null) {
if (other.author != null)
return false;
} else if (!author.equals(other.author))
return false;
if (components == null) {
if (other.components != null)
return false;
} else if (!components.equals(other.components))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (height == null) {
if (other.height != null)
return false;
} else if (!height.equals(other.height))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
if (width == null) {
if (other.width != null)
return false;
} else if (!width.equals(other.width))
return false;
return true;
}
@Override
public String toString() {
return title;
}
public static class SpacingValidator extends PositiveMeasureValidator {
@Override
public void validate(Object value) throws ValidationException {
super.validate(value);
Size size = (Size) value;
if (size.compareTo(new Size(0.5d, SizeUnit.mm)) < 0) {
throw new ValidationException("must be at least 0.5mm");
}
if (size.compareTo(new Size(1d, SizeUnit.in)) > 0) {
throw new ValidationException("must be less than 1in");
}
}
}
@Override
public Project clone() {
Project project = new Project();
project.setTitle(this.getTitle());
project.setAuthor(this.getAuthor());
project.setDescription(this.getDescription());
project.setFileVersion(this.getFileVersion());
project.setGridSpacing(this.getGridSpacing());
project.setHeight(this.getHeight());
project.setWidth(this.getWidth());
project.getLockedLayers().addAll(this.getLockedLayers());
Map<IDIYComponent<?>, IDIYComponent<?>> cloneMap = new HashMap<IDIYComponent<?>, IDIYComponent<?>>();
for (IDIYComponent<?> component : this.components) {
try {
IDIYComponent<?> clone = component.clone();
project.getComponents().add(clone);
cloneMap.put(component, clone);
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
for (Set<IDIYComponent<?>> group : this.groups) {
Set<IDIYComponent<?>> cloneGroup = new HashSet<IDIYComponent<?>>();
for (IDIYComponent<?> component : group) {
cloneGroup.add(cloneMap.get(component));
}
project.groups.add(cloneGroup);
}
return project;
}
}
-86
View File
@@ -1,86 +0,0 @@
package org.diylc.core;
import java.awt.Color;
import java.io.Serializable;
public class Theme implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
private Color bgColor;
private Color gridColor;
private Color outlineColor;
public Theme(String name, Color bgColor, Color gridColor, Color outlineColor) {
super();
this.name = name;
this.bgColor = bgColor;
this.gridColor = gridColor;
this.outlineColor = outlineColor;
}
public String getName() {
return name;
}
public Color getBgColor() {
return bgColor;
}
public Color getGridColor() {
return gridColor;
}
public Color getOutlineColor() {
return outlineColor;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((bgColor == null) ? 0 : bgColor.hashCode());
result = prime * result + ((gridColor == null) ? 0 : gridColor.hashCode());
result = prime * result + ((outlineColor == null) ? 0 : outlineColor.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Theme other = (Theme) obj;
if (bgColor == null) {
if (other.bgColor != null)
return false;
} else if (!bgColor.equals(other.bgColor))
return false;
if (gridColor == null) {
if (other.gridColor != null)
return false;
} else if (!gridColor.equals(other.gridColor))
return false;
if (outlineColor == null) {
if (other.outlineColor != null)
return false;
} else if (!outlineColor.equals(other.outlineColor))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
@Override
public String toString() {
return name;
}
}
@@ -1,11 +0,0 @@
package org.diylc.core;
public class ValidationException extends Exception {
private static final long serialVersionUID = 1L;
public ValidationException(String message) {
super(message);
}
}
@@ -1,22 +0,0 @@
package org.diylc.core;
/**
* Enumerates control point visibility policies.
*
* @author Branislav Stojkovic
*/
public enum VisibilityPolicy {
/**
* Control point should be rendered all the time.
*/
ALWAYS,
/**
* Control point should be rendered only when the component is selected.
*/
WHEN_SELECTED,
/**
* Control point should not be rendered regardless of component selection.
*/
NEVER;
}
@@ -1,7 +0,0 @@
package org.diylc.core.annotations;
public enum BomPolicy {
SHOW_ALL_NAMES,
SHOW_ONLY_TYPE_NAME,
NEVER_SHOW,
}
@@ -1,74 +0,0 @@
package org.diylc.core.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
/**
* Annotation for {@link IDIYComponent} implementation. Describes component
* properties.
*
* @author Branislav Stojkovic
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface ComponentDescriptor {
/**
* @return component type name.
*/
String name();
/**
* @return component type description.
*/
String description();
/**
* @return method that should be used to create a component. If
* <code>CreationMethod.POINT_BY_POINT</code> is used, user will
* have to select ending points before the component is created.
*/
CreationMethod creationMethod() default CreationMethod.SINGLE_CLICK;
/**
* @return component category, e.g. "Passive", "Semiconductors", etc.
*/
String category();
/**
* @return component author name.
*/
String author();
/**
* @return prefix that will be used to generate component instance names,
* e.g. "R" for resistors or "Q" for transistors.
*/
String instanceNamePrefix();
/**
* @return Z-order of the component.
*/
double zOrder();
/**
* @return true if the component may go beyond it's predefined layer. In
* that case, <code>zOrder</code> is used as initial z order of the
* component.
*/
boolean flexibleZOrder() default false;
/**
* @return when false, moving one control point will cause all the others to
* move together with it.
*/
boolean stretchable() default true;
/**
* @return controls what should be shown the BOM
*/
BomPolicy bomPolicy() default BomPolicy.SHOW_ALL_NAMES;
}
@@ -1,42 +0,0 @@
package org.diylc.core.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.diylc.core.AllowAllValidator;
import org.diylc.core.IPropertyValidator;
/**
* Used to annotate editable component property. Editable property XYZ must have
* both getter and setter named <code>getXYZ</code> and <code>setXYZ</code>
* respectively and this annotation must be placed on the getter method.
*
* @author Branislav Stojkovic
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface EditableProperty {
/**
* Returns property name. If left blank property name will be extracted from
* the getter name, e.g. getter <code>getXYZ</code> will induce property
* name <code>XYZ</code>. <br>
* Default value is blank.
*
* @return
*/
String name() default "";
/**
* If true, application may set default value for this property. <br>
* Default value is true.
*
* @return
*/
boolean defaultable() default true;
/**
* Class of validator to use to
* @return
*/
Class<? extends IPropertyValidator> validatorClass() default AllowAllValidator.class;
}
@@ -1,20 +0,0 @@
package org.diylc.core.annotations;
import org.diylc.core.IPropertyValidator;
import org.diylc.core.ValidationException;
import org.diylc.core.measures.AbstractMeasure;
public class PositiveMeasureValidator implements IPropertyValidator {
@Override
public void validate(Object value) throws ValidationException {
if (value instanceof AbstractMeasure) {
AbstractMeasure measure = (AbstractMeasure) value;
if (measure.getValue() < 0) {
throw new ValidationException("must be greater than zero.");
}
} else {
throw new ValidationException("wrong data type, measure expected.");
}
}
}
@@ -1,88 +0,0 @@
package org.diylc.core.measures;
import java.io.Serializable;
import java.text.DecimalFormat;
import java.text.Format;
/***
* Immutable measure class.
*
* @author bancika
*
* @param <T>
*/
public class AbstractMeasure<T extends Enum<? extends Unit>> implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
protected static final Format format = new DecimalFormat("0.####");
protected Double value;
protected T unit;
// public AbstractMeasure() {
// }
public AbstractMeasure(Double value, T unit) {
super();
this.value = value;
this.unit = unit;
}
public Double getValue() {
return value;
}
// public void setValue(Double value) {
// this.value = value;
// }
public T getUnit() {
return unit;
}
// public void setUnit(T multiplier) {
// this.unit = multiplier;
// }
// @Override
// public Object clone() throws CloneNotSupportedException {
// return super.clone();
// }
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((unit == null) ? 0 : unit.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AbstractMeasure<?> other = (AbstractMeasure<?>) obj;
if (unit == null) {
if (other.unit != null)
return false;
} else if (!unit.equals(other.unit))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
@Override
public String toString() {
return format.format(value) + unit;
}
}
@@ -1,31 +0,0 @@
package org.diylc.core.measures;
public class Capacitance extends AbstractMeasure<CapacitanceUnit> {
private static final long serialVersionUID = 1L;
// public Capacitance() {
// super();
// // TODO Auto-generated constructor stub
// }
public Capacitance(Double value, CapacitanceUnit unit) {
super(value, unit);
// TODO Auto-generated constructor stub
}
@Override
public Capacitance clone() throws CloneNotSupportedException {
return new Capacitance(value, unit);
}
public static Capacitance parseCapacitance(String value) {
for (CapacitanceUnit unit : CapacitanceUnit.values()) {
if (value.toLowerCase().endsWith(unit.toString().toLowerCase())) {
value = value.substring(0, value.length() - unit.toString().length() - 1).trim();
return new Capacitance(Double.parseDouble(value), unit);
}
}
throw new IllegalArgumentException("Could not parse capacitance: " + value);
}
}
@@ -1,24 +0,0 @@
package org.diylc.core.measures;
public enum CapacitanceUnit implements Unit {
pF(1, "pF"), nF(1e3, "nF"), uF(1e6, "uF"), mF(1e9, "mF"), F(1e12, "F");
double factor;
String display;
private CapacitanceUnit(double factor, String display) {
this.factor = factor;
this.display = display;
}
@Override
public double getFactor() {
return factor;
}
@Override
public String toString() {
return display;
}
}
@@ -1,31 +0,0 @@
package org.diylc.core.measures;
public class Inductance extends AbstractMeasure<InductanceUnit> {
private static final long serialVersionUID = 1L;
// public Inductance() {
// super();
// // TODO Auto-generated constructor stub
// }
public Inductance(Double value, InductanceUnit unit) {
super(value, unit);
// TODO Auto-generated constructor stub
}
@Override
public Inductance clone() throws CloneNotSupportedException {
return new Inductance(value, unit);
}
public static Inductance parseCapacitance(String value) {
for (InductanceUnit unit : InductanceUnit.values()) {
if (value.toLowerCase().endsWith(unit.toString().toLowerCase())) {
value = value.substring(0, value.length() - unit.toString().length() - 1).trim();
return new Inductance(Double.parseDouble(value), unit);
}
}
throw new IllegalArgumentException("Could not parse inductance: " + value);
}
}
@@ -1,24 +0,0 @@
package org.diylc.core.measures;
public enum InductanceUnit implements Unit {
pH(1, "pH"), nH(1e3, "nH"), uH(1e6, "\u03bcH"), mH(1e9, "mH"), H(1e12, "H");
double factor;
String display;
private InductanceUnit(double factor, String display) {
this.factor = factor;
this.display = display;
}
@Override
public double getFactor() {
return factor;
}
@Override
public String toString() {
return display;
}
}
@@ -1,31 +0,0 @@
package org.diylc.core.measures;
public class Power extends AbstractMeasure<PowerUnit> {
private static final long serialVersionUID = 1L;
// public Power() {
// super();
// // TODO Auto-generated constructor stub
// }
public Power(Double value, PowerUnit unit) {
super(value, unit);
// TODO Auto-generated constructor stub
}
@Override
public Power clone() throws CloneNotSupportedException {
return new Power(value, unit);
}
public static Power parseCapacitance(String value) {
for (PowerUnit unit : PowerUnit.values()) {
if (value.toLowerCase().endsWith(unit.toString().toLowerCase())) {
value = value.substring(0, value.length() - unit.toString().length() - 1).trim();
return new Power(Double.parseDouble(value), unit);
}
}
throw new IllegalArgumentException("Could not parse power: " + value);
}
}
@@ -1,24 +0,0 @@
package org.diylc.core.measures;
public enum PowerUnit implements Unit {
MW(1e-1, "mW"), W(1, "W"), KW(1e3, "KW");
double factor;
String display;
private PowerUnit(double factor, String display) {
this.factor = factor;
this.display = display;
}
@Override
public double getFactor() {
return factor;
}
@Override
public String toString() {
return display;
}
}
@@ -1,98 +0,0 @@
package org.diylc.core.measures;
import java.awt.Color;
import org.diylc.common.ResistorColorCode;
public class Resistance extends AbstractMeasure<ResistanceUnit> {
private static final long serialVersionUID = 1L;
private static final Color[] COLOR_DIGITS = new Color[] { Color.black, Color.decode("#8B4513"),
Color.red, Color.orange, Color.yellow, Color.decode("#76EE00"), Color.blue,
Color.decode("#91219E"), Color.lightGray, Color.white };
private static final Color[] COLOR_MULTIPLIER = new Color[] { Color.lightGray.brighter(),
Color.decode("#FFB90F"), Color.black, Color.decode("#8B4513"), Color.red, Color.orange,
Color.yellow, Color.decode("#76EE00"), Color.blue };
// public Resistance() {
// super();
// // TODO Auto-generated constructor stub
// }
public Resistance(Double value, ResistanceUnit multiplier) {
super(value, multiplier);
// TODO Auto-generated constructor stub
}
@Override
public Resistance clone() throws CloneNotSupportedException {
return new Resistance(value, unit);
}
public Color[] getColorCode(ResistorColorCode resistorColorCode) {
Color[] bands;
if (getValue() == 0) {
switch (resistorColorCode) {
case _4_BAND:
bands = new Color[3];
bands[0] = COLOR_DIGITS[0];
bands[1] = COLOR_DIGITS[0];
bands[2] = COLOR_MULTIPLIER[2];
break;
case _5_BAND:
bands = new Color[4];
bands[0] = COLOR_DIGITS[0];
bands[1] = COLOR_DIGITS[0];
bands[2] = COLOR_DIGITS[0];
bands[3] = COLOR_MULTIPLIER[2];
break;
default:
bands = new Color[] {};
}
} else {
double base = getValue() * getUnit().getFactor();
int multiplier = 0;
while (base > (resistorColorCode == ResistorColorCode._4_BAND ? 99 : 999)) {
multiplier += 1;
base /= 10;
}
while (base < (resistorColorCode == ResistorColorCode._4_BAND ? 10 : 100)) {
multiplier -= 1;
base *= 10;
}
if (multiplier > 6 || multiplier < -2) {
// Out of range.
return new Color[] {};
}
switch (resistorColorCode) {
case _4_BAND:
bands = new Color[3];
bands[0] = COLOR_DIGITS[(int) (base / 10)];
bands[1] = COLOR_DIGITS[(int) (base % 10)];
bands[2] = COLOR_MULTIPLIER[multiplier + 2];
break;
case _5_BAND:
bands = new Color[4];
bands[0] = COLOR_DIGITS[(int) (base / 100)];
bands[1] = COLOR_DIGITS[(int) (base / 10 % 10)];
bands[2] = COLOR_DIGITS[(int) (base % 10)];
bands[3] = COLOR_MULTIPLIER[multiplier + 2];
break;
default:
bands = new Color[] {};
}
}
return bands;
}
public static Resistance parseResistance(String value) {
for (ResistanceUnit unit : ResistanceUnit.values()) {
if (value.toLowerCase().endsWith(unit.toString().toLowerCase())) {
value = value.substring(0, value.length() - unit.toString().length()).trim();
return new Resistance(Double.parseDouble(value), unit);
}
}
throw new IllegalArgumentException("Could not parse resistance: " + value);
}
}
@@ -1,24 +0,0 @@
package org.diylc.core.measures;
public enum ResistanceUnit implements Unit {
R(1, "\u2126"), K(1e3, "K"), M(1e6, "M");
double factor;
String display;
private ResistanceUnit(double factor, String display) {
this.factor = factor;
this.display = display;
}
@Override
public double getFactor() {
return factor;
}
@Override
public String toString() {
return display;
}
}
@@ -1,47 +0,0 @@
package org.diylc.core.measures;
import org.diylc.utils.Constants;
public class Size extends AbstractMeasure<SizeUnit> implements Comparable<Size> {
private static final long serialVersionUID = 1L;
// public Size() {
// super();
// // TODO Auto-generated constructor stub
// }
public Size(Double value, SizeUnit unit) {
super(value, unit);
// TODO Auto-generated constructor stub
}
public double convertToPixels() {
// double factor = getUnit().getFactor() / SizeUnit.in.getFactor();
// int grids = (int) (factor * getValue() * Constants.GRIDS_PER_INCH);
// double remainder = (factor * getValue() * Constants.GRIDS_PER_INCH) - grids;
// return (int) Math.round(Constants.PIXELS_PER_INCH / Constants.GRIDS_PER_INCH
// * (grids + remainder));
return getValue() * getUnit().getFactor() / SizeUnit.in.getFactor() * Constants.PIXELS_PER_INCH;
}
@Override
public Size clone() throws CloneNotSupportedException {
return new Size(value, unit);
}
public static Size parseSize(String value) {
for (SizeUnit unit : SizeUnit.values()) {
if (value.toLowerCase().endsWith(unit.toString().toLowerCase())) {
value = value.substring(0, value.length() - unit.toString().length() - 1).trim();
return new Size(Double.parseDouble(value), unit);
}
}
throw new IllegalArgumentException("Could not parse size: " + value);
}
@Override
public int compareTo(Size o) {
return new Double(value * unit.getFactor()).compareTo(o.getValue() * o.getUnit().getFactor());
}
}
@@ -1,17 +0,0 @@
package org.diylc.core.measures;
public enum SizeUnit implements Unit {
mm(1d), cm(10d), m(1e4d), in(25.4d), ft(25.4d * 12), yd(9144d);
double factor;
private SizeUnit(double factor) {
this.factor = factor;
}
@Override
public double getFactor() {
return factor;
}
}
@@ -1,6 +0,0 @@
package org.diylc.core.measures;
public interface Unit {
double getFactor();
}
@@ -1,31 +0,0 @@
package org.diylc.core.measures;
public class Voltage extends AbstractMeasure<VoltageUnit> {
private static final long serialVersionUID = 1L;
// public Voltage() {
// super();
// // TODO Auto-generated constructor stub
// }
public Voltage(Double value, VoltageUnit unit) {
super(value, unit);
// TODO Auto-generated constructor stub
}
@Override
public Voltage clone() throws CloneNotSupportedException {
return new Voltage(value, unit);
}
public static Voltage parseCapacitance(String value) {
for (VoltageUnit unit : VoltageUnit.values()) {
if (value.toLowerCase().endsWith(unit.toString().toLowerCase())) {
value = value.substring(0, value.length() - unit.toString().length() - 1).trim();
return new Voltage(Double.parseDouble(value), unit);
}
}
throw new IllegalArgumentException("Could not parse voltage: " + value);
}
}
@@ -1,24 +0,0 @@
package org.diylc.core.measures;
public enum VoltageUnit implements Unit {
MV(1e-1, "mV"), V(1, "V"), KV(1e3, "KV");
double factor;
String display;
private VoltageUnit(double factor, String display) {
this.factor = factor;
this.display = display;
}
@Override
public double getFactor() {
return factor;
}
@Override
public String toString() {
return display;
}
}
@@ -1,61 +0,0 @@
package org.diylc.images;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.ImageIcon;
/**
* Loads image resources as Icons.
*
* @author Branislav Stojkovic
*/
public enum IconLoader {
Delete("delete.png"), Add("add.png"), FolderOut("folder_out.png"), Garbage("garbage.png"), DiskBlue(
"disk_blue.png"), SaveAs("save_as.png"), Exit("exit.png"), DocumentPlainYellow(
"document_plain_yellow.png"), PhotoScenery("photo_scenery.png"), LightBulbOn(
"lightbulb_on.png"), LightBulbOff("lightbulb_off.png"), NotebookAdd("notebook_add.png"), FormGreen(
"form_green.png"), Gears("gears.png"), About("about.png"), WindowColors(
"window_colors.png"), WindowGear("window_gear.png"), NavigateCheck("navigate_check.png"), Undo(
"undo.png"), Error("error.png"), Warning("warning.png"), ZoomSmall("zoom_small.png"), MoveSmall(
"move_small.png"), Print("print.png"), PDF("pdf.png"), Excel("excel.png"), CSV(
"csv.png"), HTML("html.png"), Image("image.png"), Cut("cut.png"), Copy("copy.png"), Paste(
"paste.png"), Selection("selection.png"), BOM("bom.png"), BlackBoard("blackboard.png"), IdCard(
"id_card.png"), IdCardAdd("id_card_add.png"), Chest("chest.png"), Upload("upload.png"), Wrench(
"wrench.png"), Group("group.png"), Ungroup("ungroup.png"), TraceMask("trace_mask.png"), Faq(
"faq.png"), Component("component.png"), Plugin("plugin.png"), Manual("manual.png"), Donate(
"donate.png"), Bug("bug.png"), IconLarge("icon_large.png"), IconMedium(
"icon_medium.png"), IconSmall("icon_small.png"), DocumentEdit("document_edit.png"), EditComponent(
"edit_component.png"), Size("size.png"), Front("front.png"), Back("back.png"), Pens(
"pens.png"), Sort("sort.png"), ElementsSelection("elements_selection.png");
protected String name;
private IconLoader(String name) {
this.name = name;
}
public Icon getIcon() {
java.net.URL imgURL = getClass().getResource(name);
if (imgURL != null) {
return new ImageIcon(imgURL, name);
} else {
System.err.println("Couldn't find file: " + name);
return null;
}
}
public Image getImage() {
BufferedImage img = null;
try {
img = ImageIO.read(getClass().getResourceAsStream(name));
} catch (IOException e) {
System.err.println("Couldn't find file: " + name);
}
return img;
}
}
@@ -1,25 +0,0 @@
package org.diylc.presenter;
import java.awt.Point;
import org.diylc.core.measures.Size;
public class CalcUtils {
/**
* Rounds the number to the closest grid line.
*
* @param x
* @return
*/
public static int roundToGrid(int x, Size gridSpacing) {
double grid = gridSpacing.convertToPixels();
return (int) (Math.round(1f * x / grid) * grid);
}
public static void snapPointToGrid(Point point, Size gridSpacing) {
int x = roundToGrid(point.x, gridSpacing);
int y = roundToGrid(point.y, gridSpacing);
point.setLocation(x, y);
}
}
@@ -1,88 +0,0 @@
package org.diylc.presenter;
import java.util.Comparator;
import org.diylc.common.ComponentType;
import org.diylc.common.PropertyWrapper;
import org.diylc.core.IDIYComponent;
public class ComparatorFactory {
private static ComparatorFactory instance;
private Comparator<IDIYComponent<?>> componentNameComparator;
private Comparator<ComponentType> componentTypeComparator;
private Comparator<PropertyWrapper> propertyNameComparator;
private Comparator<IDIYComponent<?>> componentZOrderComparator;
public static ComparatorFactory getInstance() {
if (instance == null) {
instance = new ComparatorFactory();
}
return instance;
}
public Comparator<IDIYComponent<?>> getComponentNameComparator() {
if (componentNameComparator == null) {
componentNameComparator = new Comparator<IDIYComponent<?>>() {
@Override
public int compare(IDIYComponent<?> o1, IDIYComponent<?> o2) {
String name1 = o1.getName();
String name2 = o2.getName();
if (name1 == null || name2 == null) {
return 0;
}
return name1.compareToIgnoreCase(name2);
}
};
}
return componentNameComparator;
}
public Comparator<ComponentType> getComponentTypeComparator() {
if (componentTypeComparator == null) {
componentTypeComparator = new Comparator<ComponentType>() {
@Override
public int compare(ComponentType o1, ComponentType o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
};
}
return componentTypeComparator;
}
public Comparator<PropertyWrapper> getPropertyNameComparator() {
if (propertyNameComparator == null) {
propertyNameComparator = new Comparator<PropertyWrapper>() {
@Override
public int compare(PropertyWrapper o1, PropertyWrapper o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
};
}
return propertyNameComparator;
}
public Comparator<IDIYComponent<?>> getComponentZOrderComparator() {
if (componentZOrderComparator == null) {
componentZOrderComparator = new Comparator<IDIYComponent<?>>() {
@Override
public int compare(IDIYComponent<?> o1, IDIYComponent<?> o2) {
ComponentType type1 = ComponentProcessor.getInstance()
.extractComponentTypeFrom(
(Class<? extends IDIYComponent<?>>) o1.getClass());
ComponentType type2 = ComponentProcessor.getInstance()
.extractComponentTypeFrom(
(Class<? extends IDIYComponent<?>>) o2.getClass());
return new Double(type1.getZOrder()).compareTo(type2.getZOrder());
}
};
}
return componentZOrderComparator;
}
}
@@ -1,253 +0,0 @@
package org.diylc.presenter;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import org.apache.log4j.Logger;
import org.diylc.common.ComponentType;
import org.diylc.common.PropertyWrapper;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IPropertyValidator;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
/**
* Utility class with component processing methods.
*
* @author Branislav Stojkovic
*/
public class ComponentProcessor {
private static final Logger LOG = Logger
.getLogger(ComponentProcessor.class);
private static ComponentProcessor instance;
private Map<String, List<PropertyWrapper>> propertyCache;
private Map<String, IPropertyValidator> propertyValidatorCache;
private Map<String, ComponentType> componentTypeMap;
public static ComponentProcessor getInstance() {
if (instance == null) {
instance = new ComponentProcessor();
}
return instance;
}
private ComponentProcessor() {
super();
this.propertyCache = new HashMap<String, List<PropertyWrapper>>();
this.componentTypeMap = new HashMap<String, ComponentType>();
this.propertyValidatorCache = new HashMap<String, IPropertyValidator>();
}
public ComponentType extractComponentTypeFrom(
Class<? extends IDIYComponent<?>> clazz) {
if (componentTypeMap.containsKey(clazz.getName())) {
return componentTypeMap.get(clazz.getName());
}
String name;
String description;
CreationMethod creationMethod;
String category;
String namePrefix;
String author;
Icon icon;
double zOrder;
boolean flexibleZOrder;
boolean stretchable;
BomPolicy bomPolicy;
if (clazz.isAnnotationPresent(ComponentDescriptor.class)) {
ComponentDescriptor annotation = clazz
.getAnnotation(ComponentDescriptor.class);
name = annotation.name();
description = annotation.description();
creationMethod = annotation.creationMethod();
category = annotation.category();
namePrefix = annotation.instanceNamePrefix();
author = annotation.author();
zOrder = annotation.zOrder();
flexibleZOrder = annotation.flexibleZOrder();
stretchable = annotation.stretchable();
bomPolicy = annotation.bomPolicy();
} else {
name = clazz.getSimpleName();
description = "";
creationMethod = CreationMethod.SINGLE_CLICK;
category = "Uncategorized";
namePrefix = "Unknown";
author = "Unknown";
zOrder = IDIYComponent.COMPONENT;
flexibleZOrder = false;
stretchable = true;
bomPolicy = BomPolicy.SHOW_ALL_NAMES;
}
icon = null;
// Draw component icon.
try {
IDIYComponent<?> componentInstance = (IDIYComponent<?>) clazz
.newInstance();
Image image = new BufferedImage(Presenter.ICON_SIZE,
Presenter.ICON_SIZE,
java.awt.image.BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) image.getGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
componentInstance.drawIcon(g2d, Presenter.ICON_SIZE,
Presenter.ICON_SIZE);
icon = new ImageIcon(image);
} catch (Exception e) {
throw new RuntimeException(e);
}
ComponentType componentType = new ComponentType(name, description,
creationMethod, category, namePrefix, author, icon, clazz,
zOrder, flexibleZOrder, stretchable, bomPolicy);
componentTypeMap.put(clazz.getName(), componentType);
return componentType;
}
/**
* Extracts all editable properties from the component class.
*
* @param clazz
* @return
*/
public List<PropertyWrapper> extractProperties(Class<?> clazz) {
if (propertyCache.containsKey(clazz.getName())) {
return cloneProperties(propertyCache.get(clazz.getName()));
}
List<PropertyWrapper> properties = new ArrayList<PropertyWrapper>();
for (Method method : clazz.getMethods()) {
if (method.getName().startsWith("get")) {
try {
if (method.isAnnotationPresent(EditableProperty.class)
&& !method.isAnnotationPresent(Deprecated.class)) {
EditableProperty annotation = method
.getAnnotation(EditableProperty.class);
String name;
if (annotation.name().equals("")) {
name = method.getName().substring(3);
} else {
name = annotation.name();
}
IPropertyValidator validator = getPropertyValidator(annotation
.validatorClass());
Method setter = clazz.getMethod("set"
+ method.getName().substring(3), method
.getReturnType());
PropertyWrapper property = new PropertyWrapper(name,
method.getReturnType(), method.getName(),
setter.getName(), annotation.defaultable(),
validator);
properties.add(property);
}
} catch (NoSuchMethodException e) {
LOG.debug("No matching setter found for \""
+ method.getName() + "\". Skipping...");
}
}
}
propertyCache.put(clazz.getName(), properties);
return cloneProperties(properties);
}
private List<PropertyWrapper> cloneProperties(List<PropertyWrapper> properties) {
List<PropertyWrapper> result = new ArrayList<PropertyWrapper>(properties.size());
for (PropertyWrapper propertyWrapper : properties) {
try {
result.add((PropertyWrapper) propertyWrapper.clone());
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
return result;
}
/**
* Returns properties that have the same value for all the selected
* components.
*
* @param selectedComponents
* @return
*/
public List<PropertyWrapper> getMutualSelectionProperties(
List<IDIYComponent<?>> selectedComponents) throws Exception {
if (selectedComponents.isEmpty()) {
return null;
}
List<PropertyWrapper> properties = new ArrayList<PropertyWrapper>();
IDIYComponent<?> firstComponent = selectedComponents.get(0);
properties.addAll(extractProperties(firstComponent.getClass()));
// Initialize values
for (PropertyWrapper property : properties) {
property.readFrom(firstComponent);
}
for (int i = 1; i < selectedComponents.size(); i++) {
IDIYComponent<?> component = selectedComponents.get(i);
List<PropertyWrapper> newProperties = extractProperties(component
.getClass());
for (PropertyWrapper property : newProperties) {
property.readFrom(component);
}
properties.retainAll(newProperties);
// Try to find matching properties in old and new lists and see if
// their values match.
for (PropertyWrapper oldProperty : properties) {
if (newProperties.contains(oldProperty)) {
PropertyWrapper newProperty = newProperties
.get(newProperties.indexOf(oldProperty));
if ((newProperty.getValue() != null && newProperty
.getValue() == null)
|| !newProperty.getValue().equals(
oldProperty.getValue())) {
// Values don't match, so the property is not unique
// valued.
oldProperty.setUnique(false);
}
}
}
// for (PropertyWrapper property : properties) {
// try {
// property.readUniqueFrom(component);
// } catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
}
Collections.sort(properties, ComparatorFactory.getInstance()
.getPropertyNameComparator());
return properties;
}
private IPropertyValidator getPropertyValidator(
Class<? extends IPropertyValidator> clazz) {
if (propertyValidatorCache.containsKey(clazz.getName())) {
return propertyValidatorCache.get(clazz.getName());
}
IPropertyValidator validator;
try {
validator = clazz.newInstance();
} catch (Exception e) {
LOG.error("Could not instantiate validator for " + clazz.getName(),
e);
return null;
}
propertyValidatorCache.put(clazz.getName(), validator);
return validator;
}
}
@@ -1,23 +0,0 @@
package org.diylc.presenter;
import org.diylc.common.ComponentType;
import org.diylc.common.IComponentFiler;
import org.diylc.core.IDIYComponent;
public class ComponentZOrderFiler implements IComponentFiler {
private int zOrder;
public ComponentZOrderFiler(int zOrder) {
super();
this.zOrder = zOrder;
}
@SuppressWarnings("unchecked")
@Override
public boolean testComponent(IDIYComponent<?> component) {
ComponentType componentType = ComponentProcessor.getInstance().extractComponentTypeFrom(
(Class<? extends IDIYComponent<?>>) component.getClass());
return Math.round(componentType.getZOrder()) == zOrder;
}
}
@@ -1,398 +0,0 @@
package org.diylc.presenter;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.Area;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.ConfigurationManager;
import org.diylc.appframework.simplemq.MessageDispatcher;
import org.diylc.common.DrawOption;
import org.diylc.common.EventType;
import org.diylc.common.GridType;
import org.diylc.common.IComponentFiler;
import org.diylc.common.IPlugInPort;
import org.diylc.common.ObjectCache;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.utils.Constants;
/**
* Utility that deals with painting {@link Project} on the {@link Graphics2D}
* and keeps areas taken by each drawn component.
*
* @author Branislav Stojkovic
*/
public class DrawingManager {
private static final Logger LOG = Logger.getLogger(DrawingManager.class);
public static int CONTROL_POINT_SIZE = 7;
public static final String ZOOM_KEY = "zoom";
public static String DEBUG_COMPONENT_AREAS = "org.diylc.debugComponentAreas";
public static Color CONTROL_POINT_COLOR = Color.blue;
public static Color SELECTED_CONTROL_POINT_COLOR = Color.green;
private Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
// Keeps Area object of each drawn component.
private Map<IDIYComponent<?>, Area> componentAreaMap;
// Maps components to the last state they are drawn in. Also, used to
// determine which components are invalidated when they are not in the map.
private Map<IDIYComponent<?>, ComponentState> lastDrawnStateMap;
private Composite slotComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
private Composite lockedComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
private List<IDIYComponent<?>> failedComponents = new ArrayList<IDIYComponent<?>>();
private double zoomLevel = 1d;// ConfigurationManager.getInstance().readDouble(ZOOM_KEY,
// 1d);
private MessageDispatcher<EventType> messageDispatcher;
private boolean debugComponentAreas;
public DrawingManager(MessageDispatcher<EventType> messageDispatcher) {
super();
this.messageDispatcher = messageDispatcher;
componentAreaMap = new HashMap<IDIYComponent<?>, Area>();
lastDrawnStateMap = new HashMap<IDIYComponent<?>, ComponentState>();
String debugComponentAreasStr = System.getProperty(DEBUG_COMPONENT_AREAS);
debugComponentAreas = debugComponentAreasStr != null
&& debugComponentAreasStr.equalsIgnoreCase("true");
}
/**
* Paints the project onto the canvas and returns the list of components
* that failed to draw.
*
* @param g2d
* @param project
* @param drawOptions
* @param filter
* @param selectionRect
* @param selectedComponents
* @param lockedComponents
* @param groupedComponents
* @param controlPointSlot
* @param componentSlot
* @param dragInProgress
* @return
*/
public List<IDIYComponent<?>> drawProject(Graphics2D g2d, Project project,
Set<DrawOption> drawOptions, IComponentFiler filter, Rectangle selectionRect,
List<IDIYComponent<?>> selectedComponents, Set<IDIYComponent<?>> lockedComponents,
Set<IDIYComponent<?>> groupedComponents, List<Point> controlPointSlot,
IDIYComponent<?> componentSlot, boolean dragInProgress) {
failedComponents.clear();
if (project == null) {
return failedComponents;
}
G2DWrapper g2dWrapper = new G2DWrapper(g2d);
if (drawOptions.contains(DrawOption.ANTIALIASING)) {
g2d
.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
} else {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
}
if (ConfigurationManager.getInstance()
.readBoolean(IPlugInPort.HI_QUALITY_RENDER_KEY, false)) {
g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
} else {
g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_SPEED);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
}
double zoom = 1d;
if (drawOptions.contains(DrawOption.ZOOM)) {
zoom = zoomLevel;
} else {
zoom = 1 / Constants.PIXEL_SIZE;
}
// AffineTransform initialTx = g2d.getTransform();
Dimension d = getCanvasDimensions(project, zoom, true);
g2dWrapper.setColor(theme.getBgColor());
g2dWrapper.fillRect(0, 0, d.width, d.height);
g2d.clip(new Rectangle(new Point(0, 0), d));
GridType gridType = GridType.LINES;
if (drawOptions.contains(DrawOption.GRID) && gridType != GridType.NONE) {
double zoomStep = project.getGridSpacing().convertToPixels() * zoom;
if (gridType == GridType.CROSSHAIR) {
g2d.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER,
10f, new float[] { (float) zoomStep / 2, (float) zoomStep / 2 },
(float) zoomStep / 4));
} else if (gridType == GridType.DOT) {
g2d.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER,
10f, new float[] { 1f, (float) zoomStep - 1 }, 0f));
}
g2dWrapper.setColor(theme.getGridColor());
for (double i = zoomStep; i < d.width; i += zoomStep) {
g2dWrapper.drawLine((int) i, 0, (int) i, d.height - 1);
}
for (double j = zoomStep; j < d.height; j += zoomStep) {
g2dWrapper.drawLine(0, (int) j, d.width - 1, (int) j);
}
}
if (Math.abs(1.0 - zoom) > 1e-4) {
g2dWrapper.scale(zoom, zoom);
}
// Composite mainComposite = g2d.getComposite();
// Composite alphaComposite =
// AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f);
// g2dWrapper.resetTx();
// componentAreaMap.clear();
for (IDIYComponent<?> component : project.getComponents()) {
// Do not draw the component if it's filtered out.
if (filter != null && !filter.testComponent(component)) {
continue;
}
ComponentState state = ComponentState.NORMAL;
if (drawOptions.contains(DrawOption.SELECTION)
&& selectedComponents.contains(component)) {
if (dragInProgress) {
state = ComponentState.DRAGGING;
} else {
state = ComponentState.SELECTED;
}
}
// Do not track the area if component is not invalidated and was
// drawn in the same state.
boolean trackArea = lastDrawnStateMap.get(component) != state;
synchronized (g2d) {
g2dWrapper.startedDrawingComponent();
if (!trackArea) {
g2dWrapper.stopTracking();
}
// Draw locked components in a new composite.
if (lockedComponents.contains(component)) {
g2d.setComposite(lockedComposite);
}
// Draw the component through the g2dWrapper.
try {
component.draw(g2dWrapper, state,
drawOptions.contains(DrawOption.OUTLINE_MODE), project, g2dWrapper);
} catch (Exception e) {
LOG.error("Error drawing " + component.getName(), e);
failedComponents.add(component);
}
Area area = g2dWrapper.finishedDrawingComponent();
if (trackArea && area != null && !area.isEmpty()) {
componentAreaMap.put(component, area);
lastDrawnStateMap.put(component, state);
}
}
}
// Draw control points.
if (drawOptions.contains(DrawOption.CONTROL_POINTS)) {
// Draw unselected points first to make sure they are below.
if (dragInProgress || drawOptions.contains(DrawOption.OUTLINE_MODE)) {
for (IDIYComponent<?> component : project.getComponents()) {
for (int i = 0; i < component.getControlPointCount(); i++) {
VisibilityPolicy visibilityPolicy = component
.getControlPointVisibilityPolicy(i);
if ((groupedComponents.contains(component)
&& (visibilityPolicy == VisibilityPolicy.ALWAYS || (selectedComponents
.contains(component) && visibilityPolicy == VisibilityPolicy.WHEN_SELECTED)) || (!groupedComponents
.contains(component)
&& !selectedComponents.contains(component) && component
.getControlPointVisibilityPolicy(i) == VisibilityPolicy.ALWAYS))) {
g2dWrapper.setColor(CONTROL_POINT_COLOR);
Point controlPoint = component.getControlPoint(i);
int pointSize = CONTROL_POINT_SIZE - 2;
g2dWrapper.fillOval(controlPoint.x - pointSize / 2, controlPoint.y
- pointSize / 2, pointSize, pointSize);
}
}
}
}
// Then draw the selected ones.
for (IDIYComponent<?> component : selectedComponents) {
for (int i = 0; i < component.getControlPointCount(); i++) {
if (!groupedComponents.contains(component)
&& (component.getControlPointVisibilityPolicy(i) == VisibilityPolicy.WHEN_SELECTED || component
.getControlPointVisibilityPolicy(i) == VisibilityPolicy.ALWAYS)) {
Point controlPoint = component.getControlPoint(i);
int pointSize = CONTROL_POINT_SIZE;
g2dWrapper.setColor(SELECTED_CONTROL_POINT_COLOR.darker());
g2dWrapper.fillOval(controlPoint.x - pointSize / 2, controlPoint.y
- pointSize / 2, pointSize, pointSize);
g2dWrapper.setColor(SELECTED_CONTROL_POINT_COLOR);
g2dWrapper.fillOval(controlPoint.x - CONTROL_POINT_SIZE / 2 + 1,
controlPoint.y - CONTROL_POINT_SIZE / 2 + 1,
CONTROL_POINT_SIZE - 2, CONTROL_POINT_SIZE - 2);
}
}
}
}
// Draw component slot in a separate composite.
if (componentSlot != null) {
g2dWrapper.startedDrawingComponent();
g2dWrapper.setComposite(slotComposite);
try {
componentSlot.draw(g2dWrapper, ComponentState.NORMAL, drawOptions
.contains(DrawOption.OUTLINE_MODE), project, g2dWrapper);
} catch (Exception e) {
LOG.error("Error drawing " + componentSlot.getName(), e);
failedComponents.add(componentSlot);
}
g2dWrapper.finishedDrawingComponent();
}
// Draw control points of the component in the slot.
if (controlPointSlot != null) {
for (Point point : controlPointSlot) {
if (point != null) {
g2dWrapper.setColor(SELECTED_CONTROL_POINT_COLOR.darker());
g2dWrapper.fillOval(point.x - CONTROL_POINT_SIZE / 2, point.y
- CONTROL_POINT_SIZE / 2, CONTROL_POINT_SIZE, CONTROL_POINT_SIZE);
g2dWrapper.setColor(SELECTED_CONTROL_POINT_COLOR);
g2dWrapper.fillOval(point.x - CONTROL_POINT_SIZE / 2 + 1, point.y
- CONTROL_POINT_SIZE / 2 + 1, CONTROL_POINT_SIZE - 2,
CONTROL_POINT_SIZE - 2);
}
}
}
// Go back to the original transformation and zoom in to draw the
// selection rectangle and other similar elements.
// g2d.setTransform(initialTx);
// if ((drawOptions.contains(DrawOption.ZOOM)) && (Math.abs(1.0 -
// zoomLevel) > 1e-4)) {
// g2d.scale(zoomLevel, zoomLevel);
// }
// At the end draw selection rectangle if needed.
if (drawOptions.contains(DrawOption.SELECTION) && (selectionRect != null)) {
g2d.setColor(Color.white);
g2d.draw(selectionRect);
g2d.setColor(Color.black);
g2d.setStroke(Constants.DASHED_STROKE);
g2d.draw(selectionRect);
}
// Draw component area for test
if (debugComponentAreas) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.setColor(Color.red);
for (Area area : componentAreaMap.values()) {
g2d.draw(area);
}
}
return failedComponents;
}
public double getZoomLevel() {
return zoomLevel;
}
public void setZoomLevel(double zoomLevel) {
this.zoomLevel = zoomLevel;
fireZoomChanged();
// ConfigurationManager.getInstance().writeValue(ZOOM_KEY, zoomLevel);
}
public void invalidateComponent(IDIYComponent<?> component) {
componentAreaMap.remove(component);
lastDrawnStateMap.remove(component);
}
public Area getComponentArea(IDIYComponent<?> component) {
return componentAreaMap.get(component);
}
public void clearComponentAreaMap() {
componentAreaMap.clear();
}
public List<IDIYComponent<?>> findComponentsAt(Point point, Project project) {
List<IDIYComponent<?>> components = new ArrayList<IDIYComponent<?>>();
for (int i = 0; i < project.getComponents().size(); i++) {
Area area = componentAreaMap.get(project.getComponents().get(i));
if (area != null && area.contains(point)) {
components.add(0, project.getComponents().get(i));
}
}
return components;
}
public Dimension getCanvasDimensions(Project project, Double zoomLevel, boolean useZoom) {
double width = project.getWidth().convertToPixels();
double height = project.getHeight().convertToPixels();
if (useZoom) {
width *= zoomLevel;
height *= zoomLevel;
} else {
width /= Constants.PIXEL_SIZE;
height /= Constants.PIXEL_SIZE;
}
return new Dimension((int) width, (int) height);
}
public void fireZoomChanged() {
messageDispatcher.dispatchMessage(EventType.ZOOM_CHANGED, zoomLevel);
messageDispatcher.dispatchMessage(EventType.REPAINT);
}
public Theme getTheme() {
return theme;
}
public void setTheme(Theme theme) {
this.theme = theme;
ConfigurationManager.getInstance().writeValue(IPlugInPort.THEME_KEY, theme);
messageDispatcher.dispatchMessage(EventType.REPAINT);
}
}
@@ -1,691 +0,0 @@
package org.diylc.presenter;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Paint;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.RenderingHints.Key;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.awt.geom.Area;
import java.awt.geom.CubicCurve2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.awt.geom.QuadCurve2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import java.awt.image.ImageObserver;
import java.awt.image.RenderedImage;
import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
import java.util.Map;
import org.diylc.core.IDrawingObserver;
/**
* {@link Graphics2D} wrapper that keeps track of all drawing actions and
* creates an {@link Area} that corresponds to drawn objects. Before each
* component is drawn, {@link #startedDrawingComponent()} should be called.
* After the component is drawn, area may be retrieved using
* {@link #finishedDrawingComponent()}. Graphics configuration (color, font,
* etc) is reset between each two components.
*
* @author Branislav Stojkovic
*/
class G2DWrapper extends Graphics2D implements IDrawingObserver {
public static int LINE_SENSITIVITY_MARGIN = 2;
public static int CURVE_SENSITIVITY = 6;
private boolean drawingComponent = false;
private boolean trackingAllowed = true;
private Graphics2D canvasGraphics;
private Stroke originalStroke;
private Color originalColor;
private Composite originalComposite;
private AffineTransform originalTx;
private Font originalFont;
private AffineTransform currentTx;
private AffineTransform initialTx;
private Area currentArea;
private Shape lastShape;
/**
* Creates a wrapper around specified {@link Graphics2D} object.
*
* @param canvasGraphics
*/
public G2DWrapper(Graphics2D canvasGraphics) {
super();
this.canvasGraphics = canvasGraphics;
currentArea = new Area();
currentTx = new AffineTransform();
}
/**
* Clears out the current area and caches canvas settings.
*/
public void startedDrawingComponent() {
drawingComponent = true;
currentArea = new Area();
originalStroke = canvasGraphics.getStroke();
originalColor = canvasGraphics.getColor();
originalTx = canvasGraphics.getTransform();
originalComposite = canvasGraphics.getComposite();
originalFont = canvasGraphics.getFont();
currentTx = new AffineTransform();
initialTx = canvasGraphics.getTransform();
lastShape = null;
startTracking();
}
/**
* Reverts {@link Graphics2D} settings and returns area drawn by component
* in the meantime.
*
* @return
*/
public Area finishedDrawingComponent() {
drawingComponent = false;
canvasGraphics.setStroke(originalStroke);
canvasGraphics.setColor(originalColor);
canvasGraphics.setTransform(originalTx);
canvasGraphics.setComposite(originalComposite);
canvasGraphics.setFont(originalFont);
return currentArea;
}
@Override
public void startTracking() {
this.trackingAllowed = true;
}
@Override
public void stopTracking() {
this.trackingAllowed = false;
}
/**
* Appends shape interior to the current component area.
*
* @param s
*/
private void appendShape(Shape s) {
if (!drawingComponent || !trackingAllowed) {
return;
}
Rectangle2D bounds = s.getBounds2D();
// Only cache the shape if it's not 1D.
if (bounds.getWidth() > 1 && bounds.getHeight() > 1) {
Area area = new Area(s);
area.transform(currentTx);
currentArea.add(area);
lastShape = s;
}
}
/**
* Appends shape outline to the current component area.
*
* @param s
*/
private void appendShapeOutline(Shape s) {
// Do not add shape outline if the same shape has been filled recently.
if (!drawingComponent || !trackingAllowed || s.equals(lastShape)) {
return;
}
lastShape = s;
PathIterator pathIterator = s.getPathIterator(null);
double thickness;
if (getStroke() instanceof BasicStroke) {
thickness = ((BasicStroke) getStroke()).getLineWidth() + 2 * LINE_SENSITIVITY_MARGIN;
} else {
thickness = 2 * LINE_SENSITIVITY_MARGIN;
}
Point2D prevPoint = null;
while (!pathIterator.isDone()) {
double[] coord = new double[6];
int type = pathIterator.currentSegment(coord);
switch (type) {
case PathIterator.SEG_MOVETO:
prevPoint = new Point2D.Double(coord[0], coord[1]);
break;
case PathIterator.SEG_LINETO:
// Represent straight line with a rectangle.
Point2D nextPoint = new Point2D.Double(coord[0], coord[1]);
Double theta = Math.atan2(nextPoint.getY() - prevPoint.getY(), nextPoint.getX()
- prevPoint.getX());
double width = Math.sqrt(Math.pow(nextPoint.getX() - prevPoint.getX(), 2)
+ Math.pow(nextPoint.getY() - prevPoint.getY(), 2));
double midX = (prevPoint.getX() + nextPoint.getX()) / 2;
double midY = (prevPoint.getY() + nextPoint.getY()) / 2;
Rectangle2D rect = new Rectangle2D.Double(midX - width / 2, midY - thickness / 2,
width, thickness);
Area area = new Area(rect);
area.transform(AffineTransform.getRotateInstance(theta, midX, midY));
// area.transform(currentTx);
appendShape(area);
// Set the prev point to line end
prevPoint = nextPoint;
break;
case PathIterator.SEG_CUBICTO:
CubicCurve2D cubicCurve = new CubicCurve2D.Double(prevPoint.getX(), prevPoint
.getY(), coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]);
addCubicCurveArea(cubicCurve);
prevPoint = new Point2D.Double(coord[4], coord[5]);
break;
case PathIterator.SEG_QUADTO:
QuadCurve2D quadCurve = new QuadCurve2D.Double(prevPoint.getX(), prevPoint.getY(),
coord[0], coord[1], coord[2], coord[3]);
addQuadCurveArea(quadCurve);
prevPoint = new Point2D.Double(coord[3], coord[3]);
break;
}
pathIterator.next();
}
}
/**
* Adds a cubic curve to the component area. It uses subdivision to
* approximate the curve with a series of straight lines.
*
* @param curve
*/
private void addCubicCurveArea(CubicCurve2D curve) {
// When end points are close enough, approximate the curve with a
// straight line.
if (curve.getFlatness() < CURVE_SENSITIVITY) {
appendShapeOutline(new Line2D.Double(curve.getP1(), curve.getP2()));
} else {
CubicCurve2D leftSubcurve = new CubicCurve2D.Double();
CubicCurve2D rightSubcurve = new CubicCurve2D.Double();
curve.subdivide(leftSubcurve, rightSubcurve);
addCubicCurveArea(leftSubcurve);
addCubicCurveArea(rightSubcurve);
}
}
/**
* Adds a quad curve to the component area. It uses subdivision to
* approximate the curve with a series of straight lines.
*
* @param curve
*/
private void addQuadCurveArea(QuadCurve2D curve) {
// When end points are close enough, approximate the curve with a
// straight line.
if (curve.getFlatness() < CURVE_SENSITIVITY) {
appendShapeOutline(new Line2D.Double(curve.getP1(), curve.getP2()));
} else {
QuadCurve2D leftSubcurve = new QuadCurve2D.Double();
QuadCurve2D rightSubcurve = new QuadCurve2D.Double();
curve.subdivide(leftSubcurve, rightSubcurve);
addQuadCurveArea(leftSubcurve);
addQuadCurveArea(rightSubcurve);
}
}
@Override
public void addRenderingHints(Map<?, ?> hints) {
canvasGraphics.addRenderingHints(hints);
}
@Override
public void clip(Shape s) {
canvasGraphics.clip(s);
}
@Override
public void draw(Shape s) {
canvasGraphics.draw(s);
if (drawingComponent && trackingAllowed) {
appendShapeOutline(s);
}
}
@Override
public void drawGlyphVector(GlyphVector g, float x, float y) {
canvasGraphics.drawGlyphVector(g, x, y);
}
@Override
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
// FIXME: process map
return canvasGraphics.drawImage(img, xform, obs);
}
@Override
public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
canvasGraphics.drawImage(img, op, x, y);
// FIXME: process map
}
@Override
public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
canvasGraphics.drawRenderableImage(img, xform);
// FIXME: process map
}
@Override
public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
canvasGraphics.drawRenderedImage(img, xform);
// FIXME: process map
}
@Override
public void drawString(String str, int x, int y) {
canvasGraphics.drawString(str, x, y);
if (drawingComponent && trackingAllowed) {
FontMetrics fontMetrics = canvasGraphics.getFontMetrics();
Rectangle2D rect = fontMetrics.getStringBounds(str, canvasGraphics);
Point2D point = new Point2D.Double(x, y);
//currentTx.transform(point, point);
Rectangle2D finalRec = new Rectangle2D.Double(rect.getX() + point.getX(), rect.getY() + point.getY(), rect
.getWidth(), rect.getHeight());
appendShape(finalRec);
}
}
@Override
public void drawString(String str, float x, float y) {
canvasGraphics.drawString(str, x, y);
if (drawingComponent && trackingAllowed) {
FontMetrics fontMetrics = canvasGraphics.getFontMetrics();
Rectangle2D rect = fontMetrics.getStringBounds(str, canvasGraphics);
appendShape(new Rectangle2D.Double(rect.getX() + x, rect.getY() + y, rect.getWidth(),
rect.getHeight()));
}
}
@Override
public void drawString(AttributedCharacterIterator iterator, int x, int y) {
canvasGraphics.drawString(iterator, x, y);
// FIXME: process map
}
@Override
public void drawString(AttributedCharacterIterator iterator, float x, float y) {
canvasGraphics.drawString(iterator, x, y);
// FIXME: process map
}
@Override
public void fill(Shape s) {
canvasGraphics.fill(s);
appendShape(s);
}
@Override
public Color getBackground() {
return canvasGraphics.getBackground();
}
@Override
public Composite getComposite() {
return canvasGraphics.getComposite();
}
@Override
public GraphicsConfiguration getDeviceConfiguration() {
return canvasGraphics.getDeviceConfiguration();
}
@Override
public FontRenderContext getFontRenderContext() {
return canvasGraphics.getFontRenderContext();
}
@Override
public Paint getPaint() {
return canvasGraphics.getPaint();
}
@Override
public Object getRenderingHint(Key hintKey) {
return canvasGraphics.getRenderingHint(hintKey);
}
@Override
public RenderingHints getRenderingHints() {
return canvasGraphics.getRenderingHints();
}
@Override
public Stroke getStroke() {
return canvasGraphics.getStroke();
}
@Override
public AffineTransform getTransform() {
return canvasGraphics.getTransform();
}
@Override
public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
return canvasGraphics.hit(rect, s, onStroke);
}
@Override
public void rotate(double theta) {
canvasGraphics.rotate(theta);
currentTx.rotate(theta);
}
@Override
public void rotate(double theta, double x, double y) {
canvasGraphics.rotate(theta, x, y);
currentTx.rotate(theta, x, y);
}
@Override
public void scale(double sx, double sy) {
canvasGraphics.scale(sx, sy);
currentTx.scale(sx, sy);
}
@Override
public void setBackground(Color color) {
canvasGraphics.setBackground(color);
// FIXME: fix map
}
@Override
public void setComposite(Composite comp) {
canvasGraphics.setComposite(comp);
// FIXME: check this.
}
@Override
public void setPaint(Paint paint) {
canvasGraphics.setPaint(paint);
// FIXME: check this
}
@Override
public void setRenderingHint(Key hintKey, Object hintValue) {
canvasGraphics.setRenderingHint(hintKey, hintValue);
// FIXME: check this
}
@Override
public void setRenderingHints(Map<?, ?> hints) {
canvasGraphics.setRenderingHints(hints);
// FIXME: check this
}
@Override
public void setStroke(Stroke s) {
canvasGraphics.setStroke(s);
}
@Override
public void setTransform(AffineTransform Tx) {
canvasGraphics.setTransform(Tx);
currentTx = new AffineTransform(Tx);
try {
// Invert the tx that was set before we started drawing the component.
// We're left only component tx.
AffineTransform inverseInitialTx = initialTx.createInverse();
Point2D p = new Point2D.Double(currentTx.getTranslateX(), currentTx.getTranslateY());
inverseInitialTx.transform(p, p);
currentTx.concatenate(inverseInitialTx);
double[] matrix = new double[6];
currentTx.getMatrix(matrix);
currentTx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], p.getX(), p.getY());
} catch (NoninvertibleTransformException e) {
}
}
@Override
public void shear(double shx, double shy) {
canvasGraphics.shear(shx, shy);
currentTx.shear(shx, shy);
}
@Override
public void transform(AffineTransform Tx) {
canvasGraphics.transform(Tx);
currentTx.concatenate(Tx);
}
@Override
public void translate(int x, int y) {
canvasGraphics.translate(x, y);
currentTx.translate(x, y);
}
@Override
public void translate(double tx, double ty) {
canvasGraphics.translate(tx, ty);
currentTx.translate(tx, ty);
}
@Override
public void clearRect(int x, int y, int width, int height) {
canvasGraphics.clearRect(x, y, width, height);
}
@Override
public void clipRect(int x, int y, int width, int height) {
canvasGraphics.clipRect(x, y, width, height);
}
@Override
public void copyArea(int x, int y, int width, int height, int dx, int dy) {
canvasGraphics.copyArea(x, y, width, height, dx, dy);
}
@Override
public Graphics create() {
return canvasGraphics.create();
}
@Override
public void dispose() {
canvasGraphics.dispose();
}
@Override
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
canvasGraphics.drawArc(x, y, width, height, startAngle, arcAngle);
}
@Override
public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
boolean result = canvasGraphics.drawImage(img, x, y, observer);
appendShape(new Rectangle2D.Double(x, y, img.getWidth(observer), img.getHeight(observer)));
return result;
}
@Override
public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) {
// FIXME: map
return canvasGraphics.drawImage(img, x, y, bgcolor, observer);
}
@Override
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) {
// FIXME: map
return canvasGraphics.drawImage(img, x, y, width, height, observer);
}
@Override
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor,
ImageObserver observer) {
// FIXME: map
return canvasGraphics.drawImage(img, x, y, width, height, bgcolor, observer);
}
@Override
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
int sx2, int sy2, ImageObserver observer) {
// FIXME: map
return canvasGraphics.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
}
@Override
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
int sx2, int sy2, Color bgcolor, ImageObserver observer) {
// FIXME: map
return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer);
}
@Override
public void drawLine(int x1, int y1, int x2, int y2) {
canvasGraphics.drawLine(x1, y1, x2, y2);
if (drawingComponent && trackingAllowed) {
appendShapeOutline(new Line2D.Double(x1, y1, x2, y2));
}
}
@Override
public void drawOval(int x, int y, int width, int height) {
canvasGraphics.drawOval(x, y, width, height);
if (drawingComponent && trackingAllowed) {
appendShapeOutline(new Ellipse2D.Double(x, y, width, height));
}
}
@Override
public void drawPolygon(int[] points, int[] points2, int points3) {
canvasGraphics.drawPolygon(points, points2, points3);
if (drawingComponent && trackingAllowed) {
appendShapeOutline(new Polygon(points, points2, points3));
}
}
@Override
public void drawPolyline(int[] points, int[] points2, int points3) {
canvasGraphics.drawPolyline(points, points2, points3);
}
@Override
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
canvasGraphics.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
if (drawingComponent && trackingAllowed) {
appendShapeOutline(new RoundRectangle2D.Double(x, y, width, height, arcWidth, arcHeight));
}
}
@Override
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
canvasGraphics.fillArc(x, y, width, height, startAngle, arcAngle);
if (drawingComponent && trackingAllowed) {
appendShape(new Arc2D.Double(x, y, width, height, startAngle, arcAngle, Arc2D.PIE));
}
}
@Override
public void fillOval(int x, int y, int width, int height) {
canvasGraphics.fillOval(x, y, width, height);
if (drawingComponent && trackingAllowed) {
appendShape(new Ellipse2D.Double(x, y, width, height));
}
}
@Override
public void fillPolygon(int[] points, int[] points2, int points3) {
canvasGraphics.fillPolygon(points, points2, points3);
if (drawingComponent && trackingAllowed) {
appendShape(new Polygon(points, points2, points3));
}
}
@Override
public void drawRect(int x, int y, int width, int height) {
canvasGraphics.drawRect(x, y, width, height);
if (drawingComponent && trackingAllowed) {
appendShapeOutline(new Rectangle(x, y, width, height));
}
}
@Override
public void fillRect(int x, int y, int width, int height) {
canvasGraphics.fillRect(x, y, width, height);
if (drawingComponent && trackingAllowed) {
appendShape(new Rectangle(x, y, width, height));
}
}
@Override
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
canvasGraphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
if (drawingComponent && trackingAllowed) {
appendShape(new RoundRectangle2D.Double(x, y, width, height, arcWidth, arcHeight));
}
}
@Override
public Shape getClip() {
return canvasGraphics.getClip();
}
@Override
public Rectangle getClipBounds() {
return canvasGraphics.getClipBounds();
}
@Override
public Color getColor() {
return canvasGraphics.getColor();
}
@Override
public Font getFont() {
return canvasGraphics.getFont();
}
@Override
public FontMetrics getFontMetrics(Font f) {
return canvasGraphics.getFontMetrics(f);
}
@Override
public void setClip(Shape clip) {
canvasGraphics.setClip(clip);
}
@Override
public void setClip(int x, int y, int width, int height) {
canvasGraphics.setClip(x, y, width, height);
}
@Override
public void setColor(Color c) {
canvasGraphics.setColor(c);
}
@Override
public void setFont(Font font) {
canvasGraphics.setFont(font);
}
@Override
public void setPaintMode() {
canvasGraphics.setPaintMode();
}
@Override
public void setXORMode(Color c1) {
canvasGraphics.setXORMode(c1);
}
}
@@ -1,262 +0,0 @@
package org.diylc.presenter;
import java.awt.Point;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.ConfigurationManager;
import org.diylc.common.ComponentType;
import org.diylc.common.IPlugInPort;
import org.diylc.common.Orientation;
import org.diylc.common.PropertyWrapper;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.measures.Size;
/**
* Manages component instantiation.
*
* @author Branislav Stojkovic
*/
public class InstantiationManager {
private static final Logger LOG = Logger
.getLogger(InstantiationManager.class);
public static int MAX_RECENT_COMPONENTS = 16;
private ComponentType componentTypeSlot;
private IDIYComponent<?> componentSlot;
private Point firstControlPoint;
private Point potentialControlPoint;
public InstantiationManager() {
}
public ComponentType getComponentTypeSlot() {
return componentTypeSlot;
}
public IDIYComponent<?> getComponentSlot() {
return componentSlot;
}
public Point getFirstControlPoint() {
return firstControlPoint;
}
public Point getPotentialControlPoint() {
return potentialControlPoint;
}
public void setComponentTypeSlot(ComponentType componentTypeSlot,
Project currentProject) throws Exception {
this.componentTypeSlot = componentTypeSlot;
if (componentTypeSlot == null) {
this.componentSlot = null;
} else {
switch (componentTypeSlot.getCreationMethod()) {
case POINT_BY_POINT:
this.componentSlot = null;
break;
case SINGLE_CLICK:
this.componentSlot = instantiateComponent(componentTypeSlot,
new Point(0, 0), currentProject);
break;
}
}
this.firstControlPoint = null;
this.potentialControlPoint = null;
}
public void instatiatePointByPoint(Point scaledPoint, Project currentProject)
throws Exception {
firstControlPoint = scaledPoint;
componentSlot = instantiateComponent(componentTypeSlot,
firstControlPoint, currentProject);
// Set the other control point to the same location, we'll
// move it later when mouse moves.
componentSlot.setControlPoint(firstControlPoint, 0);
componentSlot.setControlPoint(firstControlPoint, 1);
}
/**
* Updates component in the slot with the new second control point.
*
* @param scaledPoint
* @return true, if any change is made
*/
public boolean updatePointByPoint(Point scaledPoint) {
boolean changeMade = !scaledPoint.equals(potentialControlPoint);
potentialControlPoint = scaledPoint;
if (componentSlot != null) {
componentSlot.setControlPoint(scaledPoint, 1);
}
return changeMade;
}
public boolean updateSingleClick(Point scaledPoint, boolean snapToGrid,
Size gridSpacing) {
if (potentialControlPoint == null) {
potentialControlPoint = new Point(0, 0);
}
int dx = scaledPoint.x - potentialControlPoint.x;
int dy = scaledPoint.y - potentialControlPoint.y;
if (snapToGrid) {
dx = CalcUtils.roundToGrid(dx, gridSpacing);
dy = CalcUtils.roundToGrid(dy, gridSpacing);
}
// Only repaint if there's an actual change.
if (dx == 0 && dy == 0) {
return false;
}
potentialControlPoint.translate(dx, dy);
if (componentSlot == null) {
LOG.error("Component slot should not be null!");
} else {
Point p = new Point();
for (int i = 0; i < componentSlot.getControlPointCount(); i++) {
p.setLocation(componentSlot.getControlPoint(i));
p.translate(dx, dy);
componentSlot.setControlPoint(p, i);
}
}
return true;
}
@SuppressWarnings("unchecked")
public IDIYComponent<?> instantiateComponent(ComponentType componentType,
Point point, Project currentProject) throws Exception {
LOG.info("Instatiating component of type: "
+ componentType.getInstanceClass().getName());
// Instantiate the component.
IDIYComponent<?> component = componentType.getInstanceClass()
.newInstance();
component.setName(createUniqueName(componentType, currentProject));
// Translate them to the desired location.
if (point != null) {
for (int j = 0; j < component.getControlPointCount(); j++) {
Point controlPoint = new Point(component.getControlPoint(j));
controlPoint.translate(point.x, point.y);
// snapPointToGrid(controlPoint);
component.setControlPoint(controlPoint, j);
}
}
fillWithDefaultProperties(component);
// Write to recent components
List<String> recentComponentTypes = (List<String>) ConfigurationManager
.getInstance().readObject(IPlugInPort.RECENT_COMPONENTS_KEY,
new ArrayList<ComponentType>());
String className = componentType.getInstanceClass().getName();
if (recentComponentTypes.size() == 0
|| !recentComponentTypes.get(0).equals(className)) {
// Remove if it's already somewhere in the list.
recentComponentTypes.remove(className);
// Add to the end of the list.
recentComponentTypes.add(0, className);
// Trim the list if necessary.
if (recentComponentTypes.size() > MAX_RECENT_COMPONENTS) {
recentComponentTypes.remove(recentComponentTypes.size() - 1);
}
ConfigurationManager.getInstance().writeValue(
IPlugInPort.RECENT_COMPONENTS_KEY, recentComponentTypes);
}
return component;
}
public String createUniqueName(ComponentType componentType,
Project currentProject) {
int i = 0;
boolean exists = true;
List<IDIYComponent<?>> components = currentProject.getComponents();
String[] takenNames = new String[components.size()];
for (int j = 0; j < currentProject.getComponents().size(); j++) {
takenNames[j] = components.get(i).getName();
}
Arrays.sort(takenNames);
while (exists) {
i++;
String name = componentType.getNamePrefix() + i;
exists = false;
if (Arrays.binarySearch(takenNames, name) >= 0) {
exists = true;
break;
}
}
return componentType.getNamePrefix() + i;
}
/**
* Finds any properties that have default values and injects default values.
* Typically it should be used for {@link IDIYComponent} and {@link Project}
* objects.
*
* @param object
* @throws IllegalArgumentException
* @throws IllegalAccessException
* @throws InvocationTargetException
* @throws NoSuchMethodException
* @throws SecurityException
*/
public void fillWithDefaultProperties(Object object)
throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException, SecurityException, NoSuchMethodException {
// Extract properties.
List<PropertyWrapper> properties = ComponentProcessor.getInstance()
.extractProperties(object.getClass());
// Override with default values if available.
for (PropertyWrapper property : properties) {
Object defaultValue = ConfigurationManager.getInstance()
.readObject(
Presenter.DEFAULTS_KEY_PREFIX
+ object.getClass().getName() + ":"
+ property.getName(), null);
if (defaultValue != null) {
property.setValue(defaultValue);
property.writeTo(object);
}
}
}
public void tryToRotateComponentSlot() {
if (this.componentSlot == null) {
LOG.debug("Component slot is empty, cannot rotate");
return;
}
List<PropertyWrapper> properties = ComponentProcessor.getInstance()
.extractProperties(this.componentTypeSlot.getInstanceClass());
PropertyWrapper angleProperty = null;
for (PropertyWrapper propertyWrapper : properties) {
if (propertyWrapper.getType().getName().equals(
Orientation.class.getName())) {
angleProperty = propertyWrapper;
break;
}
}
if (angleProperty == null) {
LOG
.debug("Component in the slot does not have a property of type Orientation, cannot rotate");
return;
}
try {
angleProperty.readFrom(this.componentSlot);
Orientation value = (Orientation) angleProperty.getValue();
value.ordinal();
angleProperty.setValue(Orientation.values()[(value.ordinal() + 1)
% Orientation.values().length]);
angleProperty.writeTo(this.componentSlot);
} catch (Exception e) {
LOG.warn("Error trying to rotate the component", e);
}
}
}
@@ -1,41 +0,0 @@
package org.diylc.presenter;
import java.awt.Point;
import org.diylc.utils.Constants;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
/**
* Serializes {@link Point} objects by converting coordinates from pixels to
* inches, thus avoiding the resolution to affect point placement.
*
* @author Branislav Stojkovic
*/
public class PointConverter implements Converter {
@Override
public void marshal(Object object, HierarchicalStreamWriter writer, MarshallingContext context) {
Point point = (Point) object;
writer.addAttribute("x", Double.toString(1d * point.x / Constants.PIXELS_PER_INCH));
writer.addAttribute("y", Double.toString(1d * point.y / Constants.PIXELS_PER_INCH));
}
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
double x = Double.parseDouble(reader.getAttribute("x"));
double y = Double.parseDouble(reader.getAttribute("y"));
return new Point((int) Math.round(x * Constants.PIXELS_PER_INCH), (int) Math.round(y
* Constants.PIXELS_PER_INCH));
}
@SuppressWarnings("unchecked")
@Override
public boolean canConvert(Class clazz) {
return Point.class.isAssignableFrom(clazz);
}
}
File diff suppressed because it is too large Load Diff
@@ -1,556 +0,0 @@
package org.diylc.presenter;
import java.awt.Color;
import java.awt.Point;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.log4j.Logger;
import org.diylc.appframework.simplemq.MessageDispatcher;
import org.diylc.common.Display;
import org.diylc.common.EventType;
import org.diylc.common.Orientation;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.components.AbstractTransparentComponent;
import org.diylc.components.boards.AbstractBoard;
import org.diylc.components.boards.BlankBoard;
import org.diylc.components.boards.PerfBoard;
import org.diylc.components.boards.VeroBoard;
import org.diylc.components.connectivity.CopperTrace;
import org.diylc.components.connectivity.HookupWire;
import org.diylc.components.connectivity.Jumper;
import org.diylc.components.connectivity.SolderPad;
import org.diylc.components.misc.Label;
import org.diylc.components.passive.PotentiometerPanel;
import org.diylc.components.passive.RadialElectrolytic;
import org.diylc.components.passive.RadialFilmCapacitor;
import org.diylc.components.passive.Resistor;
import org.diylc.components.passive.Taper;
import org.diylc.components.semiconductors.DIL_IC;
import org.diylc.components.semiconductors.DiodePlastic;
import org.diylc.components.semiconductors.LED;
import org.diylc.components.semiconductors.TransistorTO92;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.measures.Capacitance;
import org.diylc.core.measures.Resistance;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
public class ProjectFileManager {
private static final Logger LOG = Logger.getLogger(ProjectFileManager.class);
// private static final int V1_PIXELS_PER_INCH = 200;
private static final Size V1_GRID_SPACING = new Size(0.1d, SizeUnit.in);
private static final Map<String, Color> V1_COLOR_MAP = new HashMap<String, Color>();
static {
V1_COLOR_MAP.put("red", Color.red);
V1_COLOR_MAP.put("blue", Color.blue);
V1_COLOR_MAP.put("white", Color.white);
V1_COLOR_MAP.put("green", Color.green.darker());
V1_COLOR_MAP.put("black", Color.black);
V1_COLOR_MAP.put("yellow", Color.yellow);
}
private XStream xStream;
// Legacy deserializer for 3.0.1 through 3.0.7, loads Points referenced in
// pixels.
private XStream xStreamOld;
private String currentFileName = null;
private boolean modified = false;
private MessageDispatcher<EventType> messageDispatcher;
public ProjectFileManager(MessageDispatcher<EventType> messageDispatcher) {
super();
this.xStream = new XStream(new DomDriver("UTF-8"));
xStream.autodetectAnnotations(true);
xStream.registerConverter(new PointConverter());
this.xStreamOld = new XStream(new DomDriver());
xStreamOld.autodetectAnnotations(true);
this.messageDispatcher = messageDispatcher;
}
public void startNewFile() {
currentFileName = null;
modified = false;
fireFileStatusChanged();
}
public synchronized void serializeProjectToFile(Project project, String fileName, boolean isBackup)
throws IOException {
if (!isBackup) {
LOG.info(String.format("saveProjectToFile(%s)", fileName));
}
FileOutputStream fos;
fos = new FileOutputStream(fileName);
Writer writer = new OutputStreamWriter(fos, "UTF-8");
writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
xStream.toXML(project, writer);
fos.close();
if (!isBackup) {
this.currentFileName = fileName;
this.modified = false;
fireFileStatusChanged();
}
}
public Project deserializeProjectFromFile(String fileName, List<String> warnings)
throws SAXException, IOException, ParserConfigurationException {
LOG.info(String.format("loadProjectFromFile(%s)", fileName));
Project project;
File file = new File(fileName);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(new InputStreamReader(new FileInputStream(file))));
doc.getDocumentElement().normalize();
if (doc.getDocumentElement().getNodeName().equalsIgnoreCase(Project.class.getName())) {
project = parseV3File(fileName);
} else {
if (!doc.getDocumentElement().getNodeName().equalsIgnoreCase("layout")) {
throw new IllegalArgumentException(
"Could not open DIY file. Root node is not named 'Layout'.");
}
String formatVersion = doc.getDocumentElement().getAttribute("formatVersion");
if (formatVersion == null || formatVersion.trim().isEmpty()) {
LOG.debug("Detected v1 file.");
project = parseV1File(doc.getDocumentElement(), warnings);
} else if (formatVersion.equals("2.0")) {
LOG.debug("Detected v2 file.");
project = parseV2File(doc.getDocumentElement());
} else {
throw new IllegalArgumentException("Unknown file format version: " + formatVersion);
}
}
Collections.sort(warnings);
this.currentFileName = fileName;
this.modified = false;
return project;
}
public void notifyFileChange() {
this.modified = true;
fireFileStatusChanged();
}
public String getCurrentFileName() {
return currentFileName;
}
public boolean isModified() {
return modified;
}
public void fireFileStatusChanged() {
messageDispatcher.dispatchMessage(EventType.FILE_STATUS_CHANGED, getCurrentFileName(),
isModified());
}
private Project parseV1File(Element root, List<String> warnings) {
Project project = new Project();
project.setTitle(root.getAttribute("Project"));
project.setAuthor(root.getAttribute("Credits"));
project.setGridSpacing(V1_GRID_SPACING);
String type = root.getAttribute("Type");
// Create the board.
int width = Integer.parseInt(root.getAttribute("Width")) + 1;
int height = Integer.parseInt(root.getAttribute("Height")) + 1;
int boardWidth = (int) (width * Constants.PIXELS_PER_INCH * V1_GRID_SPACING.getValue());
int boardHeight = (int) (height * Constants.PIXELS_PER_INCH * V1_GRID_SPACING.getValue());
int projectWidth = (int) project.getWidth().convertToPixels();
int projectHeight = (int) project.getHeight().convertToPixels();
int x = (projectWidth - boardWidth) / 2;
int y = (projectHeight - boardHeight) / 2;
AbstractBoard board;
if (type.equalsIgnoreCase("pcb")) {
board = new BlankBoard();
board.setBoardColor(Color.white);
board.setBorderColor(Color.black);
} else if (type.equalsIgnoreCase("perfboard")) {
board = new PerfBoard();
} else if (type.equalsIgnoreCase("stripboard")) {
board = new VeroBoard();
} else {
throw new IllegalArgumentException("Unrecognized board type: " + type);
}
board.setName("Main board");
Point referencePoint = new Point(CalcUtils.roundToGrid(x, V1_GRID_SPACING), CalcUtils
.roundToGrid(y, V1_GRID_SPACING));
board.setControlPoint(referencePoint, 0);
board.setControlPoint(new Point(CalcUtils.roundToGrid(x + boardWidth, V1_GRID_SPACING),
CalcUtils.roundToGrid(y + boardHeight, V1_GRID_SPACING)), 1);
project.getComponents().add(board);
NodeList childNodes = root.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
String nodeName = node.getNodeName();
String nameAttr = node.getAttributes().getNamedItem("Name").getNodeValue();
Node valueNode = node.getAttributes().getNamedItem("Value");
String valueAttr = valueNode == null ? null : valueNode.getNodeValue();
int x1Attr = Integer.parseInt(node.getAttributes().getNamedItem("X1")
.getNodeValue());
int y1Attr = Integer.parseInt(node.getAttributes().getNamedItem("Y1")
.getNodeValue());
Point point1 = convertV1CoordinatesToV3Point(referencePoint, x1Attr, y1Attr);
Point point2 = null;
Integer x2Attr = null;
Integer y2Attr = null;
Color color = null;
if (node.getAttributes().getNamedItem("Color") != null) {
String colorAttr = node.getAttributes().getNamedItem("Color").getNodeValue();
color = V1_COLOR_MAP.get(colorAttr.toLowerCase());
}
if (node.getAttributes().getNamedItem("X2") != null
&& node.getAttributes().getNamedItem("Y2") != null) {
x2Attr = Integer.parseInt(node.getAttributes().getNamedItem("X2")
.getNodeValue());
y2Attr = Integer.parseInt(node.getAttributes().getNamedItem("Y2")
.getNodeValue());
point2 = convertV1CoordinatesToV3Point(referencePoint, x2Attr, y2Attr);
}
IDIYComponent<?> component = null;
if (nodeName.equalsIgnoreCase("text")) {
LOG.debug("Recognized " + nodeName);
Label label = new Label();
label.setName(nameAttr);
if (color != null) {
label.setColor(color);
}
label.setText(valueAttr);
label.setCenter(false);
label.setControlPoint(convertV1CoordinatesToV3Point(referencePoint, x1Attr,
y1Attr + 1), 0);
component = label;
} else if (nodeName.equalsIgnoreCase("pad")) {
LOG.debug("Recognized " + nodeName);
SolderPad pad = new SolderPad();
pad.setName(nameAttr);
if (color != null) {
pad.setColor(color);
}
pad.setControlPoint(convertV1CoordinatesToV3Point(referencePoint, x1Attr,
y1Attr), 0);
component = pad;
} else if (nodeName.equalsIgnoreCase("trace")) {
LOG.debug("Recognized " + nodeName);
CopperTrace trace = new CopperTrace();
trace.setName(nameAttr);
if (color != null) {
trace.setLeadColor(color);
}
trace.setControlPoint(point1, 0);
trace.setControlPoint(point2, 1);
component = trace;
} else if (nodeName.equalsIgnoreCase("jumper")) {
LOG.debug("Recognized " + nodeName);
Jumper jumper = new Jumper();
jumper.setName(nameAttr);
jumper.setControlPoint(point1, 0);
jumper.setControlPoint(point2, 1);
component = jumper;
} else if (nodeName.equalsIgnoreCase("wire")) {
LOG.debug("Recognized " + nodeName);
HookupWire wire = new HookupWire();
Point midPoint = new Point((point1.x + point2.x) / 2, (point1.y + point2.y) / 2);
wire.setName(nameAttr);
String colorAttr = node.getAttributes().getNamedItem("Color").getNodeValue();
wire.setColor(parseV1Color(colorAttr));
wire.setControlPoint(point1, 0);
wire.setControlPoint(midPoint, 1);
wire.setControlPoint(midPoint, 2);
wire.setControlPoint(point2, 3);
component = wire;
} else if (nodeName.equalsIgnoreCase("resistor")) {
LOG.debug("Recognized " + nodeName);
Resistor resistor = new Resistor();
resistor.setName(nameAttr);
try {
resistor.setValue(Resistance.parseResistance(valueAttr));
} catch (Exception e) {
LOG.debug("Could not set value of " + nameAttr);
}
resistor.setLength(new Size(6.35d, SizeUnit.mm));
resistor.setWidth(new Size(2.2d, SizeUnit.mm));
resistor.setControlPoint(point1, 0);
resistor.setControlPoint(point2, 1);
component = resistor;
} else if (nodeName.equalsIgnoreCase("capacitor")) {
LOG.debug("Recognized " + nodeName);
RadialFilmCapacitor capacitor = new RadialFilmCapacitor();
capacitor.setName(nameAttr);
try {
capacitor.setValue(Capacitance.parseCapacitance(valueAttr));
} catch (Exception e) {
LOG.debug("Could not set value of " + nameAttr);
}
capacitor.setLength(new Size(6d, SizeUnit.mm));
capacitor.setWidth(new Size(2d, SizeUnit.mm));
capacitor.setControlPoint(point1, 0);
capacitor.setControlPoint(point2, 1);
component = capacitor;
} else if (nodeName.equalsIgnoreCase("electrolyte")) {
LOG.debug("Recognized " + nodeName);
RadialElectrolytic capacitor = new RadialElectrolytic();
capacitor.setName(nameAttr);
try {
capacitor.setValue(Capacitance.parseCapacitance(valueAttr));
} catch (Exception e) {
LOG.debug("Could not set value of " + nameAttr);
}
try {
String sizeAttr = node.getAttributes().getNamedItem("Size").getNodeValue();
if (sizeAttr.equalsIgnoreCase("small")) {
capacitor.setLength(new Size(3.5d, SizeUnit.mm));
} else if (sizeAttr.equalsIgnoreCase("medium")) {
capacitor.setLength(new Size(5d, SizeUnit.mm));
} else if (sizeAttr.equalsIgnoreCase("large")) {
capacitor.setLength(new Size(7d, SizeUnit.mm));
} else {
capacitor.setLength(new Size(4d, SizeUnit.mm));
}
} catch (Exception e) {
capacitor.setLength(new Size(5d, SizeUnit.mm));
LOG.debug("Could not set size of " + nameAttr);
}
capacitor.setControlPoint(point1, 0);
capacitor.setControlPoint(point2, 1);
component = capacitor;
} else if (nodeName.equalsIgnoreCase("diode")) {
LOG.debug("Recognized " + nodeName);
DiodePlastic capacitor = new DiodePlastic();
capacitor.setName(nameAttr);
try {
capacitor.setValue(valueAttr);
} catch (Exception e) {
LOG.debug("Could not set value of " + nameAttr);
}
capacitor.setLength(new Size(6d, SizeUnit.mm));
capacitor.setWidth(new Size(2d, SizeUnit.mm));
capacitor.setControlPoint(point1, 0);
capacitor.setControlPoint(point2, 1);
component = capacitor;
} else if (nodeName.equalsIgnoreCase("led")) {
LOG.debug("Recognized " + nodeName);
LED led = new LED();
led.setName(nameAttr);
led.setValue(valueAttr);
led.setBodyColor(Color.red);
led.setBorderColor(Color.red.darker());
led.setLength(new Size(3d, SizeUnit.mm));
led.setControlPoint(point1, 0);
led.setControlPoint(point2, 1);
component = led;
} else if (nodeName.equalsIgnoreCase("transistor")) {
LOG.debug("Recognized " + nodeName);
TransistorTO92 transistor = new TransistorTO92();
transistor.setName(nameAttr);
try {
transistor.setValue(valueAttr);
} catch (Exception e) {
LOG.debug("Could not set value of " + nameAttr);
}
transistor.setControlPoint(point1, 0);
if (point1.y > point2.y) {
transistor.setOrientation(Orientation._180);
} else if (point1.y < point2.y) {
transistor.setOrientation(Orientation.DEFAULT);
} else if (point1.x < point2.x) {
transistor.setOrientation(Orientation._270);
} else if (point1.x > point2.x) {
transistor.setOrientation(Orientation._90);
}
// capacitor.setControlPoint(point2, 1);
component = transistor;
} else if (nodeName.equalsIgnoreCase("ic")) {
LOG.debug("Recognized " + nodeName);
DIL_IC ic = new DIL_IC();
int pinCount = 8;
int rowSpace = 3;
if (x1Attr < x2Attr && y1Attr < y2Attr) {
pinCount = (y2Attr - y1Attr + 1) * 2;
rowSpace = x2Attr - x1Attr;
ic.setOrientation(Orientation.DEFAULT);
} else if (x1Attr > x2Attr && y1Attr < y2Attr) {
pinCount = (x1Attr - x2Attr + 1) * 2;
rowSpace = y2Attr - y1Attr;
ic.setOrientation(Orientation._90);
} else if (x1Attr > x2Attr && y1Attr > y2Attr) {
rowSpace = x1Attr - x2Attr;
pinCount = (y1Attr - y2Attr + 1) * 2;
ic.setOrientation(Orientation._180);
} else if (x1Attr < x2Attr && y1Attr > y2Attr) {
rowSpace = y1Attr - y2Attr;
pinCount = (x2Attr - x1Attr + 1) * 2;
ic.setOrientation(Orientation._270);
}
ic.setRowSpacing(new Size(0.1 * rowSpace, SizeUnit.in));
ic.setPinCount(DIL_IC.PinCount.valueOf("_" + pinCount));
ic.setName(nameAttr);
// Translate control points.
for (int j = 0; j < ic.getControlPointCount(); j++) {
Point p = new Point(ic.getControlPoint(j));
p.translate(point1.x, point1.y);
ic.setControlPoint(p, j);
}
ic.setValue(valueAttr);
component = ic;
} else if (nodeName.equalsIgnoreCase("pot")) {
LOG.debug("Recognized " + nodeName);
PotentiometerPanel pot = new PotentiometerPanel();
pot.setBodyDiameter(new Size(14d, SizeUnit.mm));
pot.setSpacing(new Size(0.2, SizeUnit.in));
pot.setName(nameAttr);
try {
pot.setResistance(Resistance.parseResistance(valueAttr));
} catch (Exception e) {
LOG.debug("Could not set value of " + nameAttr);
}
String taperAttr = node.getAttributes().getNamedItem("Taper").getNodeValue();
if ("Linear".equals(taperAttr)) {
pot.setTaper(Taper.LIN);
} else if ("Audio".equals(taperAttr)) {
pot.setTaper(Taper.LOG);
} else if ("Reverse Audio".equals(taperAttr)) {
pot.setTaper(Taper.REV_LOG);
}
// Pin spacing, we'll need to move pot around a bit.
int delta = Constants.PIXELS_PER_INCH / 5;
if (x1Attr < x2Attr) {
pot.setOrientation(Orientation.DEFAULT);
for (int j = 0; j < pot.getControlPointCount(); j++) {
Point p = new Point(pot.getControlPoint(j));
p.translate(point1.x - delta, point1.y);
pot.setControlPoint(p, j);
}
} else if (x1Attr > x2Attr) {
pot.setOrientation(Orientation._180);
for (int j = 0; j < pot.getControlPointCount(); j++) {
Point p = new Point(pot.getControlPoint(j));
p.translate(point1.x + delta, point1.y);
pot.setControlPoint(p, j);
}
} else if (y1Attr < y2Attr) {
pot.setOrientation(Orientation._90);
for (int j = 0; j < pot.getControlPointCount(); j++) {
Point p = new Point(pot.getControlPoint(j));
p.translate(point1.x, point1.y - delta);
pot.setControlPoint(p, j);
}
} else if (y1Attr > y2Attr) {
pot.setOrientation(Orientation._270);
for (int j = 0; j < pot.getControlPointCount(); j++) {
Point p = new Point(pot.getControlPoint(j));
p.translate(point1.x, point1.y + delta);
pot.setControlPoint(p, j);
}
;
}
component = pot;
} else {
String message = "Could not recognize component type " + nodeName;
LOG.debug(message);
if (!warnings.contains(message)) {
warnings.add(message);
}
}
if (component != null) {
if (component instanceof AbstractLeadedComponent<?>) {
((AbstractLeadedComponent<?>) component).setDisplay(Display.NAME);
}
if (component instanceof AbstractTransparentComponent<?>) {
((AbstractTransparentComponent<?>) component).setAlpha((byte) 100);
}
project.getComponents().add(component);
}
}
}
Collections.sort(project.getComponents(), ComparatorFactory.getInstance()
.getComponentZOrderComparator());
return project;
}
private Point convertV1CoordinatesToV3Point(Point reference, int x, int y) {
Point point = new Point(reference);
point.translate((int) (x * Constants.PIXELS_PER_INCH * V1_GRID_SPACING.getValue()),
(int) (y * Constants.PIXELS_PER_INCH * V1_GRID_SPACING.getValue()));
return point;
}
private Color parseV1Color(String color) {
if ("brown".equals(color.toLowerCase()))
return new Color(139, 69, 19);
try {
Field field = Color.class.getDeclaredField(color.toLowerCase());
return (Color) field.get(null);
} catch (Exception e) {
LOG.error("Could not parse color \"" + color + "\"", e);
return Color.black;
}
}
private Project parseV2File(Element root) {
Project project = new Project();
String projectName = root.getAttribute("projectName");
String credits = root.getAttribute("credits");
String width = root.getAttribute("width");
String height = root.getAttribute("height");
NodeList childNodes = root.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (node.getNodeName().equalsIgnoreCase("component")) {
LOG.debug(node.getAttributes().getNamedItem("name").getNodeValue());
} else {
LOG.debug("Unrecognized node name found: " + node.getNodeName());
}
}
}
return project;
}
private Project parseV3File(String fileName) throws IOException {
Project project;
FileInputStream fis = new FileInputStream(fileName);
try {
Reader reader = new InputStreamReader(fis, "UTF-8");
project = (Project) xStream.fromXML(reader);
} catch (Exception e) {
LOG.warn("Could not open with the new xStream, trying the old one");
fis.close();
fis = new FileInputStream(fileName);
project = (Project) xStreamOld.fromXML(fis);
}
fis.close();
return project;
}
}
@@ -1,101 +0,0 @@
package org.diylc.utils;
public class BomEntry {
private String type;
private String name;
private String value;
private Integer quantity;
private String notes;
public BomEntry(String type, String name, String value, int quantity) {
super();
this.type = type;
this.name = name;
this.value = value;
this.quantity = quantity;
}
public String getType() {
return type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((notes == null) ? 0 : notes.hashCode());
result = prime * result + quantity;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BomEntry other = (BomEntry) obj;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (notes == null) {
if (other.notes != null)
return false;
} else if (!notes.equals(other.notes))
return false;
if (quantity != other.quantity)
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
}
@@ -1,70 +0,0 @@
package org.diylc.utils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.diylc.common.ComponentType;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.presenter.ComponentProcessor;
public class BomMaker {
private static BomMaker instance;
public static BomMaker getInstance() {
if (instance == null) {
instance = new BomMaker();
}
return instance;
}
private BomMaker() {
}
public List<BomEntry> createBom(List<IDIYComponent<?>> components) {
Map<String, BomEntry> entryMap = new HashMap<String, BomEntry>();
for (IDIYComponent<?> component : components) {
ComponentType type = ComponentProcessor.getInstance()
.extractComponentTypeFrom(
(Class<? extends IDIYComponent<?>>) component
.getClass());
if (type.getBomPolicy() == BomPolicy.NEVER_SHOW)
continue;
String name = component.getName();
String value = component.getValue() == null ? null : component
.getValue().toString();
if ((name != null) && (value != null)) {
String key = type.getName() + "|" + value;
if (entryMap.containsKey(key)) {
BomEntry entry = entryMap.get(key);
entry.setQuantity(entry.getQuantity() + 1);
if (type.getBomPolicy() == BomPolicy.SHOW_ALL_NAMES) {
entry.setName(entry.getName() + ", " + name);
}
} else {
entryMap.put(key, new BomEntry(type.getName(), type
.getBomPolicy() == BomPolicy.SHOW_ALL_NAMES ? name
: type.getName(), value, 1));
}
}
}
List<BomEntry> bom = new ArrayList<BomEntry>(entryMap.values());
Collections.sort(bom, new Comparator<BomEntry>() {
@Override
public int compare(BomEntry o1, BomEntry o2) {
int compare = o1.getName().compareToIgnoreCase(o2.getName());
if (compare != 0) {
return compare;
}
return o1.getValue().compareToIgnoreCase(o2.getValue());
}
});
return bom;
}
}
@@ -1,27 +0,0 @@
package org.diylc.utils;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Stroke;
import java.awt.Toolkit;
import org.diylc.core.Theme;
public class Constants {
public static final int PIXELS_PER_INCH = 200;
public static final double PIXEL_SIZE = 1d * PIXELS_PER_INCH
/ Toolkit.getDefaultToolkit().getScreenResolution();
public static Color CANVAS_COLOR = Color.white;
public static final Stroke DASHED_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER, 10f, new float[] { 2.0f }, 0.0f);
public static final Theme DEFAULT_THEME = new Theme("Light", Constants.CANVAS_COLOR, new Color(
240, 240, 240), Color.black);
public static final Color TRANSPARENT_COLOR = new Color(0, 0, 0, 0);
public static final Color MULTI_VALUE_COLOR = Color.yellow;
}
@@ -1,43 +0,0 @@
package org.diylc.utils;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Collection;
import org.apache.log4j.Logger;
public class MemoryCleaner {
private static final Logger LOG = Logger.getLogger(MemoryCleaner.class);
public static void clean(Object obj) {
Class<?> clazz = obj.getClass();
LOG.debug("Cleaning up object of type: " + clazz.getName());
try {
Method disposeMethod = clazz.getMethod("dispose");
disposeMethod.invoke(obj);
} catch (Exception e) {
LOG.error(e);
}
// If it's a collection loop over and dispose elements.
if (Collection.class.isAssignableFrom(clazz)) {
LOG.info("Cleaning up collection elements");
for (Object childObj : (Collection<?>) obj) {
clean(childObj);
}
}
for (Field field : clazz.getFields()) {
if (!Modifier.isFinal(field.getModifiers())) {
try {
LOG.info("Cleaning up field: " + field.getName());
Object childObj = field.get(obj);
field.set(obj, null);
clean(childObj);
} catch (Exception e) {
LOG.error(e);
}
}
}
}
}
-14
View File
@@ -1,14 +0,0 @@
package org.diylc;
import org.diylc.plugins.file.BomMakerTest;
import org.diylc.presenter.ClassProcessorTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses( { BomMakerTest.class, ClassProcessorTest.class })
public class AllTests {
}
@@ -1,145 +0,0 @@
package org.diylc.components;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Capacitance;
import org.diylc.core.measures.CapacitanceUnit;
import org.diylc.core.measures.Resistance;
import org.diylc.core.measures.ResistanceUnit;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
@ComponentDescriptor(name = "Mock", author = "bancika", category = "Sample", instanceNamePrefix = "M", description = "test", zOrder = IDIYComponent.COMPONENT)
public class MockDIYComponent extends AbstractComponent<Capacitance> {
private static final long serialVersionUID = 1L;
private String testField = "Hello World";
private Capacitance c = new Capacitance(100d, CapacitanceUnit.uF);
private Resistance r = new Resistance(123d, ResistanceUnit.K);
private Size s = new Size(1d, SizeUnit.cm);
private Color color = Color.green;
private Point leftTopCorner = new Point(0, 0);
private String name = "something";
public MockDIYComponent(String testField, Capacitance c, Resistance r, Size s, Color color,
Point leftTopCorner) {
super();
this.testField = testField;
this.c = c;
this.r = r;
this.s = s;
this.color = color;
this.leftTopCorner = leftTopCorner;
}
public MockDIYComponent() {
super();
}
@Override
public boolean canControlPointOverlap(int index) {
return false;
}
@EditableProperty
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int getControlPointCount() {
return 1;
}
@Override
public boolean isControlPointSticky(int index) {
return false;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.WHEN_SELECTED;
}
@Override
public Point getControlPoint(int index) {
return leftTopCorner;
}
@Override
public void setControlPoint(Point point, int index) {
leftTopCorner.setLocation(point);
}
@EditableProperty(name = "Test Field")
public String getTestField() {
return testField;
}
public void setTestField(String testField) {
this.testField = testField;
}
@EditableProperty(defaultable = true)
public Capacitance getValue() {
return c;
}
public void setValue(Capacitance c) {
this.c = c;
}
@EditableProperty(defaultable = true)
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
@EditableProperty
public Resistance getR() {
return r;
}
// Setter is commented out, ClassProcessor should ignore this property.
// public void setR(Resistance r) {
// this.r = r;
// }
// No annotation, so this property should be ignored.
public Size getS() {
return s;
}
public void setS(Size s) {
this.s = s;
}
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
g2d.setColor(componentState.equals(ComponentState.SELECTED) ? color : color.darker());
g2d.fillRect(leftTopCorner.x, leftTopCorner.y, 200, 50);
}
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.drawString("X", 10, 10);
}
}
@@ -1,37 +0,0 @@
package org.diylc.plugins.file;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.ArrayList;
import java.util.List;
import org.diylc.components.MockDIYComponent;
import org.diylc.core.IDIYComponent;
import org.diylc.core.measures.Capacitance;
import org.diylc.core.measures.CapacitanceUnit;
import org.diylc.utils.BomEntry;
import org.diylc.utils.BomMaker;
import org.junit.Test;
public class BomMakerTest {
@Test
public void testCreateBom() {
List<IDIYComponent<?>> components = new ArrayList<IDIYComponent<?>>();
MockDIYComponent c1 = new MockDIYComponent();
c1.setValue(new Capacitance(3d, CapacitanceUnit.pF));
components.add(c1);
components.add(new MockDIYComponent());
components.add(new MockDIYComponent());
List<BomEntry> bom = BomMaker.getInstance().createBom(components);
assertNotNull(bom);
assertEquals(2, bom.size());
BomEntry entry1 = bom.get(0);
assertEquals("something", entry1.getName());
assertEquals(2, (int) entry1.getQuantity());
BomEntry entry2 = bom.get(1);
assertEquals("something", entry2.getName());
assertEquals(1, (int) entry2.getQuantity());
}
}
@@ -1,22 +0,0 @@
package org.diylc.presenter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.List;
import org.diylc.common.PropertyWrapper;
import org.diylc.components.MockDIYComponent;
import org.junit.Test;
public class ClassProcessorTest {
@Test
public void testExtractProperties() {
List<PropertyWrapper> properties = ComponentProcessor.getInstance().extractProperties(
MockDIYComponent.class);
assertNotNull(properties);
assertEquals(4, properties.size());
};
}
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/xstream-1.3.1.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/diylc-core"/>
<classpathentry combineaccessrules="false" kind="src" path="/app-framework"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,183 +0,0 @@
package org.diylc.components.boards;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Point;
import org.diylc.common.HorizontalAlignment;
import org.diylc.common.ObjectCache;
import org.diylc.common.VerticalAlignment;
import org.diylc.components.AbstractTransparentComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
public abstract class AbstractBoard extends AbstractTransparentComponent<String> {
private static final long serialVersionUID = 1L;
public static Color BOARD_COLOR = Color.decode("#F8EBB3");
public static Color BORDER_COLOR = BOARD_COLOR.darker();
public static Color COORDINATE_COLOR = Color.gray.brighter();
public static float COORDINATE_FONT_SIZE = 9f;
public static Size DEFAULT_WIDTH = new Size(1.5d, SizeUnit.in);
public static Size DEFAULT_HEIGHT = new Size(1.2d, SizeUnit.in);
protected String value = "";
protected Point[] controlPoints = new Point[] {
new Point(0, 0),
new Point((int) DEFAULT_WIDTH.convertToPixels(), (int) DEFAULT_HEIGHT.convertToPixels()) };
protected Point firstPoint = new Point();
protected Point secondPoint = new Point();
protected Color boardColor = BOARD_COLOR;
protected Color borderColor = BORDER_COLOR;
protected Color coordinateColor = COORDINATE_COLOR;
protected Boolean drawCoordinates = true;
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
if (componentState != ComponentState.DRAGGING) {
Composite oldComposite = g2d.getComposite();
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
g2d.setColor(boardColor);
g2d.fillRect(firstPoint.x, firstPoint.y, secondPoint.x - firstPoint.x, secondPoint.y
- firstPoint.y);
g2d.setComposite(oldComposite);
}
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
g2d.drawRect(firstPoint.x, firstPoint.y, secondPoint.x - firstPoint.x, secondPoint.y
- firstPoint.y);
// Do not track any changes that follow because the whole board has been
// tracked so far.
drawingObserver.stopTracking();
}
protected void drawCoordinates(Graphics2D g2d, int spacing) {
if (!getDrawCoordinates())
return;
Point p = new Point(firstPoint);
g2d.setColor(coordinateColor);
g2d.setFont(LABEL_FONT.deriveFont(COORDINATE_FONT_SIZE));
int t = 1;
while (p.y < secondPoint.y - spacing) {
p.y += spacing;
super.drawCenteredText(g2d, getCoordinateLabel(t++), p.x + 2, p.y,
HorizontalAlignment.LEFT, VerticalAlignment.CENTER);
}
p = new Point(firstPoint);
t = 1;
while (p.x < secondPoint.x - spacing) {
p.x += spacing;
super.drawCenteredText(g2d, getCoordinateLabel(t++), p.x, p.y - 2,
HorizontalAlignment.CENTER, VerticalAlignment.TOP);
}
}
private String getCoordinateLabel(int coordinate) {
String result = "";
while (coordinate > 0) {
int digit = coordinate % 26;
coordinate /= 26;
if (digit == 0) {
result = 'Z' + result;
coordinate--;
} else {
result = (char) ((int) 'A' + digit - 1) + result;
}
}
return result;
}
@EditableProperty(name = "Color")
public Color getBoardColor() {
return boardColor;
}
public void setBoardColor(Color boardColor) {
this.boardColor = boardColor;
}
@EditableProperty(name = "Coordinate Color")
public Color getCoordinateColor() {
// Null protection for older files
return coordinateColor == null ? COORDINATE_COLOR : coordinateColor;
}
public void setCoordinateColor(Color coordinateColor) {
this.coordinateColor = coordinateColor;
}
@EditableProperty(name = "Border")
public Color getBorderColor() {
return borderColor;
}
public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}
@EditableProperty(name = "Draw Coordinates")
public boolean getDrawCoordinates() {
// Null protection for older files
return drawCoordinates == null || drawCoordinates;
}
public void setDrawCoordinates(boolean drawCoordinates) {
this.drawCoordinates = drawCoordinates;
}
@Override
public int getControlPointCount() {
return controlPoints.length;
}
@Override
public Point getControlPoint(int index) {
return controlPoints[index];
}
@Override
public boolean isControlPointSticky(int index) {
return false;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.WHEN_SELECTED;
}
@Override
public void setControlPoint(Point point, int index) {
controlPoints[index].setLocation(point);
firstPoint.setLocation(Math.min(controlPoints[0].x, controlPoints[1].x), Math.min(
controlPoints[0].y, controlPoints[1].y));
secondPoint.setLocation(Math.max(controlPoints[0].x, controlPoints[1].x), Math.max(
controlPoints[0].y, controlPoints[1].y));
}
@EditableProperty
@Override
public String getValue() {
return value;
}
@Override
public void setValue(String value) {
this.value = value;
}
}
@@ -1,27 +0,0 @@
package org.diylc.components.boards;
import java.awt.Graphics2D;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
@ComponentDescriptor(name = "Blank Board", category = "Boards", author = "Branislav Stojkovic", zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Blank circuit board", bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME)
public class BlankBoard extends AbstractBoard {
private static final long serialVersionUID = 1L;
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(BOARD_COLOR);
g2d.fillRect(2, 2, width - 4, height - 4);
g2d.setColor(BORDER_COLOR);
g2d.drawRect(2, 2, width - 4, height - 4);
}
@Override
public boolean getDrawCoordinates() {
// Override to prevent editing.
return super.getDrawCoordinates();
}
}
@@ -1,116 +0,0 @@
package org.diylc.components.boards;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Eyelet Board", category = "Boards", author = "Branislav Stojkovic", zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board with eyelets", bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME)
public class EyeletBoard extends AbstractBoard {
private static final long serialVersionUID = 1L;
public static Color BOARD_COLOR = Color.decode("#CCFFCC");
public static Color BORDER_COLOR = BOARD_COLOR.darker();
public static Color EYELET_COLOR = Color.decode("#C3E4ED");
public static Size SPACING = new Size(0.5d, SizeUnit.in);
public static Size EYELET_SIZE = new Size(0.2d, SizeUnit.in);
public static Size HOLE_SIZE = new Size(0.1d, SizeUnit.in);
// private Area copperArea;
protected Size spacing = SPACING;
protected Color eyeletColor = EYELET_COLOR;
public EyeletBoard() {
super();
this.boardColor = BOARD_COLOR;
this.borderColor = BORDER_COLOR;
}
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
Shape clip = g2d.getClip();
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
&& !clip.contains(secondPoint.x, firstPoint.y)) {
return;
}
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
if (componentState != ComponentState.DRAGGING) {
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
Point p = new Point(firstPoint);
int diameter = getClosestOdd((int) EYELET_SIZE.convertToPixels());
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
int spacing = (int) this.spacing.convertToPixels();
while (p.y < secondPoint.y - spacing) {
p.x = firstPoint.x;
p.y += spacing;
while (p.x < secondPoint.x - spacing - diameter) {
p.x += spacing;
g2d.setColor(eyeletColor);
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
g2d.setColor(eyeletColor.darker());
g2d.drawOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
holeDiameter);
g2d.setColor(eyeletColor.darker());
g2d.drawOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
holeDiameter);
}
}
super.drawCoordinates(g2d, spacing);
}
}
@EditableProperty(name = "Eyelet color")
public Color getEyeletColor() {
return eyeletColor;
}
public void setEyeletColor(Color padColor) {
this.eyeletColor = padColor;
}
@EditableProperty
public Size getSpacing() {
return spacing;
}
public void setSpacing(Size spacing) {
this.spacing = spacing;
}
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(BOARD_COLOR);
g2d.fillRect(2, 2, width - 4, height - 4);
g2d.setColor(BORDER_COLOR);
g2d.drawRect(2, 2, width - 4, height - 4);
g2d.setColor(EYELET_COLOR);
g2d.fillOval(width / 4, width / 4, width / 2, width / 2);
g2d.setColor(EYELET_COLOR.darker());
g2d.drawOval(width / 4, width / 4, width / 2, width / 2);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(width / 2 - 2, width / 2 - 2, 5, 5);
g2d.setColor(EYELET_COLOR.darker());
g2d.drawOval(width / 2 - 2, width / 2 - 2, 5, 5);
}
}
@@ -1,110 +0,0 @@
package org.diylc.components.boards;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Marshall Style Perf Board", category = "Boards", author = "Branislav Stojkovic", zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board as found on some Marshall and Trainwreck amps", bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME)
public class MarshallPerfBoard extends AbstractBoard {
private static final long serialVersionUID = 1L;
public static Color BOARD_COLOR = Color.decode("#CD8500");
public static Color BORDER_COLOR = BOARD_COLOR.darker();
public static Size SPACING = new Size(3 / 8d, SizeUnit.in);
public static Size HOLE_SIZE = new Size(1 / 8d, SizeUnit.in);
// private Area copperArea;
protected Size spacing = SPACING;
public MarshallPerfBoard() {
super();
this.boardColor = BOARD_COLOR;
this.borderColor = BORDER_COLOR;
}
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
Shape clip = g2d.getClip();
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
&& !clip.contains(secondPoint.x, firstPoint.y)) {
return;
}
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
if (componentState != ComponentState.DRAGGING) {
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
Point p = new Point(firstPoint);
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
int spacing = (int) this.spacing.convertToPixels();
while (p.y < secondPoint.y - spacing) {
p.x = firstPoint.x;
p.y += spacing;
while (p.x < secondPoint.x - spacing - holeDiameter) {
p.x += spacing;
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
holeDiameter);
g2d.setColor(borderColor);
g2d.drawOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
holeDiameter);
}
}
super.drawCoordinates(g2d, spacing);
}
}
@EditableProperty
public Size getSpacing() {
return spacing;
}
public void setSpacing(Size spacing) {
this.spacing = spacing;
}
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(BOARD_COLOR);
g2d.fillRect(2, 2, width - 4, height - 4);
g2d.setColor(BORDER_COLOR);
g2d.drawRect(2, 2, width - 4, height - 4);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(width / 3 - 2, width / 3 - 2, 5, 5);
g2d.setColor(BORDER_COLOR);
g2d.drawOval(width / 3 - 2, width / 3 - 2, 5, 5);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(2 * width / 3 - 2, width / 3 - 2, 5, 5);
g2d.setColor(BORDER_COLOR);
g2d.drawOval(2 * width / 3 - 2, width / 3 - 2, 5, 5);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(width / 3 - 2, 2 * width / 3 - 2, 5, 5);
g2d.setColor(BORDER_COLOR);
g2d.drawOval(width / 3 - 2, 2 * width / 3 - 2, 5, 5);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(2 * width / 3 - 2, 2 * width / 3 - 2, 5, 5);
g2d.setColor(BORDER_COLOR);
g2d.drawOval(2 * width / 3 - 2, 2 * width / 3 - 2, 5, 5);
}
}
@@ -1,108 +0,0 @@
package org.diylc.components.boards;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Perf Board w/ Pads", category = "Boards", author = "Branislav Stojkovic", zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board with solder pads", bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME)
public class PerfBoard extends AbstractBoard {
private static final long serialVersionUID = 1L;
public static Color COPPER_COLOR = Color.decode("#DA8A67");
public static Size SPACING = new Size(0.1d, SizeUnit.in);
public static Size PAD_SIZE = new Size(0.08d, SizeUnit.in);
public static Size HOLE_SIZE = new Size(0.7d, SizeUnit.mm);
// private Area copperArea;
protected Size spacing = SPACING;
protected Color padColor = COPPER_COLOR;
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
Shape clip = g2d.getClip();
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
&& !clip.contains(secondPoint.x, firstPoint.y)) {
return;
}
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
if (componentState != ComponentState.DRAGGING) {
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
Point p = new Point(firstPoint);
int diameter = getClosestOdd((int) PAD_SIZE.convertToPixels());
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
int spacing = (int) this.spacing.convertToPixels();
while (p.y < secondPoint.y - spacing) {
p.x = firstPoint.x;
p.y += spacing;
while (p.x < secondPoint.x - spacing - diameter) {
p.x += spacing;
g2d.setColor(padColor);
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
g2d.setColor(padColor.darker());
g2d.drawOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
holeDiameter);
g2d.setColor(padColor.darker());
g2d.drawOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
holeDiameter);
}
}
super.drawCoordinates(g2d, spacing);
}
}
@EditableProperty(name = "Pad color")
public Color getPadColor() {
return padColor;
}
public void setPadColor(Color padColor) {
this.padColor = padColor;
}
@EditableProperty
public Size getSpacing() {
return spacing;
}
public void setSpacing(Size spacing) {
this.spacing = spacing;
}
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(BOARD_COLOR);
g2d.fillRect(2, 2, width - 4, height - 4);
g2d.setColor(BORDER_COLOR);
g2d.drawRect(2, 2, width - 4, height - 4);
g2d.setColor(COPPER_COLOR);
g2d.fillOval(width / 4, width / 4, width / 2, width / 2);
g2d.setColor(COPPER_COLOR.darker());
g2d.drawOval(width / 4, width / 4, width / 2, width / 2);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(width / 2 - 2, width / 2 - 2, 5, 5);
g2d.setColor(COPPER_COLOR.darker());
g2d.drawOval(width / 2 - 2, width / 2 - 2, 5, 5);
}
}
@@ -1,144 +0,0 @@
package org.diylc.components.boards;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import org.diylc.common.OrientationHV;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Vero Board", category = "Boards", author = "Branislav Stojkovic", zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated FR4 board with copper strips connecting all holes in a row", bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME)
public class VeroBoard extends AbstractBoard {
private static final long serialVersionUID = 1L;
public static Color STRIP_COLOR = Color.decode("#DA8A67");
public static Color BORDER_COLOR = BOARD_COLOR.darker();
public static Size SPACING = new Size(0.1d, SizeUnit.in);
public static Size STRIP_SIZE = new Size(0.07d, SizeUnit.in);
public static Size HOLE_SIZE = new Size(0.7d, SizeUnit.mm);
protected Size spacing = SPACING;
protected Color stripColor = STRIP_COLOR;
protected OrientationHV orientation = OrientationHV.HORIZONTAL;
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
Shape clip = g2d.getClip();
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
&& !clip.contains(secondPoint.x, firstPoint.y)) {
return;
}
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
if (componentState != ComponentState.DRAGGING) {
Composite oldComposite = g2d.getComposite();
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
Point p = new Point(firstPoint);
int stripSize = getClosestOdd((int) STRIP_SIZE.convertToPixels());
int holeSize = getClosestOdd((int) HOLE_SIZE.convertToPixels());
int spacing = (int) this.spacing.convertToPixels();
if (orientation == OrientationHV.HORIZONTAL) {
while (p.y < secondPoint.y - spacing) {
p.x = firstPoint.x;
p.y += spacing;
g2d.setColor(stripColor);
g2d.fillRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing
- p.x, stripSize);
g2d.setColor(stripColor.darker());
g2d.drawRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing
- p.x, stripSize);
while (p.x < secondPoint.x - spacing - holeSize) {
p.x += spacing;
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
g2d.setColor(stripColor.darker());
g2d.drawOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
}
}
} else {
while (p.x < secondPoint.x - spacing) {
p.x += spacing;
p.y = firstPoint.y;
g2d.setColor(stripColor);
g2d.fillRect(p.x - stripSize / 2, p.y + spacing / 2, stripSize, secondPoint.y
- spacing - p.y);
g2d.setColor(stripColor.darker());
g2d.drawRect(p.x - stripSize / 2, p.y + spacing / 2, stripSize, secondPoint.y
- spacing - p.y);
while (p.y < secondPoint.y - spacing - holeSize) {
p.y += spacing;
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
g2d.setColor(stripColor.darker());
g2d.drawOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
}
}
}
g2d.setComposite(oldComposite);
super.drawCoordinates(g2d, spacing);
}
}
@EditableProperty(name = "Strip color")
public Color getStripColor() {
return stripColor;
}
public void setStripColor(Color padColor) {
this.stripColor = padColor;
}
@EditableProperty
public Size getSpacing() {
return spacing;
}
public void setSpacing(Size spacing) {
this.spacing = spacing;
}
@EditableProperty
public OrientationHV getOrientation() {
return orientation;
}
public void setOrientation(OrientationHV orientation) {
this.orientation = orientation;
}
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(BOARD_COLOR);
g2d.fillRect(2, 2, width - 4, height - 4);
g2d.setColor(BORDER_COLOR);
g2d.drawRect(2, 2, width - 4, height - 4);
g2d.setColor(STRIP_COLOR);
g2d.fillRect(4, width / 4, width - 8, width / 2);
g2d.setColor(STRIP_COLOR.darker());
g2d.drawRect(4, width / 4, width - 8, width / 2);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(width / 3 - 2, width / 2 - 2, 5, 5);
g2d.fillOval(2 * width / 3 - 2, width / 2 - 2, 5, 5);
g2d.setColor(STRIP_COLOR.darker());
g2d.drawOval(width / 3 - 2, width / 2 - 2, 5, 5);
g2d.drawOval(2 * width / 3 - 2, width / 2 - 2, 5, 5);
}
}
@@ -1,15 +0,0 @@
package org.diylc.components.connectivity;
public enum AWG {
_8, _10, _12, _14, _16, _18, _20, _22, _24, _26, _28, _30;
@Override
public String toString() {
return "#" + name().replace("_", "");
}
public int getValue() {
return Integer.parseInt(name().replace("_", ""));
}
}
@@ -1,123 +0,0 @@
package org.diylc.components.connectivity;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Shape;
import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
@ComponentDescriptor(name = "Copper Trace", author = "Branislav Stojkovic", category = "Connectivity", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "Trace", description = "Straight copper trace", zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW)
public class CopperTrace extends AbstractLeadedComponent<Void> {
private static final long serialVersionUID = 1L;
public static Size THICKNESS = new Size(1d, SizeUnit.mm);
public static Color COLOR = Color.black;
private Color leadColor = COLOR;
private Size thickness = THICKNESS;
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(3));
g2d.setColor(COLOR);
g2d.drawLine(1, height - 2, width - 2, 1);
}
@Override
protected Color getLeadColor(ComponentState componentState) {
return componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : leadColor;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.WHEN_SELECTED;
}
@EditableProperty(name = "Color")
public Color getLeadColor() {
return leadColor;
}
public void setLeadColor(Color leadColor) {
this.leadColor = leadColor;
}
@EditableProperty(name = "Width")
public Size getThickness() {
return thickness;
}
public void setThickness(Size thickness) {
this.thickness = thickness;
}
@Override
protected int getLeadThickness() {
return (int) getThickness().convertToPixels();
}
@Override
protected boolean shouldShadeLeads() {
return false;
}
public Color getBodyColor() {
return super.getBodyColor();
}
@Override
public Color getBorderColor() {
return super.getBorderColor();
}
@Override
public Byte getAlpha() {
return super.getAlpha();
}
@Override
public Size getLength() {
return super.getLength();
}
@Override
public Size getWidth() {
return super.getWidth();
}
@Override
public Void getValue() {
return null;
}
@Override
public void setValue(Void value) {
}
@Override
protected Shape getBodyShape() {
return null;
}
@Override
protected Size getDefaultWidth() {
return null;
}
@Override
protected Size getDefaultLength() {
return null;
}
}
@@ -1,69 +0,0 @@
package org.diylc.components.connectivity;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.CubicCurve2D;
import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractCurvedComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
@ComponentDescriptor(name = "Curved Trace", author = "Branislav Stojkovic", category = "Connectivity", instanceNamePrefix = "Trace", description = "Curved copper trace with two control points", zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW)
public class CurvedTrace extends AbstractCurvedComponent<Void> {
private static final long serialVersionUID = 1L;
public static Color COLOR = Color.black;
public static Size SIZE = new Size(1d, SizeUnit.mm);
protected Size size = SIZE;
@Override
protected Color getDefaultColor() {
return COLOR;
}
@Override
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
int thickness = (int) size.convertToPixels();
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
Color curveColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color;
g2d.setColor(curveColor);
g2d.draw(curve);
}
@EditableProperty(name = "Width")
public Size getThickness() {
return size;
}
public void setThickness(Size size) {
this.size = size;
}
@Override
public Void getValue() {
return null;
}
@Override
public void setValue(Void value) {
}
@Override
public Byte getAlpha() {
return super.getAlpha();
}
@Override
public void setAlpha(Byte alpha) {
super.setAlpha(alpha);
}
}
@@ -1,140 +0,0 @@
package org.diylc.components.connectivity;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import org.diylc.components.AbstractComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Eyelet", category = "Connectivity", author = "Branislav Stojkovic", description = "Eyelet or turret terminal", instanceNamePrefix = "Eyelet", stretchable = false, zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME)
public class Eyelet extends AbstractComponent<String> {
private static final long serialVersionUID = 1L;
public static Size SIZE = new Size(0.2d, SizeUnit.in);
public static Size HOLE_SIZE = new Size(0.1d, SizeUnit.in);
public static Color COLOR = Color.decode("#C3E4ED");
private Size size = SIZE;
private Size holeSize = HOLE_SIZE;
private Color color = COLOR;
private Point point = new Point(0, 0);
private String value = "";
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
if (checkPointsClipped(g2d.getClip())) {
return;
}
int diameter = getClosestOdd((int) size.convertToPixels());
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
g2d.setColor(color);
g2d.fillOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color.darker());
g2d.drawOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(point.x - holeDiameter / 2, point.y - holeDiameter / 2, holeDiameter,
holeDiameter);
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color.darker());
g2d.drawOval(point.x - holeDiameter / 2, point.y - holeDiameter / 2, holeDiameter,
holeDiameter);
}
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
int diameter = getClosestOdd(width / 2);
int holeDiameter = 5;
g2d.setColor(COLOR);
g2d.fillOval((width - diameter) / 2, (height - diameter) / 2, diameter, diameter);
g2d.setColor(COLOR.darker());
g2d.drawOval((width - diameter) / 2, (height - diameter) / 2, diameter, diameter);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval((width - holeDiameter) / 2, (height - holeDiameter) / 2, holeDiameter,
holeDiameter);
g2d.setColor(COLOR.darker());
g2d.drawOval((width - holeDiameter) / 2, (height - holeDiameter) / 2, holeDiameter,
holeDiameter);
}
@EditableProperty
public Size getSize() {
return size;
}
public void setSize(Size size) {
this.size = size;
}
@EditableProperty(name = "Hole size")
public Size getHoleSize() {
return holeSize;
}
public void setHoleSize(Size holeSize) {
this.holeSize = holeSize;
}
@Override
public String getName() {
return super.getName();
}
@Override
public int getControlPointCount() {
return 1;
}
@Override
public boolean isControlPointSticky(int index) {
return true;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.NEVER;
}
@Override
public Point getControlPoint(int index) {
return point;
}
@Override
public void setControlPoint(Point point, int index) {
this.point.setLocation(point);
}
@EditableProperty(name = "Color")
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
@Override
@EditableProperty
public String getValue() {
return value;
}
@Override
public void setValue(String value) {
this.value = value;
}
}
@@ -1,68 +0,0 @@
package org.diylc.components.connectivity;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.CubicCurve2D;
import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractCurvedComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Hookup Wire", author = "Branislav Stojkovic", category = "Connectivity", instanceNamePrefix = "W", description = "Flexible wire with two control points", zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.NEVER_SHOW)
public class HookupWire extends AbstractCurvedComponent<Void> {
private static final long serialVersionUID = 1L;
public static Color COLOR = Color.green;
public static double INSULATION_THICKNESS_PCT = 0.3;
protected AWG gauge = AWG._22;
@Override
protected Color getDefaultColor() {
return COLOR;
}
@Override
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d,
ComponentState componentState) {
int thickness = (int) (Math.pow(Math.E, -1.12436 - 0.11594
* gauge.getValue())
* Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT));
Color curveColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: color.darker();
g2d.setColor(curveColor);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
g2d.draw(curve);
if (componentState == ComponentState.NORMAL) {
g2d.setColor(color);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(
thickness - 2));
g2d.draw(curve);
}
}
@EditableProperty(name = "AWG")
public AWG getGauge() {
return gauge;
}
public void setGauge(AWG gauge) {
this.gauge = gauge;
}
@Override
public Void getValue() {
return null;
}
@Override
public void setValue(Void value) {
}
}
@@ -1,98 +0,0 @@
package org.diylc.components.connectivity;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Shape;
import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Connectivity", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "J", description = "", zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.NEVER_SHOW)
public class Jumper extends AbstractLeadedComponent<Void> {
private static final long serialVersionUID = 1L;
public static Color COLOR = Color.blue;
private Color color = COLOR;
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(3));
g2d.setColor(COLOR.darker());
g2d.drawLine(1, height - 2, width - 2, 1);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.setColor(COLOR);
g2d.drawLine(1, height - 2, width - 2, 1);
}
@Override
public Color getLeadColor(ComponentState componentState) {
return componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color;
}
@EditableProperty
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public Color getBodyColor() {
return super.getBodyColor();
}
@Override
public Color getBorderColor() {
return super.getBorderColor();
}
@Override
public Byte getAlpha() {
return super.getAlpha();
}
@Override
public Size getLength() {
return super.getLength();
}
@Override
public Size getWidth() {
return super.getWidth();
}
@Override
public Void getValue() {
return null;
}
@Override
public void setValue(Void value) {
}
@Override
protected Shape getBodyShape() {
return null;
}
@Override
protected Size getDefaultWidth() {
return null;
}
@Override
protected Size getDefaultLength() {
return null;
}
}
@@ -1,106 +0,0 @@
package org.diylc.components.connectivity;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Shape;
import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@ComponentDescriptor(name = "Line", author = "Branislav Stojkovic", category = "Connectivity", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "LN", description = "", zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.NEVER_SHOW)
public class Line extends AbstractLeadedComponent<Void> {
private static final long serialVersionUID = 1L;
public static Color COLOR = Color.black;
private Color color = COLOR;
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.setColor(COLOR);
g2d.drawLine(1, height - 2, width - 2, 1);
}
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.setColor(color);
g2d.drawLine(getControlPoint(0).x, getControlPoint(0).y, getControlPoint(1).x,
getControlPoint(1).y);
}
@Override
public Color getLeadColor(ComponentState componentState) {
return componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color;
}
@EditableProperty
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public Color getBodyColor() {
return super.getBodyColor();
}
@Override
public Color getBorderColor() {
return super.getBorderColor();
}
@Override
public Byte getAlpha() {
return super.getAlpha();
}
@Override
public Size getLength() {
return super.getLength();
}
@Override
public Size getWidth() {
return super.getWidth();
}
@Override
public Void getValue() {
return null;
}
@Override
public void setValue(Void value) {
}
@Override
protected Shape getBodyShape() {
return null;
}
@Override
protected Size getDefaultWidth() {
return null;
}
@Override
protected Size getDefaultLength() {
return null;
}
}
@@ -1,152 +0,0 @@
package org.diylc.components.connectivity;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import org.diylc.components.AbstractComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Solder Pad", category = "Connectivity", author = "Branislav Stojkovic", description = "test", instanceNamePrefix = "Pad", stretchable = false, zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.NEVER_SHOW)
public class SolderPad extends AbstractComponent<Void> {
private static final long serialVersionUID = 1L;
public static Size SIZE = new Size(0.09d, SizeUnit.in);
public static Size HOLE_SIZE = new Size(0.8d, SizeUnit.mm);
public static Color COLOR = Color.black;
private Size size = SIZE;
private Color color = COLOR;
private Point point = new Point(0, 0);
private Type type = Type.ROUND;
private Size holeSize = HOLE_SIZE;
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
if (checkPointsClipped(g2d.getClip())) {
return;
}
int diameter = getClosestOdd((int) getSize().convertToPixels());
int holeDiameter = getClosestOdd((int) getHoleSize().convertToPixels());
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color);
if (type == Type.ROUND) {
g2d.fillOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
} else {
g2d.fillRect(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
}
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(point.x - holeDiameter / 2, point.y - holeDiameter / 2, holeDiameter,
holeDiameter);
}
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
int diameter = getClosestOdd(width / 2);
int holeDiameter = 5;
g2d.setColor(COLOR);
g2d.fillOval((width - diameter) / 2, (height - diameter) / 2, diameter, diameter);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval((width - holeDiameter) / 2, (height - holeDiameter) / 2, holeDiameter,
holeDiameter);
}
@EditableProperty
public Size getSize() {
return size;
}
public void setSize(Size size) {
this.size = size;
}
@EditableProperty(name = "Hole")
public Size getHoleSize() {
if (holeSize == null) {
holeSize = HOLE_SIZE;
}
return holeSize;
}
public void setHoleSize(Size holeSize) {
this.holeSize = holeSize;
}
@Override
public String getName() {
return super.getName();
}
@Override
public int getControlPointCount() {
return 1;
}
@Override
public boolean isControlPointSticky(int index) {
return true;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.NEVER;
}
@Override
public Point getControlPoint(int index) {
return point;
}
@Override
public void setControlPoint(Point point, int index) {
this.point.setLocation(point);
}
@EditableProperty(name = "Color")
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
@EditableProperty
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
@Override
public Void getValue() {
return null;
}
@Override
public void setValue(Void value) {
}
static enum Type {
ROUND, SQUARE;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
}
@@ -1,133 +0,0 @@
package org.diylc.components.connectivity;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.BomPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
@ComponentDescriptor(name = "Trace Cut", category = "Connectivity", author = "Branislav Stojkovic", description = "Designates the place where a trace on the vero board needs to be cut", instanceNamePrefix = "Cut", stretchable = false, zOrder = IDIYComponent.BOARD + 1, bomPolicy = BomPolicy.NEVER_SHOW)
public class TraceCut extends AbstractComponent<Void> {
private static final long serialVersionUID = 1L;
public static Size SIZE = new Size(0.07d, SizeUnit.in);
public static Color FILL_COLOR = Color.white;
public static Color BORDER_COLOR = Color.red;
public static Color SELECTION_COLOR = Color.blue;
private Size size = SIZE;
private Color fillColor = FILL_COLOR;
private Color borderColor = BORDER_COLOR;
protected Point point = new Point(0, 0);
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
if (checkPointsClipped(g2d.getClip())) {
return;
}
int size = getClosestOdd((int) this.size.convertToPixels());
int dotDiameter = size - 6;
g2d.setColor(fillColor);
g2d.fillRect(point.x - size / 2, point.y - size / 2, size, size);
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.drawRect(point.x - size / 2, point.y - size / 2, size, size);
g2d
.fillOval(point.x - dotDiameter / 2, point.y - dotDiameter / 2, dotDiameter,
dotDiameter);
}
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
int size = 16;
int dotDiameter = size / 4 * 2;
g2d.setColor(FILL_COLOR);
g2d.fillRect((width - size) / 2, (height - size) / 2, size, size);
g2d.setColor(BORDER_COLOR);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.drawRect((width - size) / 2, (height - size) / 2, size, size);
g2d.fillOval((width - dotDiameter) / 2, (height - dotDiameter) / 2, dotDiameter,
dotDiameter);
}
@Override
public int getControlPointCount() {
return 1;
}
@Override
public Point getControlPoint(int index) {
return point;
}
@Override
public boolean isControlPointSticky(int index) {
return false;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.NEVER;
}
@Override
public void setControlPoint(Point point, int index) {
this.point.setLocation(point);
}
@Override
public Void getValue() {
return null;
}
@Override
public void setValue(Void value) {
}
@EditableProperty
public Size getSize() {
return size;
}
public void setSize(Size size) {
this.size = size;
}
@EditableProperty(name = "Fill")
public Color getFillColor() {
return fillColor;
}
public void setFillColor(Color fillColor) {
this.fillColor = fillColor;
}
@EditableProperty(name = "Border")
public Color getBorderColor() {
return borderColor;
}
public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}
@Override
public String getName() {
return super.getName();
}
}
@@ -1,252 +0,0 @@
package org.diylc.components.electromechanical;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
import org.diylc.appframework.miscutils.ConfigurationManager;
import org.diylc.common.IPlugInPort;
import org.diylc.common.ObjectCache;
import org.diylc.common.Orientation;
import org.diylc.components.AbstractTransparentComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "9V Battery Snap", category = "Electromechanical", author = "Branislav Stojkovic", description = "", stretchable = false, zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "BTR")
public class BatterySnap9V extends AbstractTransparentComponent<String> {
private static final long serialVersionUID = 1L;
private static Color BODY_COLOR = Color.darkGray;
private static Size WIDTH = new Size(0.5d, SizeUnit.in);
private static Size LENGTH = new Size(0.75d, SizeUnit.in);
private static Size TERMINAL_DIAMETER = new Size(0.3d, SizeUnit.in);
private static Size TERMINAL_SPACING = new Size(0.5d, SizeUnit.in);
private static Size TERMINAL_BORDER = new Size(0.7d, SizeUnit.mm);
private String value = "";
private Point controlPoint = new Point(0, 0);
transient Shape[] body;
private Orientation orientation = Orientation.DEFAULT;
private Color color = BODY_COLOR;
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
Project project, IDrawingObserver drawingObserver) {
Shape[] body = getBody();
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
if (componentState != ComponentState.DRAGGING) {
Composite oldComposite = g2d.getComposite();
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : color);
g2d.fill(body[0]);
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : METAL_COLOR);
g2d.fill(body[1]);
g2d.fill(body[2]);
g2d.setComposite(oldComposite);
}
Color finalBorderColor;
if (outlineMode) {
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
finalBorderColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : theme
.getOutlineColor();
} else {
finalBorderColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color
.brighter();
}
g2d.setColor(finalBorderColor);
g2d.draw(body[0]);
g2d.setColor(METAL_COLOR.darker());
g2d.draw(body[1]);
g2d.setColor(METAL_COLOR.darker());
g2d.draw(body[2]);
}
public Shape[] getBody() {
if (body == null) {
body = new Shape[3];
int x = controlPoint.x;
int y = controlPoint.y;
int width = (int) WIDTH.convertToPixels();
int length = (int) LENGTH.convertToPixels();
int totalLength = length + width / 2;
int terminalDiameter = (int) TERMINAL_DIAMETER.convertToPixels();
int terminalSpacing = (int) TERMINAL_SPACING.convertToPixels();
int terminalBorder = (int) TERMINAL_BORDER.convertToPixels();
Area mainArea = new Area(new Rectangle2D.Double(x, y - width / 2, length, width));
mainArea.add(new Area(new Ellipse2D.Double(x + length - width / 2, y - width / 2,
width, width)));
body[0] = mainArea;
Area terminalArea = new Area(new Ellipse2D.Double(x + (totalLength - terminalSpacing)
/ 2 - terminalDiameter / 2, y - terminalDiameter / 2, terminalDiameter,
terminalDiameter));
int centerX = x + (totalLength + terminalSpacing) / 2;
int[] terminalX = new int[6];
int[] terminalY = new int[6];
for (int i = 0; i < 6; i++) {
terminalX[i] = (int) (centerX + Math.cos(Math.PI / 3 * i) * terminalDiameter / 2);
terminalY[i] = (int) (y + Math.sin(Math.PI / 3 * i) * terminalDiameter / 2);
}
terminalArea.add(new Area(new Polygon(terminalX, terminalY, 6)));
body[1] = terminalArea;
terminalArea = new Area(new Ellipse2D.Double(x + (totalLength - terminalSpacing) / 2
- terminalDiameter / 2 + terminalBorder, y - terminalDiameter / 2
+ terminalBorder, terminalDiameter - 2 * terminalBorder, terminalDiameter - 2
* terminalBorder));
for (int i = 0; i < 6; i++) {
terminalX[i] = (int) (centerX + Math.cos(Math.PI / 3 * i)
* (terminalDiameter / 2 + terminalBorder));
terminalY[i] = (int) (y + Math.sin(Math.PI / 3 * i)
* (terminalDiameter / 2 + terminalBorder));
}
terminalArea.add(new Area(new Polygon(terminalX, terminalY, 6)));
body[2] = terminalArea;
// Rotate if needed
if (orientation != Orientation.DEFAULT) {
double theta = 0;
switch (orientation) {
case _90:
theta = Math.PI / 2;
break;
case _180:
theta = Math.PI;
break;
case _270:
theta = Math.PI * 3 / 2;
break;
}
AffineTransform rotation = AffineTransform.getRotateInstance(theta, x, y);
for (Shape shape : body) {
Area area = (Area) shape;
area.transform(rotation);
}
}
}
return body;
}
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(BODY_COLOR);
g2d.fillOval(width / 4, width / 32, width / 2, width / 2);
g2d.setColor(BODY_COLOR.darker());
g2d.drawOval(width / 4, width / 32, width / 2, width / 2);
g2d.setColor(BODY_COLOR);
g2d.fillRect(width / 4, width / 32 + width / 4, width / 2, width * 3 / 4 - 2 * width / 32);
g2d.setColor(BODY_COLOR.darker());
g2d.drawRect(width / 4, width / 32 + width / 4, width / 2, width * 3 / 4 - 2 * width / 32);
g2d.setColor(METAL_COLOR);
g2d.fillOval(width / 4 + 3 * width / 32, width / 32 + 3 * width / 32, width / 2 - 6 * width
/ 32, width / 2 - 6 * width / 32);
int centerX = width / 2;
int centerY = height * 7 / 9;
int terminalDiameter = width / 2 - 4 * width / 32;
int[] terminalX = new int[6];
int[] terminalY = new int[6];
for (int i = 0; i < 6; i++) {
terminalX[i] = (int) (centerX + Math.cos(Math.PI / 3 * i) * terminalDiameter / 2);
terminalY[i] = (int) (centerY + Math.sin(Math.PI / 3 * i) * terminalDiameter / 2);
}
g2d.fillPolygon(terminalX, terminalY, 6);
g2d.setColor(METAL_COLOR.darker());
g2d.drawOval(width / 4 + 3 * width / 32, width / 32 + 3 * width / 32, width / 2 - 6 * width
/ 32, width / 2 - 6 * width / 32);
g2d.drawPolygon(terminalX, terminalY, 6);
}
@Override
public int getControlPointCount() {
return 1;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.WHEN_SELECTED;
}
@Override
public boolean isControlPointSticky(int index) {
return true;
}
@Override
public Point getControlPoint(int index) {
return controlPoint;
}
@Override
public void setControlPoint(Point point, int index) {
this.controlPoint.setLocation(point);
// Invalidate the body
body = null;
}
@Override
public String getValue() {
return value;
}
@Override
public void setValue(String value) {
this.value = value;
}
@EditableProperty
public Orientation getOrientation() {
return orientation;
}
public void setOrientation(Orientation orientation) {
this.orientation = orientation;
// Invalidate the body
body = null;
}
@EditableProperty
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
}

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