Compare commits

...

160 Commits

Author SHA1 Message Date
Bane Stojkovic 00c8c23abb Create swing-framework-1.1.jar 2025-04-02 22:19:23 +02:00
Bane Stojkovic 4f048ec15e Merge branch 'master' into feature/multimeter3 2025-04-02 22:17:27 +02:00
Bane Stojkovic f02cf543a0 Create component_types.sql 2025-04-02 22:17:15 +02:00
Bane Stojkovic f69c9459f5 Fixed Windows ZIP package issue with the bundled JRE 2025-04-02 22:14:36 +02:00
Branislav Stojkovic b468564821 knowledge data 2025-04-02 10:54:23 +02:00
Branislav Stojkovic 5bbd7c8ab3 knowledge data 2025-04-02 10:50:31 +02:00
Bane Stojkovic 58e28a95fd Board underside display does not work if there's a Label or PCB Text component on the board 2025-03-30 23:46:13 +02:00
Bane Stojkovic baaeefdbab Added ability control if the board underside display should render as transparent or not 2025-03-30 13:18:08 +02:00
Bane Stojkovic a5f6299de7 Update pom.xml 2025-03-29 22:56:30 +01:00
Bane Stojkovic 1d36394af0 Added a 'Save' button to all analysis screens which saves results of a circuit analysis to an HTML file 2025-03-29 22:45:06 +01:00
Bane Stojkovic aec12898bf fix tests 2025-03-29 22:30:24 +01:00
Bane Stojkovic b4c1ed74c2 switch fixes 2025-03-29 22:17:21 +01:00
Branislav Stojkovic e17b79a2c4 Applying a variant to a 'Hookup Wire' or 'Curved Trace' makes it lose its shape 2025-03-28 16:26:51 +01:00
Bane Stojkovic 34054a68f1 switch enhancements 2025-03-27 23:48:22 +01:00
Bane Stojkovic 5052e10f0e fix rotation 2025-03-27 23:32:31 +01:00
Bane Stojkovic 8c9a8e71dc show markers for lever switch 2025-03-27 22:55:32 +01:00
Bane Stojkovic 3b2dfb075f show markers for rotary switch 2025-03-27 22:55:22 +01:00
Bane Stojkovic 655df8c9db Copy operation doesn't work when certain component types are selected 2025-03-27 22:44:37 +01:00
Bane Stojkovic 52a8935b1f Merge branch 'master' into feature/multimeter3 2025-03-27 19:30:16 +01:00
Bane Stojkovic e3ff80532d fix windows 2025-03-27 19:25:32 +01:00
Bane Stojkovic 0fb0502dea build updates 2025-03-27 19:19:25 +01:00
Bane Stojkovic b3ad9cc0d9 show markers 2025-03-27 19:18:43 +01:00
Bane Stojkovic 8de5b24809 fix exes 2025-03-27 18:26:52 +01:00
Bane Stojkovic 2ca578b707 update win exes 2025-03-27 18:20:46 +01:00
Bane Stojkovic 8267d17ff7 Update SchallerMegaSwitch.java 2025-03-26 22:07:19 +01:00
Bane Stojkovic 96d7f55e84 Extract 'Analyze' menu, move 'Highlight Connected Areas' feature from 'Config' menu to 'Analyze' menu 2025-03-26 22:07:15 +01:00
Bane Stojkovic a8d266f561 add highlighting for open rotary switch 2025-03-26 20:43:16 +01:00
Bane Stojkovic b57b36141f Update MiniToggleSwitch.java 2025-03-26 18:45:16 +01:00
Bane Stojkovic 0368cc404e Update update.xml 2025-03-26 18:40:57 +01:00
Bane Stojkovic 220b648c56 add mini toggle switch highlighting 2025-03-26 18:39:56 +01:00
Bane Stojkovic 733c293be6 add UIScalingUtil 2025-03-26 18:15:02 +01:00
Bane Stojkovic 77cebc3911 netlist analyzer enhancements 2025-03-26 18:04:47 +01:00
Bane Stojkovic 3a5f4bdb67 build updates 2025-03-26 18:03:06 +01:00
Branislav Stojkovic ed11ec22a6 Merge branch 'master' into feature/multimeter3 2025-03-25 13:18:37 +01:00
Branislav Stojkovic a4bcbcc761 fix gray theme 2025-03-25 12:50:01 +01:00
Branislav Stojkovic 803caa706f fix build 2025-03-25 09:44:37 +01:00
Branislav Stojkovic 27263e9443 fix build 2025-03-25 09:41:52 +01:00
Bane Stojkovic c1812e9b70 fix resource loading 2025-03-24 21:09:19 +01:00
Bane Stojkovic 4811d009b5 fix version printer 2025-03-24 20:55:51 +01:00
Bane Stojkovic b001019c0c Merge pull request #892 from bancika/feature/mirror2
Feature/mirror2
2025-03-24 20:50:45 +01:00
Bane Stojkovic 5ea6193768 release 2025-03-24 20:47:20 +01:00
Bane Stojkovic 3b987e2b16 tools 2025-03-24 20:47:12 +01:00
Bane Stojkovic b7d482cfcf fix tests 2025-03-24 20:47:06 +01:00
Bane Stojkovic 449bce435f fix tests 2025-03-24 12:05:47 +01:00
Bane Stojkovic eafb4b1307 refactor resources 2025-03-24 11:29:18 +01:00
Bane Stojkovic 5e70bbe898 build for linux 2025-03-24 11:25:28 +01:00
Bane Stojkovic cd4694c207 resource optimization 2025-03-24 11:25:12 +01:00
Bane Stojkovic 3440a48dba fix resource loading 2025-03-24 11:11:39 +01:00
Bane Stojkovic b41a073044 Merge branch 'master' into feature/mirror2 2025-03-21 23:00:35 +01:00
Branislav Stojkovic c2fe439826 Merge branch 'master' of https://github.com/bancika/diy-layout-creator 2025-03-21 12:18:26 +01:00
Branislav Stojkovic f1af933f6d up to 1gb 2025-03-21 12:18:17 +01:00
dependabot[bot] c4fb3ad305 Bump com.thoughtworks.xstream:xstream from 1.4.19 to 1.4.21 in /diylc (#895)
Bumps [com.thoughtworks.xstream:xstream](https://github.com/x-stream/xstream) from 1.4.19 to 1.4.21.
- [Release notes](https://github.com/x-stream/xstream/releases)
- [Commits](https://github.com/x-stream/xstream/commits)

---
updated-dependencies:
- dependency-name: com.thoughtworks.xstream:xstream
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-21 11:59:08 +01:00
dependabot[bot] a011a080f4 Bump junit:junit from 4.7 to 4.13.1 in /diylc (#896)
Bumps [junit:junit](https://github.com/junit-team/junit4) from 4.7 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.7...r4.13.1)

---
updated-dependencies:
- dependency-name: junit:junit
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-21 11:58:46 +01:00
Branislav Stojkovic aeea503d7e build linux 2025-03-21 11:56:03 +01:00
Branislav Stojkovic 6352dc2f0e build linux 2025-03-21 11:55:51 +01:00
Bane Stojkovic 4474b33c42 Merge branch 'master' into feature/mirror2 2025-03-20 21:50:33 +01:00
Bane Stojkovic e8a4c488e0 Merge branch 'master' into feature/multimeter3 2025-03-20 21:50:16 +01:00
Bane Stojkovic 1da5c6836b fix headless mode 2025-03-20 21:46:11 +01:00
Bane Stojkovic 538c427627 test 2025-03-20 21:40:18 +01:00
Bane Stojkovic 791a6b6bc4 Update tests.yml 2025-03-20 21:39:58 +01:00
Bane Stojkovic 198ba445e0 Update tests.yml 2025-03-20 21:36:41 +01:00
Bane Stojkovic 56cba5bd8c fix tests 2025-03-20 21:33:25 +01:00
Bane Stojkovic 8c03df4c50 Update test.yml 2025-03-20 21:28:46 +01:00
Bane Stojkovic e96c609064 Update test.yml 2025-03-20 21:27:19 +01:00
Bane Stojkovic 73da8fd7ee fix tests 2025-03-20 21:24:31 +01:00
Bane Stojkovic 14565a102a cleanup 2025-03-20 21:20:46 +01:00
Bane Stojkovic fbea6c965c Merge branch 'master' into feature/multimeter3 2025-03-20 21:16:55 +01:00
Bane Stojkovic f512263c2d Update update.xml 2025-03-20 19:58:09 +01:00
Bane Stojkovic 3ef78ec179 Merge branch 'master' into feature/mirror2 2025-03-20 19:56:17 +01:00
Bane Stojkovic 4093641b7e Refactor/maven (#889)
* mavenize

* mavenization

* mavenization

* mavenization

* mavenization

* mavenization

* mavenization

* mavenization

* mavenization

* fix

* app framework update

* fix lib

* lib

* fix mavenized

* fix mavenized

* fix mavenized

* fix mavenized

* fix mavenized

* fix mavenized

* fix mavenized

* fix mavenized

* building for win and linux

* Create run.bat

* fixes for netlist

* cleanup

* unit tests

* unit tests

* configurable high dpi

* performance upgrade

* performance upgrade

* rotate bug

* Omit boards, wires, traces, terminals, etc from Spice netlist output

* splash version update

* optimize libs

* optimize libs

* updates

* mac build maven

* ruler optimization, moved images

* cleanup

* notarization

* test workflow

* build

* Update pom.xml

* Update pom.xml

* Create README.md

* Create test.yml

* maven

* build
2025-03-20 19:44:40 +01:00
Branislav Stojkovic 57594af69d tests 2025-03-19 15:04:54 +01:00
Branislav Stojkovic 42207f3bbf Merge branch 'master' into feature/mirror2 2025-03-19 15:02:15 +01:00
Branislav Stojkovic ccb98d1953 tests 2025-03-19 15:02:03 +01:00
Branislav Stojkovic 5aff6a8c56 Merge branch 'master' into feature/mirror2 2025-03-19 14:57:36 +01:00
Branislav Stojkovic 37bcceac2c test workflow 2025-03-19 14:52:58 +01:00
Branislav Stojkovic 4a35499cf4 test workflow 2025-03-19 14:51:30 +01:00
Branislav Stojkovic 121656bca7 test workflow 2025-03-19 14:49:10 +01:00
Branislav Stojkovic 0c4b433005 test workflow 2025-03-19 14:46:53 +01:00
Branislav Stojkovic c5293da570 test workflow 2025-03-19 14:44:21 +01:00
Bane Stojkovic d545b895d6 Update update.xml 2025-03-18 23:04:24 +01:00
Bane Stojkovic e54cfa502a 'Mini Toggle Switch' ends up misaligned after rotating together with other components 2025-03-18 22:47:58 +01:00
Bane Stojkovic add6bae018 fixes 2025-03-18 22:19:41 +01:00
Bane Stojkovic a5a4a3632f refactor 2025-03-18 22:12:52 +01:00
Bane Stojkovic f6863fb628 cleanup 2025-03-18 22:03:28 +01:00
Bane Stojkovic 9d1479cd82 Update update.xml 2025-03-18 21:59:56 +01:00
Bane Stojkovic 753b8bff8d improve icon rendering 2025-03-18 21:58:54 +01:00
Bane Stojkovic a2686ae7a0 Ctrl+X (Command+X) doesn't work because 'Project Explorer' steals the focus on X key press 2025-03-18 21:09:25 +01:00
Bane Stojkovic a1c27ef1b2 transparency for traces 2025-03-18 20:59:51 +01:00
Bane Stojkovic f79ba92013 Merge branch 'refactor/maven' into feature/mirror2 2025-03-18 20:19:24 +01:00
Bane Stojkovic 6801f9b51b Merge branch 'refactor/maven' into feature/multimeter3 2025-03-18 20:19:08 +01:00
Bane Stojkovic 8d1be10545 cleanup 2025-03-18 20:18:55 +01:00
Bane Stojkovic 4203ffa9ec Merge branch 'refactor/maven' into feature/multimeter3 2025-03-18 20:18:23 +01:00
Bane Stojkovic 774ce9b2db Merge branch 'refactor/maven' into feature/mirror2 2025-03-18 20:16:40 +01:00
Bane Stojkovic 31ee2b93c3 ruler optimization, moved images 2025-03-18 19:56:03 +01:00
Bane Stojkovic f0ed0275cf mac build maven 2025-03-17 23:42:05 +01:00
Bane Stojkovic 90816bebeb Update update.xml 2025-03-17 22:54:23 +01:00
Bane Stojkovic 2835129cd8 Merge branch 'refactor/maven' into feature/mirror2 2025-03-17 22:53:03 +01:00
Bane Stojkovic 8b2f39c165 Merge branch 'refactor/maven' into feature/multimeter3 2025-03-17 22:52:47 +01:00
Bane Stojkovic b3568b3ec9 updates 2025-03-17 22:51:50 +01:00
Bane Stojkovic 2b5674c44a Merge branch 'refactor/maven' of https://github.com/bancika/diy-layout-creator into refactor/maven 2025-03-17 22:34:29 +01:00
Bane Stojkovic 222050d826 optimize libs 2025-03-17 22:34:24 +01:00
Bane Stojkovic 4ba2b3d250 optimize libs 2025-03-17 22:34:07 +01:00
Bane Stojkovic 9e916370ee splash version update 2025-03-17 20:27:20 +01:00
Branislav Stojkovic f06bd0d49c Omit boards, wires, traces, terminals, etc from Spice netlist output 2025-03-17 16:08:02 +01:00
Branislav Stojkovic 521301d7ef rotate bug 2025-03-17 14:45:45 +01:00
Branislav Stojkovic 84dddcecdf Merge branch 'refactor/maven' into feature/multimeter3 2025-03-17 12:15:22 +01:00
Branislav Stojkovic be63f10ef4 Merge branch 'refactor/maven' into feature/mirror2 2025-03-17 12:14:40 +01:00
Branislav Stojkovic 6ef712b3e5 performance upgrade 2025-03-17 12:10:05 +01:00
Branislav Stojkovic 2ead5592d8 performance upgrade 2025-03-17 12:05:26 +01:00
Branislav Stojkovic 44c776194f configurable high dpi 2025-03-17 11:08:51 +01:00
Bane Stojkovic 8ddb685d9d Update README.md 2025-03-17 10:09:02 +01:00
Bane Stojkovic fbf92fbc6e unit tests 2025-03-16 23:55:05 +01:00
Bane Stojkovic fe51620138 unit tests 2025-03-16 23:45:14 +01:00
Bane Stojkovic a86af6384b slide switch highlighting 2025-03-16 23:22:34 +01:00
Bane Stojkovic 896a623c7c refactor 2025-03-16 22:36:24 +01:00
Bane Stojkovic 1c48d7c31f add freeway switch 2025-03-16 22:34:57 +01:00
Bane Stojkovic 3fcc9091a7 Megaswitch highlighting 2025-03-16 20:54:47 +01:00
Bane Stojkovic f925093c80 fixed dynamic loading 2025-03-16 20:37:10 +01:00
Bane Stojkovic 473630a5e8 cleanup 2025-03-15 23:45:15 +01:00
Bane Stojkovic 2c642337b4 palette adjjstment 2025-03-15 23:36:01 +01:00
Bane Stojkovic 9d8555c4b7 switch position display 2025-03-15 23:29:47 +01:00
Branislav Stojkovic 5c745d2d45 mirror 2025-03-14 14:06:14 +01:00
Branislav Stojkovic ccf5d20713 mirror 2025-03-14 11:23:56 +01:00
Branislav Stojkovic 74f43159c4 unit tests 2025-03-13 15:21:46 +01:00
Branislav Stojkovic a0b27de187 fixes for ascii 2025-03-12 16:25:17 +01:00
Branislav Stojkovic 9230d709b4 fixes for ascii 2025-03-12 15:59:22 +01:00
Branislav Stojkovic 823dcc431c fixes for ascii 2025-03-12 15:46:52 +01:00
Branislav Stojkovic ede2a000d4 fixes for ascii 2025-03-12 15:27:23 +01:00
Branislav Stojkovic c65ecc10bf fixes for ascii 2025-03-12 15:23:33 +01:00
Branislav Stojkovic 858cab4ab4 fixes for ascii 2025-03-12 15:05:37 +01:00
Branislav Stojkovic 39ba93ff2c fix mavenized 2025-03-12 11:11:59 +01:00
Bane Stojkovic eadcb8d81e Merge branch 'refactor/maven' into feature/multimeter3 2025-03-11 23:59:49 +01:00
Bane Stojkovic 08ca6cef4e cleanup 2025-03-11 23:59:31 +01:00
Bane Stojkovic 6e919714d3 merged changes 2025-03-11 23:42:56 +01:00
Bane Stojkovic f966f8873a fixes for netlist 2025-03-11 23:18:36 +01:00
Bane Stojkovic eedc370a6e Create run.bat 2025-03-11 20:27:00 +01:00
Bane Stojkovic e6427cbec7 building for win and linux 2025-03-11 20:25:12 +01:00
Branislav Stojkovic aa8ca75d5a fix mavenized 2025-03-11 16:57:11 +01:00
Branislav Stojkovic 9f053f5dfa fix mavenized 2025-03-11 15:14:59 +01:00
Branislav Stojkovic 05d056700d fix mavenized 2025-03-11 15:04:10 +01:00
Branislav Stojkovic fce99fcdc0 Merge branch 'refactor/maven' of https://github.com/bancika/diy-layout-creator into refactor/maven 2025-03-11 15:03:56 +01:00
Branislav Stojkovic 83b1e02086 fix mavenized 2025-03-11 15:03:46 +01:00
Branislav Stojkovic ee11b5ffe4 fix mavenized 2025-03-11 15:03:09 +01:00
Branislav Stojkovic 344e85e6f7 fix mavenized 2025-03-11 12:59:08 +01:00
Branislav Stojkovic e088b5e8c9 fix mavenized 2025-03-11 12:18:00 +01:00
Branislav Stojkovic 0417947289 fix mavenized 2025-03-11 10:37:21 +01:00
Bane Stojkovic fcfecd33cd lib 2025-03-11 10:08:27 +01:00
Bane Stojkovic 54ba75f306 fix lib 2025-03-11 09:29:01 +01:00
Bane Stojkovic ad43994d8f Merge branch 'refactor/maven' of https://github.com/bancika/diy-layout-creator into refactor/maven 2025-03-11 09:20:06 +01:00
Bane Stojkovic 76071e8c1e app framework update 2025-03-11 09:20:04 +01:00
Bane Stojkovic 29dc9b97b7 fix 2025-03-10 22:17:06 +01:00
Branislav Stojkovic bc428fad89 mavenization 2025-03-10 16:42:35 +01:00
Branislav Stojkovic a0e8f7411c mavenization 2025-03-10 16:30:36 +01:00
Branislav Stojkovic 16af862119 mavenization 2025-03-10 16:27:25 +01:00
Branislav Stojkovic f580aa65ee mavenization 2025-03-10 16:24:53 +01:00
Branislav Stojkovic dac2f8554a mavenization 2025-03-10 16:12:55 +01:00
Branislav Stojkovic 2caa91eb2e mavenization 2025-03-10 15:32:45 +01:00
Branislav Stojkovic 038e2bcbb4 mavenization 2025-03-10 15:30:18 +01:00
Branislav Stojkovic 6e347fd7d0 mavenization 2025-03-10 15:21:43 +01:00
Branislav Stojkovic f820c23093 mavenize 2025-03-10 13:03:51 +01:00
1283 changed files with 31966 additions and 16273 deletions
+27
View File
@@ -0,0 +1,27 @@
name: Test Build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: |
cd diylc
mvn -B test
+3
View File
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
+1 -1
View File
@@ -29,7 +29,7 @@ DIY Layout Creator (DIYLC) is a specialized software tool designed for hobbyists
<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>export PCB designs to Gerber for fabrication </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>
BIN
View File
Binary file not shown.
+149
View File
@@ -0,0 +1,149 @@
# Reference: https://github.com/github/gitignore
# From: https://gist.github.com/edesdan/6bb43343740bcd54ef0f56a384a2f66f
######################
###### Mac OS X ######
######################
# Folder view configuration files
.DS_Store
Desktop.ini
# Thumbnail cache files
._*
Thumbs.db
# Files that might appear on external disks
.Spotlight-V100
.Trashes
######################
###### Java ######
######################
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
######################
###### Gradle ######
######################
.gradle
build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Cache of project
.gradletasknamecache
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
######################
###### Intellij ######
######################
# Created by https://www.gitignore.io/api/intellij
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
# Gradle:
.idea/**/gradle.xml
.idea/**/libraries
# CMake
cmake-build-debug/
# Mongo Explorer plugin:
.idea/**/mongoSettings.xml
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
.idea/sonarlint
# End of https://www.gitignore.io/api/intellij
######################
###### Maven ######
######################
**/target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar
+16
View File
@@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="DIYLCStarter" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="org.diylc.DIYLCStarter" />
<module name="diylc-swing" />
<option name="VM_PARAMETERS" value="-Xms1024m -Xmx4096m -Dsun.java2d.uiScale=1.5 -Dorg.diylc.scriptRun=true -Dfile.encoding=UTF-8 --add-exports java.desktop/com.apple.eawt.event=ALL-UNNAMED --add-exports java.desktop/com.apple.eio=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens java.desktop/java.awt.geom=ALL-UNNAMED" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="org.diylc.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
+4
View File
@@ -0,0 +1,4 @@
{
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "interactive"
}
+1
View File
@@ -0,0 +1 @@
[![Java CI Tests](https://github.com/{owner}/{repo}/actions/workflows/tests.yml/badge.svg)](https://github.com/{owner}/{repo}/actions/workflows/tests.yml)
-20
View File
@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
<classpathentry kind="lib" path="lib/app-framework.jar"/>
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
<classpathentry kind="lib" path="lib/java-http-proxy.jar"/>
<classpathentry kind="lib" path="lib/AppleJavaExtensions.jar"/>
<classpathentry kind="lib" path="lib/xstream-1.4.19.jar"/>
<classpathentry kind="lib" path="lib/guava-31.1-jre.jar"/>
<classpathentry kind="lib" path="lib/gerber-writer-api-1.0.0.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
+6
View File
@@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
@@ -1,3 +0,0 @@
eclipse.preferences.version=1
encoding//src/org/diylc/core/measures/Resistance.java=UTF-8
encoding//src/org/diylc/core/measures/ResistanceUnit.java=UTF-8
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,5 +1,5 @@
<project name="diylc-core" basedir="." default="jar">
<property name="src.dir" value="src" />
<property name="src.dir" value="${basedir}/src/main/java" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="build.dir" value="${basedir}/build" />
-2
View File
@@ -1,2 +0,0 @@
#org.diylc.utils.Constants.CANVAS_COLOR=#005D96
#org.diylc.utils.Constants.GRID_COLOR=#FFFFFF
-89
View File
@@ -1,89 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<libelement value="jar://$MODULE_DIR$/lib/log4j-1.2.15.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/junit-4.7.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/app-framework.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jettison-1.0.1.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/xstream-1.3.1.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/java-http-proxy.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/AppleJavaExtensions.jar!/" />
<src_description expected_position="0">
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
<src_folder value="file://$MODULE_DIR$/test" expected_position="1" />
</src_description>
</component>
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="log4j-1.2.15.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/log4j-1.2.15.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="junit-4.7.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/junit-4.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="app-framework.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/app-framework.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jettison-1.0.1.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jettison-1.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="xstream-1.3.1.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/xstream-1.3.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="java-http-proxy.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/java-http-proxy.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="AppleJavaExtensions.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/AppleJavaExtensions.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="inheritedJdk" />
</component>
</module>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+96
View File
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.diylc</groupId>
<artifactId>diylc-parent</artifactId>
<version>5.2.0</version>
</parent>
<artifactId>diylc-core</artifactId>
<!-- No need to specify version - it inherits from parent -->
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<!-- Common dependencies from Maven Central -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.4.0-jre</version>
</dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.10.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- Add Mockito for testing -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.11.0</version>
<scope>test</scope>
</dependency>
<!-- Local dependencies from lib folder -->
<dependency>
<groupId>org.diylc.local</groupId>
<artifactId>app-framework</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/app-framework-1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.diylc.local</groupId>
<artifactId>gerber-writer-api-1.0.0</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/gerber-writer-api-1.0.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.diylc.local</groupId>
<artifactId>java-http-proxy</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/../lib/java-http-proxy.jar</systemPath>
</dependency>
</dependencies>
</project>
@@ -1,24 +1,24 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.announcements;
import java.io.Serializable;
@@ -1,41 +1,43 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.announcements;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import org.diylc.appframework.miscutils.ConfigurationManager;
import org.diylc.plugins.cloud.model.IServiceAPI;
import com.diyfever.httpproxy.PhpFlatProxy;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import org.diylc.appframework.miscutils.ConfigurationManager;
import com.diyfever.httpproxy.PhpFlatProxy;
import com.diyfever.httpproxy.ProxyFactory;
import org.diylc.plugins.cloud.model.IServiceAPI;
public class AnnouncementProvider {
private String serviceUrl = "http://www.diy-fever.com/diylc/api/v1/announcements.html";
private String LAST_READ_KEY = "announcement.lastReadDate";
private String LAST_READ_KEY = "announcement.lastReadDate";
private String USER_ID_KEY = "userId";
private IAnnouncementService service;
@@ -55,20 +57,20 @@ public class AnnouncementProvider {
ConfigurationManager.getInstance().readString(IServiceAPI.URL_KEY, "http://www.diy-fever.com/diylc/api/v1");
ProxyFactory factory = new ProxyFactory(new PhpFlatProxy());
service = factory.createProxy(IAnnouncementService.class, serviceUrl);
}
private String getUserId() {
String userId = ConfigurationManager.getInstance().readString(USER_ID_KEY, null);
if (userId == null) {
userId = UUID.randomUUID().toString();
ConfigurationManager.getInstance().writeValue(USER_ID_KEY, userId);
}
return userId;
}
private String getUserId() {
String userId = ConfigurationManager.getInstance().readString(USER_ID_KEY, null);
if (userId == null) {
userId = UUID.randomUUID().toString();
ConfigurationManager.getInstance().writeValue(USER_ID_KEY, userId);
}
return userId;
}
public String getCurrentAnnouncements(boolean forceLast) throws ParseException {
announcements = service.getAnnouncements(getUserId());
if (announcements == null)
announcements = service.getAnnouncements(getUserId());
if (announcements == null)
return null;
boolean hasUnread = false;
StringBuilder sb = new StringBuilder("<html>");
@@ -19,12 +19,12 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.announcements;
package org.diylc.announcements;
import java.util.List;
import com.diyfever.httpproxy.ParamName;
public interface IAnnouncementService {
public List<Announcement> getAnnouncements(@ParamName("userId")String userId);
}
import com.diyfever.httpproxy.ParamName;
public interface IAnnouncementService {
public List<Announcement> getAnnouncements(@ParamName("userId")String userId);
}
@@ -19,8 +19,8 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.clipboard;
package org.diylc.clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
@@ -28,55 +28,56 @@ import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.Set;
import org.diylc.core.IDIYComponent;
/**
* Represents component selection as a {@link List} of {@link IDIYComponent} objects. Implements
* {@link Transferable}, so it is suitable for clipboard usage.
*
* @author Branislav Stojkovic
*/
public class ComponentTransferable implements Transferable, Serializable {
private static final long serialVersionUID = 1L;
import org.diylc.core.IDIYComponent;
/**
* Represents component selection as a {@link List} of {@link IDIYComponent} objects. Implements
* {@link Transferable}, so it is suitable for clipboard usage.
*
* @author Branislav Stojkovic
*/
public class ComponentTransferable implements Transferable, Serializable {
private static final long serialVersionUID = 1L;
public static final DataFlavor listFlavor = new DataFlavor(ComponentTransferable.class, "application/diylc");
private List<IDIYComponent<?>> components;
private Set<Set<IDIYComponent<?>>> groups;
public ComponentTransferable() {
super();
private Set<Set<IDIYComponent<?>>> groups;
public ComponentTransferable() {
super();
}
public ComponentTransferable(List<IDIYComponent<?>> components) {
super();
this.components = components;
this.groups = null;
}
public ComponentTransferable(List<IDIYComponent<?>> components, Set<Set<IDIYComponent<?>>> groups) {
}
public ComponentTransferable(List<IDIYComponent<?>> components, Set<Set<IDIYComponent<?>>> groups) {
super();
this.components = components;
this.groups = groups;
}
@Override
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
if (flavor.equals(listFlavor)) {
return this;
}
throw new UnsupportedFlavorException(flavor);
}
@Override
public DataFlavor[] getTransferDataFlavors() {
return new DataFlavor[] {listFlavor};
}
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
return flavor.equals(listFlavor);
this.groups = groups;
}
@Override
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
if (flavor.equals(listFlavor)) {
return this;
}
throw new UnsupportedFlavorException(flavor);
}
@Override
public DataFlavor[] getTransferDataFlavors() {
return new DataFlavor[] {listFlavor};
}
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
return flavor.equals(listFlavor);
}
public List<IDIYComponent<?>> getComponents() {
@@ -85,5 +86,5 @@ public class ComponentTransferable implements Transferable, Serializable {
public Set<Set<IDIYComponent<?>>> getGroups() {
return groups;
}
}
}
}
@@ -25,6 +25,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
import org.diylc.core.IDIYComponent;
public class ComponentTransferableFactory {
@@ -19,10 +19,10 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
public class BadPositionException extends Exception {
private static final long serialVersionUID = 1L;
}
package org.diylc.common;
public class BadPositionException extends Exception {
private static final long serialVersionUID = 1L;
}
@@ -1,27 +1,28 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
import java.util.Collection;
import java.util.Collection;
import org.diylc.core.IDIYComponent;
public class BuildingBlock {
@@ -23,6 +23,7 @@ package org.diylc.common;
import java.util.List;
import java.util.Map;
import org.diylc.core.IDIYComponent;
public class BuildingBlockPackage {
@@ -20,6 +20,7 @@ package org.diylc.common;
import java.io.Serializable;
import java.util.List;
import javax.swing.Icon;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.BomPolicy;
@@ -5,6 +5,7 @@ import java.awt.geom.Point2D;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.apache.log4j.Logger;
import org.diylc.core.Angle;
import org.diylc.core.IDIYComponent;
import org.diylc.presenter.ComponentProcessor;
@@ -19,14 +19,14 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
public enum Display {
NAME, VALUE, NONE, BOTH;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
package org.diylc.common;
public enum Display {
NAME, VALUE, NONE, BOTH;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
@@ -1,24 +1,24 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
import java.awt.Graphics;
@@ -56,17 +56,17 @@ public enum DrawOption {
/**
* Draw components in outline mode.
*/
OUTLINE_MODE,
/**
* Include extra space around the layout.
*/
EXTRA_SPACE,
/**
* Whether components should be cached or not.
*/
ENABLE_CACHING,
/**
* Whether locked components should be rendered as transparent or not.
*/
OUTLINE_MODE,
/**
* Include extra space around the layout.
*/
EXTRA_SPACE,
/**
* Whether components should be cached or not.
*/
ENABLE_CACHING,
/**
* Whether locked components should be rendered as transparent or not.
*/
LOCKED_ALPHA;
}
@@ -1,28 +1,29 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
import java.awt.Rectangle;
import java.awt.geom.Point2D;
import java.awt.Rectangle;
import java.awt.geom.Point2D;
import org.diylc.core.Project;
/**
@@ -84,7 +85,7 @@ public enum EventType {
AVAILABLE_CTRL_POINTS_CHANGED,
/**
* Called when mouse cursor is moved. Point object is passed, containing the current cursor
* location (not taking zoom into account) in pixels and two {@link Point2D} objects with coordinates in
* location (not taking zoom into account) in pixels and two {@link Point2D} objects with coordinates in
* inches and mm
*/
MOUSE_MOVED,
@@ -101,9 +102,9 @@ public enum EventType {
/**
* Called to update the status message. New status message is passed as a first parameter.
*/
STATUS_MESSAGE_CHANGED,
/**
* Signals the listeners to scroll to selection.
*/
STATUS_MESSAGE_CHANGED,
/**
* Signals the listeners to scroll to selection.
*/
SCROLL_TO;
}
@@ -19,9 +19,9 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
public enum GridType {
LINES, CROSSHAIR, DOT, NONE;
}
package org.diylc.common;
public enum GridType {
LINES, CROSSHAIR, DOT, NONE;
}
@@ -19,12 +19,12 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
public enum HorizontalAlignment {
LEFT, CENTER, RIGHT;
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
package org.diylc.common;
public enum HorizontalAlignment {
LEFT, CENTER, RIGHT;
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
@@ -19,32 +19,32 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
package org.diylc.common;
import java.io.IOException;
public interface IBlockProcessor {
public interface IBlockProcessor {
public static final String BLOCKS_KEY = "buildingBlocks";
public static final String DEFAULT_BLOCKS_IMPORTED_KEY = "defaultBlocksImported";
void saveSelectionAsBlock(String blockName);
void loadBlock(String blockName) throws InvalidBlockException;
public static final String DEFAULT_BLOCKS_IMPORTED_KEY = "defaultBlocksImported";
void saveSelectionAsBlock(String blockName);
void loadBlock(String blockName) throws InvalidBlockException;
void deleteBlock(String blockName);
int importBlocks(String fileName) throws IOException;
public class BlockAlreadyExistsException extends Exception {
private static final long serialVersionUID = 1L;
}
public class InvalidBlockException extends Exception {
private static final long serialVersionUID = 1L;
}
}
int importBlocks(String fileName) throws IOException;
public class BlockAlreadyExistsException extends Exception {
private static final long serialVersionUID = 1L;
}
public class InvalidBlockException extends Exception {
private static final long serialVersionUID = 1L;
}
}
@@ -19,11 +19,11 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
import org.diylc.core.IDIYComponent;
public interface IComponentFilter {
boolean testComponent(IDIYComponent<?> component);
}
package org.diylc.common;
import org.diylc.core.IDIYComponent;
public interface IComponentFilter {
boolean testComponent(IDIYComponent<?> component);
}
@@ -19,26 +19,27 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
package org.diylc.common;
import java.awt.geom.Point2D;
import org.diylc.core.IDIYComponent;
public interface IComponentTransformer {
public static final int CLOCKWISE = 1;
public static final int COUNTER_CLOCKWISE = 1;
public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1;
boolean canRotate(IDIYComponent<?> component);
boolean canMirror(IDIYComponent<?> component);
boolean mirroringChangesCircuit();
void rotate(IDIYComponent<?> component, Point2D center, int direction);
void mirror(IDIYComponent<?> component, Point2D center, int direction);
}
import org.diylc.core.IDIYComponent;
public interface IComponentTransformer {
public static final int CLOCKWISE = 1;
public static final int COUNTER_CLOCKWISE = 1;
public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1;
boolean canRotate(IDIYComponent<?> component);
boolean canMirror(IDIYComponent<?> component);
boolean mirroringChangesCircuit();
void rotate(IDIYComponent<?> component, Point2D center, int direction);
void mirror(IDIYComponent<?> component, Point2D center, int direction);
}
@@ -1,24 +1,24 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
public interface IKeyProcessor {
@@ -1,24 +1,24 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
import java.awt.Point;
@@ -22,6 +22,8 @@
package org.diylc.common;
import java.util.List;
import java.util.Set;
import org.diylc.netlist.Netlist;
import org.diylc.netlist.Node;
import org.diylc.netlist.Summary;
@@ -58,4 +60,9 @@ public interface INetlistAnalyzer {
* @return name of the font to be used for display.
*/
String getFontName();
/**
* @return ability to process netlists with or without switches included.
*/
Set<NetlistSwitchPreference> getSwitchPreference();
}
@@ -22,6 +22,7 @@
package org.diylc.common;
import java.util.List;
import org.diylc.netlist.INetlistParser;
import org.diylc.netlist.Netlist;
import org.diylc.netlist.NetlistException;
@@ -19,22 +19,22 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
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);
}
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,47 +1,48 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.Area;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
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.Version;
import org.diylc.appframework.update.VersionNumber;
import org.diylc.clipboard.ComponentTransferable;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.Template;
import org.diylc.core.Theme;
import org.diylc.core.measures.Size;
import org.diylc.test.ITestProcessor;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.Area;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
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.Version;
import org.diylc.appframework.update.VersionNumber;
import org.diylc.clipboard.ComponentTransferable;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.Template;
import org.diylc.core.Theme;
import org.diylc.core.measures.Size;
import org.diylc.test.ITestProcessor;
/**
* Interface for communication between plug-ins and the application. Plug-ins may acquire
@@ -60,10 +61,11 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
public static final String ANTI_ALIASING_KEY = "antiAliasing";
public static final String HI_QUALITY_RENDER_KEY = "hiQualityRender";
public static final String HIGH_DPI_RENDERING = "hiDpiRendering";
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_KEY = "snapTo";
public static final String CONTINUOUS_CREATION_KEY = "continuousCreation";
public static final String AUTO_EDIT_KEY = "autoEdit";
@@ -75,27 +77,26 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
public static final String RECENT_COMPONENTS_KEY = "recentComponents";
public static final String RECENT_FILES_KEY = "recentFiles";
public static final String SHOW_RULERS_KEY = "showRulers";
public static final String SHOW_GRID_KEY = "showGrid";
public static final String HIGHLIGHT_CONTINUITY_AREA = "highlightContinuityArea";
public static final String HARDWARE_ACCELERATION = "hardwareAcceleration";
public static final String EXTRA_SPACE_KEY = "extraSpace";
public static final String FAVORITES_KEY = "favorites";
public static final String RENUMBER_ON_PASTE_KEY = "renumberOnPaste";
public static final String RULER_IN_SUBDIVISION_KEY = "rulerInSubdivision";
public static final String CACHING_ENABLED_KEY = "cachingEnabled";
public static final String RULER_IN_SUBDIVISION_2 = "base of 2";
public static final String RULER_IN_SUBDIVISION_10 = "base of 10";
public static final String RULER_IN_SUBDIVISION_DEFAULT = RULER_IN_SUBDIVISION_10;
public static final String SNAP_TO_NONE = "None";
public static final String SNAP_TO_GRID = "Grid";
public static final String SNAP_TO_COMPONENTS = "Components";
public static final String SNAP_TO_DEFAULT = SNAP_TO_GRID;
public static final String LOCKED_ALPHA = "lockedAlpha";
public static final String LANGUAGE = "language";
public static final String SHOW_GRID_KEY = "showGrid";
public static final String HARDWARE_ACCELERATION = "hardwareAcceleration";
public static final String EXTRA_SPACE_KEY = "extraSpace";
public static final String FAVORITES_KEY = "favorites";
public static final String RENUMBER_ON_PASTE_KEY = "renumberOnPaste";
public static final String RULER_IN_SUBDIVISION_KEY = "rulerInSubdivision";
public static final String CACHING_ENABLED_KEY = "cachingEnabled";
public static final String RULER_IN_SUBDIVISION_2 = "base of 2";
public static final String RULER_IN_SUBDIVISION_10 = "base of 10";
public static final String RULER_IN_SUBDIVISION_DEFAULT = RULER_IN_SUBDIVISION_10;
public static final String SNAP_TO_NONE = "None";
public static final String SNAP_TO_GRID = "Grid";
public static final String SNAP_TO_COMPONENTS = "Components";
public static final String SNAP_TO_DEFAULT = SNAP_TO_GRID;
public static final String LOCKED_ALPHA = "lockedAlpha";
public static final String LANGUAGE = "language";
public static final String LANGUAGE_DEFAULT = "English";
public static final int DND_TOGGLE_STICKY = 0x1;
@@ -114,7 +115,7 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
* 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
* @param useZoom
* @param includeExtraSpace
*
* @return canvas dimensions
@@ -126,9 +127,9 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
*
* Note: point coordinates are scaled for zoom factor.
*
* @param point
* @param ctrlDown
* @param shiftDown
* @param point
* @param ctrlDown
* @param shiftDown
* @param altDown
* @return cursor
*/
@@ -145,8 +146,8 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
* Loads specified {@link Project}.
*
* @param project
* @param freshStart
* @param optional file name when loading from a file
* @param freshStart
* @param filename file name when loading from a file
*/
void loadProject(Project project, boolean freshStart, String filename);
@@ -168,14 +169,14 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
* @param fileName
* @param isBackup
*/
void saveProjectToFile(String fileName, boolean isBackup);
/**
* Exports the current project into one or more files - one per layer and potentially drill layer.
*
* @param fileNameBase
* @param g2d
*/
void saveProjectToFile(String fileName, boolean isBackup);
/**
* Exports the current project into one or more files - one per layer and potentially drill layer.
*
* @param fileNameBase
* @param g2d
*/
void exportToGerber(String fileNameBase, Graphics2D g2d);
/**
@@ -210,9 +211,9 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
*
* @param g2d
* @param drawOptions specific drawing options
* @param filter
* @param externalZoom
* @param scaleFactor
* @param filter
* @param externalZoom
* @param scaleFactor
* @param visibleRect
*/
void draw(Graphics2D g2d, Set<DrawOption> drawOptions, IComponentFilter filter, Double externalZoom, Double scaleFactor, Rectangle2D visibleRect);
@@ -238,20 +239,20 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
*
* @return
*/
VersionNumber getCurrentVersionNumber();
/**
* Returns few most recent versions.
*
* @return
*/
VersionNumber getCurrentVersionNumber();
/**
* Returns few most recent versions.
*
* @return
*/
List<Version> getRecentUpdates();
/**
* Adds a list of components to the project.
*
* @param componentTransferable
* @param autoGroup
* @param componentTransferable
* @param autoGroup
* @param assignNewNames
*/
void pasteComponents(ComponentTransferable componentTransferable, boolean autoGroup, boolean assignNewNames);
@@ -317,8 +318,8 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
* component.
*
* @param componentType
* @param template optional
* @param model optional datasheet model
* @param template optional
* @param model optional datasheet model
* @param forceInstatiate
*/
void setNewComponentTypeSlot(ComponentType componentType, Template template, String[] model, boolean forceInstatiate);
@@ -373,29 +374,41 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
*
* @param xAxisFirst
*/
void renumberSelectedComponents(boolean xAxisFirst);
/**
* @return size of extra space around the canvas
*/
double getExtraSpace();
/**
* Applies changes to the current project as specified by the provided {@link IProjectEditor}.
*
* @param editor
*/
void applyEditor(IProjectEditor editor);
/**
* Locks or unlocks a single component.
*/
void lockComponent(IDIYComponent<?> c, boolean locked);
/**
* Checks for proximity between continuity areas and creates additional components around any problematic areas to visually identify them.
*
* @param threshold
*/
void renumberSelectedComponents(boolean xAxisFirst);
/**
* @return size of extra space around the canvas
*/
double getExtraSpace();
/**
* Applies changes to the current project as specified by the provided {@link IProjectEditor}.
*
* @param editor
*/
void applyEditor(IProjectEditor editor);
/**
* Locks or unlocks a single component.
*/
void lockComponent(IDIYComponent<?> c, boolean locked);
/**
* Checks for proximity between continuity areas and creates additional components around any problematic areas to visually identify them.
*
* @param threshold
*/
List<Area> checkContinuityAreaProximity(Size threshold);
/**
* @return the current operation mode of the application
*/
OperationMode getOperationMode();
/**
* Updates the current operation mode of the application
*
* @param operationMode
*/
void setOperationMode(OperationMode operationMode);
}
@@ -22,6 +22,7 @@
package org.diylc.common;
import java.util.Set;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
@@ -1,33 +1,34 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.Collection;
import java.util.List;
import org.diylc.clipboard.ComponentTransferable;
import org.diylc.core.ExpansionMode;
import org.diylc.core.IDIYComponent;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.Collection;
import java.util.List;
import org.diylc.clipboard.ComponentTransferable;
import org.diylc.core.ExpansionMode;
import org.diylc.core.IDIYComponent;
import org.diylc.core.measures.Size;
public interface ISelectionProcessor {
@@ -37,20 +38,20 @@ public interface ISelectionProcessor {
*
* @return
*/
Collection<IDIYComponent<?>> getSelectedComponents();
/**
* Returns selected component types
*
* @return
*/
Collection<IDIYComponent<?>> getSelectedComponents();
/**
* Returns selected component types
*
* @return
*/
Collection<ComponentType> getSelectedComponentTypes();
/**
* 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
* @param newSelection
* @param panToSelection
*/
void setSelection(Collection<IDIYComponent<?>> newSelection, boolean panToSelection);
@@ -59,7 +60,7 @@ public interface ISelectionProcessor {
* Finds all components at the specified location, sorted by z-index from top to bottom. Location
* depends on the current zoom level.
*
* @param point
* @param point
* @param includeLocked
* @return
*/
@@ -108,8 +109,8 @@ public interface ISelectionProcessor {
/**
* Returns the minimum rectangle containing all selected components, or null if none exists.
* Rectangle is scaled by the current zoom level.
*
* @param applyZoom
*
* @param applyZoom
*
* @return
*/
@@ -122,36 +123,36 @@ public interface ISelectionProcessor {
* @param yOffset
* @param includeStuckComponents
*/
void nudgeSelection(Size xOffset, Size yOffset, boolean includeStuckComponents);
/**
* Selects components that match the criteria.
*
* @param criteria
*/
void selectMatching(String criteria);
/**
* Attempts to apply the specified model to all selected components.
*
* @param model
*/
void applyModelToSelection(String[] model);
/**
* Sends each of the selected components one step back.
*/
void sendSelectionToBack();
/**
* Brings each of the selected components one step to front.
*/
void bringSelectionToFront();
/**
* Move selected components to z index starting from the provided value
* @param zIndex
*/
void nudgeSelection(Size xOffset, Size yOffset, boolean includeStuckComponents);
/**
* Selects components that match the criteria.
*
* @param criteria
*/
void selectMatching(String criteria);
/**
* Attempts to apply the specified model to all selected components.
*
* @param model
*/
void applyModelToSelection(String[] model);
/**
* Sends each of the selected components one step back.
*/
void sendSelectionToBack();
/**
* Brings each of the selected components one step to front.
*/
void bringSelectionToFront();
/**
* Move selected components to z index starting from the provided value
* @param zIndex
*/
void moveSelectionToZIndex(int zIndex);
}
@@ -1,24 +1,24 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
/**
@@ -19,37 +19,38 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
package org.diylc.common;
import java.io.IOException;
import java.util.List;
import org.diylc.core.Template;
public interface IVariantProcessor {
public interface IVariantProcessor {
public static final String TEMPLATES_KEY = "templates";
public static final String DEFAULT_TEMPLATES_KEY = "defaultTemplates";
public static final String DEFAULT_TEMPLATES_IMPORT_DATE_KEY = "defaultTemplatesImportDate";
void saveSelectedComponentAsVariant(String variantName);
List<Template> getVariantsFor(ComponentType type);
List<Template> getVariantsForSelection();
void applyVariantToSelection(Template variant);
void deleteVariant(ComponentType type, String variantName);
public static final String DEFAULT_TEMPLATES_IMPORT_DATE_KEY = "defaultTemplatesImportDate";
void saveSelectedComponentAsVariant(String variantName);
List<Template> getVariantsFor(ComponentType type);
List<Template> getVariantsForSelection();
void applyVariantToSelection(Template variant);
void deleteVariant(ComponentType type, String variantName);
void setDefaultVariant(ComponentType type, String variantName);
int importVariants(String fileName) throws IOException;
String getDefaultVariant(ComponentType type);
public class VariantAlreadyExistsException extends Exception {
private static final long serialVersionUID = 1L;
}
}
String getDefaultVariant(ComponentType type);
public class VariantAlreadyExistsException extends Exception {
private static final long serialVersionUID = 1L;
}
}
@@ -19,14 +19,14 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
public enum LabelPosition {
ABOVE, BELOW;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
package org.diylc.common;
public enum LabelPosition {
ABOVE, BELOW;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
@@ -19,14 +19,14 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
public enum LineStyle {
SOLID, DASHED, DOTTED;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
package org.diylc.common;
public enum LineStyle {
SOLID, DASHED, DOTTED;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
@@ -0,0 +1,5 @@
package org.diylc.common;
public enum NetlistSwitchPreference {
WITH, WITHOUT;
}
@@ -0,0 +1,5 @@
package org.diylc.common;
public enum OperationMode {
EDIT, HIGHLIGHT_CONNECTED_AREAS
}
@@ -19,38 +19,28 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
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";
}
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";
}
}
public double toDegrees() {
switch (this) {
case DEFAULT:
return 0;
case _180:
return 180;
case _270:
return 270;
case _90:
return 90;
default:
break;
}
return 0;
if (this == DEFAULT)
return 0;
return Integer.parseInt(name().replace("_", ""));
}
public double toRadians() {
return Math.toRadians(toDegrees());
}
}
}
}
@@ -0,0 +1,46 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
public enum Orientation45 {
DEFAULT, _45, _90, _135, _180, _225, _270, _315;
@Override
public String toString() {
if (this == DEFAULT) {
return "Default";
} else {
return name().replace("_", "") + " degrees clockwise";
}
}
public double toDegrees() {
if (this == DEFAULT)
return 0;
return Integer.parseInt(name().replace("_", ""));
}
public double toRadians() {
return Math.toRadians(toDegrees());
}
}
@@ -19,14 +19,14 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
public enum OrientationHV {
VERTICAL, HORIZONTAL;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
package org.diylc.common;
public enum OrientationHV {
VERTICAL, HORIZONTAL;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
@@ -23,18 +23,18 @@ package org.diylc.common;
import org.diylc.core.gerber.GerberLayer;
public enum PCBLayer {
public enum PCBLayer {
_1("Bottom"), _2("Top"), _3("Inner 1"), _4("Inner 2"), _5("Inner 3"), _6("Inner 4"), _7("Inner 5"), _8("Inner 6");
private String label;
private PCBLayer(String label) {
this.label = label;
}
public String toString() {
return label;
}
public String toString() {
return label;
};
public int getId() {
@@ -48,5 +48,5 @@ public enum PCBLayer {
default:
throw new RuntimeException("Unsupported PCB layer: " + this);
}
}
}
}
}
@@ -1,28 +1,30 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.diylc.core.IDynamicPropertySource;
import org.diylc.core.IPropertyValidator;
/**
@@ -44,9 +46,10 @@ public class PropertyWrapper implements Cloneable {
private boolean changed = false;
private int sortOrder;
private Object ownerObject;
private IDynamicPropertySource dynamicPropertySource;
public PropertyWrapper(String name, Class<?> type, String getter, String setter, boolean defaultable,
IPropertyValidator validator, int sortOrder) {
IPropertyValidator validator, int sortOrder, IDynamicPropertySource dynamicPropertySource) {
super();
this.name = name;
this.type = type;
@@ -55,6 +58,7 @@ public class PropertyWrapper implements Cloneable {
this.defaultable = defaultable;
this.validator = validator;
this.sortOrder = sortOrder;
this.dynamicPropertySource = dynamicPropertySource;
this.ownerObject = null;
}
@@ -74,19 +78,19 @@ public class PropertyWrapper implements Cloneable {
// }
public void writeTo(Object object) throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException, SecurityException, NoSuchMethodException {
// nothing to do if no setter
if (setter == null)
InvocationTargetException, SecurityException, NoSuchMethodException {
// nothing to do if no setter
if (setter == null)
return;
object.getClass().getMethod(setter, type).invoke(object, this.value);
}
public Method getGetter() throws SecurityException, NoSuchMethodException {
return getOwnerObject().getClass().getMethod(getter);
}
public boolean isReadOnly() {
return setter == null;
}
public boolean isReadOnly() {
return setter == null;
}
public String getName() {
@@ -137,6 +141,10 @@ public class PropertyWrapper implements Cloneable {
return sortOrder;
}
public IDynamicPropertySource getDynamicPropertySource() {
return dynamicPropertySource;
}
// @Override
// public Object clone() throws CloneNotSupportedException {
// // Try to invoke clone method on value if possible.
@@ -151,7 +159,7 @@ public class PropertyWrapper implements Cloneable {
public Object clone() throws CloneNotSupportedException {
PropertyWrapper clone =
new PropertyWrapper(this.name, this.type, this.getter, this.setter, this.defaultable, this.validator,
this.sortOrder);
this.sortOrder, this.dynamicPropertySource);
clone.value = this.value;
clone.changed = this.changed;
clone.unique = this.unique;
@@ -19,17 +19,17 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
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();
}
}
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();
}
}
@@ -23,6 +23,7 @@ package org.diylc.common;
import java.util.List;
import java.util.Map;
import org.diylc.core.Template;
public class VariantPackage {
@@ -19,12 +19,12 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
public enum VerticalAlignment {
TOP, CENTER, BOTTOM;
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
package org.diylc.common;
public enum VerticalAlignment {
TOP, CENTER, BOTTOM;
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
@@ -22,6 +22,7 @@
package org.diylc.components;
import java.awt.Shape;
import org.diylc.common.Orientation;
import org.diylc.core.Angle;
import org.diylc.core.annotations.EditableProperty;
@@ -1,40 +1,41 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.components;
import java.awt.Color;
import java.awt.Font;
import java.awt.Shape;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import java.awt.Color;
import java.awt.Font;
import java.awt.Shape;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
/**
* Abstract implementation of {@link IDIYComponent} that contains component name and toString.
@@ -57,14 +58,14 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
public static Color LABEL_COLOR = Color.black;
public static Color LABEL_COLOR_SELECTED = Color.red;
public static Font LABEL_FONT = new Font("Square721 BT", Font.PLAIN, 14);
public static Color METAL_COLOR = Color.decode("#759DAF");
public static Color METAL_COLOR = Color.decode("#759DAF");
public static Color LIGHT_METAL_COLOR = Color.decode("#EEEEEE");
public static Color COPPER_COLOR = Color.decode("#DA8A67");
public static Color GOLD_COLOR = Color.decode("#F4B301");
public static Color FR4_COLOR = Color.decode("#6B9B6B");
public static Color FR4_LIGHT_COLOR = Color.decode("#BABE71");
public static Color PHENOLIC_COLOR = Color.decode("#F8EBB3");
public static Color PHENOLIC_DARK_COLOR = Color.decode("#CD8500");
public static Color COPPER_COLOR = Color.decode("#DA8A67");
public static Color GOLD_COLOR = Color.decode("#F4B301");
public static Color FR4_COLOR = Color.decode("#6B9B6B");
public static Color FR4_LIGHT_COLOR = Color.decode("#BABE71");
public static Color PHENOLIC_COLOR = Color.decode("#F8EBB3");
public static Color PHENOLIC_DARK_COLOR = Color.decode("#CD8500");
@EditableProperty(defaultable = false)
@Override
@@ -88,13 +89,13 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
}
@Override
public String getValueForDisplay() {
if (getValue() == null)
return "";
Object val = getValue();
if (val.getClass().isArray()) {
return String.join(" / ", Arrays.stream((Object[])val).map(x -> x == null ? "" : x.toString()).collect(Collectors.toList()));
public String getValueForDisplay() {
if (getValue() == null)
return "";
Object val = getValue();
if (val.getClass().isArray()) {
return String.join(" / ", Arrays.stream((Object[])val).map(x -> x == null ? "" : x.toString()).collect(Collectors.toList()));
}
return val.toString();
}
@@ -107,17 +108,17 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
*/
protected int getClosestOdd(double x) {
return ((int) x / 2) * 2 + 1;
}
/**
* 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(Size s) {
double x = s.convertToPixels();
return ((int) x / 2) * 2 + 1;
}
/**
* 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(Size s) {
double x = s.convertToPixels();
return ((int) x / 2) * 2 + 1;
}
/**
@@ -136,9 +137,9 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
* @param clip
* @return true if none of the control points lie in the clip rectangle.
*/
protected boolean checkPointsClipped(Shape clip) {
if (clip == null) {
return false;
protected boolean checkPointsClipped(Shape clip) {
if (clip == null) {
return false;
}
for (int i = 0; i < getControlPointCount(); i++) {
if (clip.contains(getControlPoint(i))) {
@@ -171,7 +172,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
@SuppressWarnings("unchecked")
public IDIYComponent<T> clone() throws CloneNotSupportedException {
try {
// Instantiate object of the same type
// Instantiate object of the same type
Class<?> clazz = this.getClass();
AbstractComponent<T> newInstance = (AbstractComponent<T>) clazz.getDeclaredConstructor().newInstance();
while (AbstractComponent.class.isAssignableFrom(clazz)) {
@@ -191,7 +192,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
&& value.getClass().getComponentType().isAssignableFrom(Point2D.class)) {
Object newArray = Array.newInstance(value.getClass().getComponentType(), Array.getLength(value));
for (int i = 0; i < Array.getLength(value); i++) {
Point2D p = (Point2D) Array.get(value, i);
Point2D p = (Point2D) Array.get(value, i);
if (p != null)
Array.set(newArray, i, new Point2D.Double(p.getX(), p.getY()));
}
@@ -199,7 +200,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
}
// Deep copy points.
// TODO: something nicer
if (value != null && value instanceof Point2D) {
if (value != null && value instanceof Point2D) {
Point2D p = (Point2D) value;
value = new Point2D.Double(p.getX(), p.getY());
}
@@ -212,7 +213,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
} catch (Exception e) {
throw new CloneNotSupportedException("Could not clone the component. Reason: " + e.getMessage());
}
}
}
@Override
public boolean equalsTo(IDIYComponent<?> other) {
@@ -229,7 +230,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
// in
// AbstractComponent or one of it's child classes
for (Field field : fields) {
if (!Modifier.isStatic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers()) &&
if (!Modifier.isStatic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers()) &&
!Modifier.isTransient(field.getModifiers())) {
field.setAccessible(true);
try {
@@ -251,45 +252,45 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
return true;
if (o1 == null || o2 == null)
return false;
if (o1.getClass().isArray()) {
if (o1.getClass().getComponentType() == byte.class)
return Arrays.equals((byte[]) o1, (byte[]) o2);
if (o1.getClass().getComponentType() == double.class)
return Arrays.equals((double[]) o1, (double[]) o2);
if (o1.getClass().getComponentType() == int.class)
if (o1.getClass().isArray()) {
if (o1.getClass().getComponentType() == byte.class)
return Arrays.equals((byte[]) o1, (byte[]) o2);
if (o1.getClass().getComponentType() == double.class)
return Arrays.equals((double[]) o1, (double[]) o2);
if (o1.getClass().getComponentType() == int.class)
return Arrays.equals((int[]) o1, (int[]) o2);
return Arrays.equals((Object[]) o1, (Object[]) o2);
}
return o1.equals(o2);
}
@Override
public String getControlPointNodeName(int index) {
return Integer.toString(index + 1);
}
@Override
public String getInternalLinkName(int index1, int index2) {
return null;
}
@Override
public String[] getSectionNames(int pointIndex) {
return null;
}
@Override
public boolean canPointMoveFreely(int pointIndex) {
return true;
}
@Override
public Rectangle2D getCachingBounds() {
return null;
}
@Override
public void createdIn(Project project) {
// TODO Auto-generated method stub
}
@Override
public String getControlPointNodeName(int index) {
return Integer.toString(index + 1);
}
@Override
public String getInternalLinkName(int index1, int index2) {
return null;
}
@Override
public String[] getSectionNames(int pointIndex) {
return null;
}
@Override
public boolean canPointMoveFreely(int pointIndex) {
return true;
}
@Override
public Rectangle2D getCachingBounds() {
return null;
}
@Override
public void createdIn(Project project) {
// TODO Auto-generated method stub
}
}
@@ -30,6 +30,10 @@ import java.util.List;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.ConfigurationManager;
import com.google.common.collect.Streams;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
import org.diylc.common.IPlugInPort;
import org.diylc.common.LineStyle;
import org.diylc.common.ObjectCache;
@@ -41,8 +45,6 @@ import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
import com.google.common.collect.Streams;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComponent<T> {
@@ -74,7 +76,7 @@ public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComp
* @param curve
* @param g2d
* @param componentState
* @param theme
* @param drawingObserver
*/
protected abstract void drawCurve(Path2D curve, Graphics2D g2d, ComponentState componentState,
IDrawingObserver drawingObserver);
@@ -199,6 +201,9 @@ public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComp
}
public void setPointCount(PointCount pointCount) {
if (this.pointCount == pointCount)
return;
Point2D[] p = getControlPoints();
Point2D[] newPoints = new Point2D[pointCount.count];
newPoints[0] = p[0];
@@ -19,13 +19,13 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.components;
import org.diylc.core.annotations.EditableProperty;
public abstract class AbstractLabeledComponent<T> extends AbstractTransparentComponent<T> {
private static final long serialVersionUID = 1L;
package org.diylc.components;
import org.diylc.core.annotations.EditableProperty;
public abstract class AbstractLabeledComponent<T> extends AbstractTransparentComponent<T> {
private static final long serialVersionUID = 1L;
protected Integer fontSizeOverride;
@@ -36,5 +36,5 @@ public abstract class AbstractLabeledComponent<T> extends AbstractTransparentCom
public void setFontSizeOverride(Integer fontSizeOverride) {
this.fontSizeOverride = fontSizeOverride;
}
}
}
}
@@ -19,24 +19,27 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}
}
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() {
if (alpha == null) {
alpha = MAX_ALPHA;
}
return alpha;
}
public void setAlpha(Byte alpha) {
this.alpha = alpha;
}
}
@@ -1,28 +1,29 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.components.transform;
import java.awt.geom.Point2D;
import org.diylc.common.IComponentTransformer;
import java.awt.geom.Point2D;
import org.diylc.common.IComponentTransformer;
import org.diylc.core.IDIYComponent;
public class DefaultTransformer implements IComponentTransformer {
@@ -1,29 +1,30 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.components.transform;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import org.diylc.common.IComponentTransformer;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import org.diylc.common.IComponentTransformer;
import org.diylc.core.IDIYComponent;
public class LeadedComponentTransformer implements IComponentTransformer {
@@ -46,7 +47,7 @@ public class LeadedComponentTransformer implements IComponentTransformer {
@Override
public void rotate(IDIYComponent<?> component, Point2D center, int direction) {
AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2 * direction, center.getX(), center.getY());
for (int index = 0; index < component.getControlPointCount(); index++) {
for (int index = 0; index < component.getControlPointCount(); index++) {
Point2D p = new Point2D.Double();
rotate.transform(component.getControlPoint(index), p);
component.setControlPoint(p, index);
@@ -1,30 +1,31 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.components.transform;
import java.awt.Point;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import org.diylc.common.IComponentTransformer;
import java.awt.Point;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import org.diylc.common.IComponentTransformer;
import org.diylc.core.IDIYComponent;
public class SimpleComponentTransformer implements IComponentTransformer {
@@ -0,0 +1,34 @@
package org.diylc.core;
import org.diylc.common.PropertyWrapper;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public abstract class AbstractDynamicPropertyValueSource implements IDynamicPropertySource {
protected List<PropertyWrapper> properties;
protected IDIYComponent<?> component;
@Override
public void setProperties(List<PropertyWrapper> properties) {
this.properties = properties;
}
@Override
public void setComponent(IDIYComponent<?> component) {
this.component = component;
}
@Override
public String getDisplayValue(Object value) {
if (value == null) {
return "None";
}
if (component instanceof ISwitch sw) {
return sw.getPositionName((Integer)value);
}
return "#" + (((Integer)value) + 1);
}
}
@@ -19,15 +19,15 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
/**
* Validator that allows all values.
*
* @author Branislav Stojkovic
*/
public class AllowAllValidator implements IPropertyValidator {
@Override
public void validate(Object owner, Object value) throws ValidationException {}
}
package org.diylc.core;
/**
* Validator that allows all values.
*
* @author Branislav Stojkovic
*/
public class AllowAllValidator implements IPropertyValidator {
@Override
public void validate(Object owner, Object value) throws ValidationException {}
}
@@ -1,9 +1,10 @@
package org.diylc.core;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
public class Angle {
public class Angle implements Serializable {
private int value;
@@ -0,0 +1,10 @@
package org.diylc.core;
public enum BoardUndersideDisplay {
NONE, ABOVE, BELOW, LEFT, RIGHT;
@Override
public String toString() {
return super.toString().charAt(0) + super.toString().substring(1).toLowerCase();
}
}
@@ -19,14 +19,14 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
/**
* Enumerates all possible states that a component can be in.
*
* @author Branislav Stojkovic
*/
public enum ComponentState {
NORMAL, SELECTED, LOCKED, DRAGGING
}
package org.diylc.core;
/**
* Enumerates all possible states that a component can be in.
*
* @author Branislav Stojkovic
*/
public enum ComponentState {
NORMAL, SELECTED, LOCKED, DRAGGING
}
@@ -19,9 +19,9 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
public enum CreationMethod {
SINGLE_CLICK, POINT_BY_POINT;
}
package org.diylc.core;
public enum CreationMethod {
SINGLE_CLICK, POINT_BY_POINT;
}
@@ -19,9 +19,9 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
public enum ExpansionMode {
ALL, SAME_TYPE, IMMEDIATE,
}
package org.diylc.core;
public enum ExpansionMode {
ALL, SAME_TYPE, IMMEDIATE,
}
@@ -0,0 +1,18 @@
package org.diylc.core;
import org.diylc.core.measures.Size;
import java.awt.geom.Rectangle2D;
public interface IBoard {
Rectangle2D getBoardRectangle();
BoardUndersideDisplay getUndersideDisplay();
Size getUndersideOffset();
Boolean getUndersideTransparency();
boolean shouldExportToGerber();
}
@@ -1,31 +1,32 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
import org.diylc.core.annotations.ComponentDescriptor;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
/**
@@ -50,7 +51,7 @@ public interface IDIYComponent<T> extends Serializable, Cloneable {
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 COMPONENT = 4;
public static final int WIRING = 5;
public static final int TEXT = 6;
@@ -111,37 +112,37 @@ public interface IDIYComponent<T> extends Serializable, Cloneable {
* same component</b>. The other control point must be able to overlap too.
*/
boolean canControlPointOverlap(int index);
/**
* @param index
* @return {@link VisibilityPolicy} of the control point.
/**
* @param index
* @return {@link VisibilityPolicy} of the control point.
*/
VisibilityPolicy getControlPointVisibilityPolicy(int index);
/**
* @param index
* @return name of the control point node, if the control point represents a graph node, null otherwise.
*/
String getControlPointNodeName(int index);
/**
* @param index1
* @param index2
* @return name of the internal linked formed by the two control points, null if they do not form an internal link
*/
String getInternalLinkName(int index1, int index2);
/**
* @param pointIndex
* @return name of the internal section containing the specified point, or null if the component does not have internal sections.
* One point can be shared between multiple sections, in which case, the result may contain more than one element.
*/
String[] getSectionNames(int pointIndex);
/**
* @param pointIndex
* @return true if the control point can move without affecting other points' position, false otherwise
*/
VisibilityPolicy getControlPointVisibilityPolicy(int index);
/**
* @param index
* @return name of the control point node, if the control point represents a graph node, null otherwise.
*/
String getControlPointNodeName(int index);
/**
* @param index1
* @param index2
* @return name of the internal linked formed by the two control points, null if they do not form an internal link
*/
String getInternalLinkName(int index1, int index2);
/**
* @param pointIndex
* @return name of the internal section containing the specified point, or null if the component does not have internal sections.
* One point can be shared between multiple sections, in which case, the result may contain more than one element.
*/
String[] getSectionNames(int pointIndex);
/**
* @param pointIndex
* @return true if the control point can move without affecting other points' position, false otherwise
*/
boolean canPointMoveFreely(int pointIndex);
/**
@@ -184,18 +185,18 @@ public interface IDIYComponent<T> extends Serializable, Cloneable {
* @param other
* @return
*/
boolean equalsTo(IDIYComponent<?> other);
/**
* Used only if {@link ComponentDescriptor#enableCache()} is set to true.
* @return
*/
Rectangle2D getCachingBounds();
/**
* Notifies the component that it's being created in the context of the specified project
*
* @param project
*/
boolean equalsTo(IDIYComponent<?> other);
/**
* Used only if {@link ComponentDescriptor#enableCache()} is set to true.
* @return
*/
Rectangle2D getCachingBounds();
/**
* Notifies the component that it's being created in the context of the specified project
*
* @param project
*/
void createdIn(Project project);
}
@@ -21,22 +21,22 @@
*/
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 {
/**
* 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 {
/**
* Notifies the observer that it should start tracking the drawing process.
*/
void stopTracking();
*/
void stopTracking();
/**
* Notifies the observer that it should stop tracking the drawing process.
*/
*/
void startTracking();
/**
@@ -64,5 +64,5 @@ public interface IDrawingObserver {
*
* @param marker
*/
void setContinuityMarker(String marker);
}
void setContinuityMarker(String marker);
}
@@ -0,0 +1,38 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
import org.diylc.common.PropertyWrapper;
import java.util.List;
import java.util.Map;
public interface IDynamicPropertySource {
void setProperties(List<PropertyWrapper> properties);
void setComponent(IDIYComponent<?> ownerObject);
List<Object> getAvailableValues();
String getDisplayValue(Object value);
}
@@ -19,19 +19,19 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
/**
* Interface for validating property value changes.
*
* @author Branislav Stojkovic
*/
public interface IPropertyValidator {
package org.diylc.core;
/**
* Interface for validating property value changes.
*
* @author Branislav Stojkovic
*/
public interface IPropertyValidator {
/**
* @param owner
* @param value
* @throws ValidationException if validation fails. Message will contain the reason.
*/
void validate(Object owner, Object value) throws ValidationException;
}
* @param owner
* @param value
* @throws ValidationException if validation fails. Message will contain the reason.
*/
void validate(Object owner, Object value) throws ValidationException;
}
@@ -21,12 +21,29 @@
*/
package org.diylc.core;
import java.awt.Color;
import java.util.List;
import java.util.Map;
/**
* Interface for all component that can act as switches. They must have at least one position.
*
* @author Branislav Stojkovic
*/
public interface ISwitch {
public interface ISwitch extends IContinuity {
Color[] POLE_COLORS = new Color[] {
Color.decode("#FFD1DC"), // Pastel Pink
Color.decode("#FFE5B4"), // Pastel Peach
Color.decode("#B8F2E6"), // Pastel Mint
Color.decode("#E6E6FA"), // Pastel Lavender
Color.decode("#AEC6CF"), // Pastel Blue
Color.decode("#FFFACD"), // Pastel Yellow
Color.decode("#FF6961"), // Pastel Red
Color.decode("#77DD77"), // Pastel Green
Color.decode("#CDB4DB"), // Pastel Purple
Color.decode("#AAF0D1") // Pastel Turquoise
};
/**
* @return a positive number of positions.
@@ -48,4 +65,22 @@ public interface ISwitch {
* @return true if the two points are connected in the given switch position, false otherwise.
*/
boolean arePointsConnected(int index1, int index2, int position);
/**
* @return currently selected switch position, or null if none
*/
default Integer getSelectedPosition() {
return null;
}
default Boolean getHighlightConnectedTerminals() {
return false;
}
default boolean arePointsConnected(int index1, int index2) {
if (getSelectedPosition() == null) {
return false;
}
return arePointsConnected(index1, index2, getSelectedPosition());
}
}
@@ -1,29 +1,30 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
import java.io.File;
import java.util.List;
import java.util.Set;
import java.io.File;
import java.util.List;
import java.util.Set;
import org.diylc.common.PropertyWrapper;
@@ -55,8 +56,8 @@ public interface IView {
int showConfirmDialog(String message, String title, int optionType, int messageType);
boolean editProperties(List<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties, String title);
boolean editProperties(List<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties, String title);
String showInputDialog(String message, String title);
File promptFileSave();
@@ -1,41 +1,42 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
import java.awt.Font;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
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.MultiLineText;
import org.diylc.core.annotations.PositiveMeasureValidator;
import org.diylc.core.annotations.PositiveNonZeroMeasureValidator;
import org.diylc.core.measures.Size;
import java.awt.Font;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
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.MultiLineText;
import org.diylc.core.annotations.PositiveMeasureValidator;
import org.diylc.core.annotations.PositiveNonZeroMeasureValidator;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
/**
@@ -62,11 +63,11 @@ public class Project implements Serializable, Cloneable {
private String description;
private Size width;
private Size height;
private Size gridSpacing;
private Size gridSpacing;
private Integer dotSpacing;
private List<IDIYComponent<?>> components;
private Set<Set<IDIYComponent<?>>> groups;
private Set<Integer> lockedLayers;
private Set<Integer> lockedLayers;
private Set<IDIYComponent<?>> lockedComponents;
private Set<Integer> hiddenLayers;
private Font font = DEFAULT_FONT;
@@ -75,7 +76,7 @@ public class Project implements Serializable, Cloneable {
components = new ArrayList<IDIYComponent<?>>();
groups = new HashSet<Set<IDIYComponent<?>>>();
lockedLayers = new HashSet<Integer>();
hiddenLayers = new HashSet<Integer>();
hiddenLayers = new HashSet<Integer>();
lockedComponents = new HashSet<IDIYComponent<?>>();
title = DEFAULT_TITLE;
author = System.getProperty("user.name");
@@ -137,17 +138,17 @@ public class Project implements Serializable, Cloneable {
public void setGridSpacing(Size gridSpacing) {
this.gridSpacing = gridSpacing;
}
@EditableProperty(name = "Dot Spacing", validatorClass = PositiveNonZeroMeasureValidator.class)
public Integer getDotSpacing() {
if (dotSpacing == null)
dotSpacing = 1;
return dotSpacing;
}
public void setDotSpacing(Integer dotSpacing) {
this.dotSpacing = dotSpacing;
}
@EditableProperty(name = "Dot Spacing", validatorClass = PositiveNonZeroMeasureValidator.class)
public Integer getDotSpacing() {
if (dotSpacing == null)
dotSpacing = 1;
return dotSpacing;
}
public void setDotSpacing(Integer dotSpacing) {
this.dotSpacing = dotSpacing;
}
/**
@@ -166,12 +167,12 @@ public class Project implements Serializable, Cloneable {
*/
public Set<Set<IDIYComponent<?>>> getGroups() {
return groups;
}
public Set<IDIYComponent<?>> getLockedComponents() {
if (lockedComponents == null)
lockedComponents = new HashSet<IDIYComponent<?>>();
return lockedComponents;
}
public Set<IDIYComponent<?>> getLockedComponents() {
if (lockedComponents == null)
lockedComponents = new HashSet<IDIYComponent<?>>();
return lockedComponents;
}
public Set<Integer> getLockedLayers() {
@@ -275,36 +276,36 @@ public class Project implements Serializable, Cloneable {
if (other.width != null)
return false;
} else if (!width.equals(other.width))
return false;
if (gridSpacing == null) {
if (other.gridSpacing != null)
return false;
} else if (!gridSpacing.equals(other.gridSpacing))
return false;
if (font == null) {
if (other.font != null)
return false;
} else if (!font.getFamily().equals(other.font.getFamily()) || font.getSize() != other.font.getSize() || font.getStyle() != other.font.getStyle())
return false;
if (groups == null) {
if (other.groups != null)
return false;
} else if (!groups.equals(other.groups))
return false;
if (lockedLayers == null) {
if (other.lockedLayers != null)
return false;
} else if (!lockedLayers.equals(other.lockedLayers))
return false;
if (getLockedComponents() == null) {
if (other.lockedComponents != null)
return false;
} else if (!getLockedComponents().equals(other.lockedComponents))
return false;
if (hiddenLayers == null) {
if (other.hiddenLayers != null)
return false;
} else if (!hiddenLayers.equals(other.hiddenLayers))
return false;
if (gridSpacing == null) {
if (other.gridSpacing != null)
return false;
} else if (!gridSpacing.equals(other.gridSpacing))
return false;
if (font == null) {
if (other.font != null)
return false;
} else if (!font.getFamily().equals(other.font.getFamily()) || font.getSize() != other.font.getSize() || font.getStyle() != other.font.getStyle())
return false;
if (groups == null) {
if (other.groups != null)
return false;
} else if (!groups.equals(other.groups))
return false;
if (lockedLayers == null) {
if (other.lockedLayers != null)
return false;
} else if (!lockedLayers.equals(other.lockedLayers))
return false;
if (getLockedComponents() == null) {
if (other.lockedComponents != null)
return false;
} else if (!getLockedComponents().equals(other.lockedComponents))
return false;
if (hiddenLayers == null) {
if (other.hiddenLayers != null)
return false;
} else if (!hiddenLayers.equals(other.hiddenLayers))
return false;
return true;
}
@@ -340,7 +341,7 @@ public class Project implements Serializable, Cloneable {
project.setHeight(this.getHeight());
project.setWidth(this.getWidth());
project.getLockedLayers().addAll(this.getLockedLayers());
project.getHiddenLayers().addAll(this.getHiddenLayers());
project.getHiddenLayers().addAll(this.getHiddenLayers());
project.setFont(this.getFont());
Map<IDIYComponent<?>, IDIYComponent<?>> cloneMap = new HashMap<IDIYComponent<?>, IDIYComponent<?>>();
@@ -361,10 +362,10 @@ public class Project implements Serializable, Cloneable {
cloneGroup.add(cloneMap.get(component));
}
project.groups.add(cloneGroup);
}
for (IDIYComponent<?> component : this.getLockedComponents()) {
project.lockedComponents.add(cloneMap.get(component));
}
for (IDIYComponent<?> component : this.getLockedComponents()) {
project.lockedComponents.add(cloneMap.get(component));
}
return project;
}
@@ -19,17 +19,17 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
package org.diylc.core;
import java.awt.geom.Point2D;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
public class Template {
private String name;
private Map<String, Object> values;
import java.util.Map;
public class Template {
private String name;
private Map<String, Object> values;
private List<Point2D> points;
@SuppressWarnings("unused")
@Deprecated
@@ -41,37 +41,37 @@ public class Template {
public Template(String name, Map<String, Object> values, List<Point2D> points) {
this(name, values, points, LocalDateTime.now());
}
public Template(String name, Map<String, Object> values, List<Point2D> points, LocalDateTime createdOn) {
this.name = name;
this.values = values;
}
public Template(String name, Map<String, Object> values, List<Point2D> points, LocalDateTime createdOn) {
this.name = name;
this.values = values;
this.points = points;
this.createdOn = createdOn;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, Object> getValues() {
return values;
}
public void setValues(Map<String, Object> values) {
this.values = values;
}
public List<Point2D> getPoints() {
return points;
}
public void setPoints(List<Point2D> points) {
this.points = points;
this.createdOn = createdOn;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, Object> getValues() {
return values;
}
public void setValues(Map<String, Object> values) {
this.values = values;
}
public List<Point2D> getPoints() {
return points;
}
public void setPoints(List<Point2D> points) {
this.points = points;
}
public LocalDateTime getCreatedOn() {
@@ -80,8 +80,8 @@ public class Template {
public void setCreatedOn(LocalDateTime createdOn) {
this.createdOn = createdOn;
}
}
@Override
public int hashCode() {
final int prime = 31;
@@ -125,8 +125,8 @@ public class Template {
return true;
}
@Override
public String toString() {
return name;
}
}
@Override
public String toString() {
return name;
}
}
@@ -1,27 +1,27 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
import java.awt.Color;
import java.awt.Color;
import java.io.Serializable;
public class Theme implements Serializable {
@@ -31,14 +31,14 @@ public class Theme implements Serializable {
private String name;
private Color bgColor;
private Color gridColor;
private Color outlineColor;
private Color outlineColor;
private Color dotColor;
public Theme(String name, Color bgColor, Color gridColor, Color dotColor, Color outlineColor) {
super();
this.name = name;
this.bgColor = bgColor;
this.gridColor = gridColor;
this.gridColor = gridColor;
this.dotColor = dotColor;
this.outlineColor = outlineColor;
}
@@ -53,12 +53,12 @@ public class Theme implements Serializable {
public Color getGridColor() {
return gridColor;
}
public Color getDotColor() {
if (dotColor == null)
dotColor = gridColor;
return dotColor;
}
public Color getDotColor() {
if (dotColor == null)
dotColor = gridColor;
return dotColor;
}
public Color getOutlineColor() {
@@ -19,13 +19,13 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
public class ValidationException extends Exception {
private static final long serialVersionUID = 1L;
public ValidationException(String message) {
super(message);
}
}
package org.diylc.core;
public class ValidationException extends Exception {
private static final long serialVersionUID = 1L;
public ValidationException(String message) {
super(message);
}
}
@@ -1,24 +1,24 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC 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.
DIYLC 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 DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
/**
@@ -19,15 +19,15 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core.annotations;
/**
* Tells the system how to represent components in the B.O.M.
*
* @see ComponentDescriptor
*
* @author Branislav Stojkovic
*/
public enum BomPolicy {
SHOW_ALL_NAMES, SHOW_ONLY_TYPE_NAME, NEVER_SHOW,
}
package org.diylc.core.annotations;
/**
* Tells the system how to represent components in the B.O.M.
*
* @see ComponentDescriptor
*
* @author Branislav Stojkovic
*/
public enum BomPolicy {
SHOW_ALL_NAMES, SHOW_ONLY_TYPE_NAME, NEVER_SHOW,
}

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